flipper_file_helper.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. * @param strict
  27. * @return true if key was found
  28. */
  29. bool flipper_file_seek_to_key(File* file, const char* key, bool strict);
  30. /**
  31. * Write key and key delimiter
  32. * @param file
  33. * @param key
  34. * @return bool
  35. */
  36. bool flipper_file_write_key(File* file, const char* key);
  37. /**
  38. * Get scratchpad name and path
  39. * @param name
  40. * @return bool
  41. */
  42. bool flipper_file_get_scratchpad_name(const char** name);
  43. #ifdef __cplusplus
  44. }
  45. #endif