flipper_file_helper.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #include <stdint.h>
  3. #include <mlib/m-string.h>
  4. #include <storage/storage.h>
  5. #include "file_helper.h"
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. extern const char* flipper_file_filetype_key;
  10. extern const char* flipper_file_version_key;
  11. extern const char flipper_file_delimiter;
  12. extern const char flipper_file_comment;
  13. /**
  14. * Reads a valid key from a file as a string.
  15. * After reading, the rw pointer will be on the flipper_file_delimiter symbol.
  16. * Optimized not to read comments and values into RAM.
  17. * @param file
  18. * @param key
  19. * @return true on success read
  20. */
  21. bool flipper_file_read_valid_key(File* file, string_t key);
  22. /**
  23. * Sets rw pointer to the data after the key
  24. * @param file
  25. * @param key
  26. * @return true if key was found
  27. */
  28. bool flipper_file_seek_to_key(File* file, const char* key);
  29. /**
  30. * Write key and key delimiter
  31. * @param file
  32. * @param key
  33. * @return bool
  34. */
  35. bool flipper_file_write_key(File* file, const char* key);
  36. /**
  37. * Get scratchpad name and path
  38. * @param name
  39. * @return bool
  40. */
  41. bool flipper_file_get_scratchpad_name(const char** name);
  42. #ifdef __cplusplus
  43. }
  44. #endif