Loading...
Searching...
No Matches
flipper_format.h
Go to the documentation of this file.
1
87#pragma once
88#include <stdint.h>
89#include <storage/storage.h>
90
91#ifdef __cplusplus
92extern "C" {
93#endif
94
95typedef struct FlipperFormat FlipperFormat;
96
102
110
118
126bool flipper_format_file_open_existing(FlipperFormat* flipper_format, const char* path);
127
136bool flipper_format_buffered_file_open_existing(FlipperFormat* flipper_format, const char* path);
137
146bool flipper_format_file_open_append(FlipperFormat* flipper_format, const char* path);
147
156bool flipper_format_file_open_always(FlipperFormat* flipper_format, const char* path);
157
167bool flipper_format_buffered_file_open_always(FlipperFormat* flipper_format, const char* path);
168
177bool flipper_format_file_open_new(FlipperFormat* flipper_format, const char* path);
178
186bool flipper_format_file_close(FlipperFormat* flipper_format);
187
196
201void flipper_format_free(FlipperFormat* flipper_format);
202
209void flipper_format_set_strict_mode(FlipperFormat* flipper_format, bool strict_mode);
210
217bool flipper_format_rewind(FlipperFormat* flipper_format);
218
226bool flipper_format_seek_to_end(FlipperFormat* flipper_format);
227
236bool flipper_format_key_exist(FlipperFormat* flipper_format, const char* key);
237
247 FlipperFormat* flipper_format,
248 FuriString* filetype,
249 uint32_t* version);
250
260 FlipperFormat* flipper_format,
261 FuriString* filetype,
262 const uint32_t version);
263
273 FlipperFormat* flipper_format,
274 const char* filetype,
275 const uint32_t version);
276
286 FlipperFormat* flipper_format,
287 const char* key,
288 uint32_t* count);
289
298bool flipper_format_read_string(FlipperFormat* flipper_format, const char* key, FuriString* data);
299
308bool flipper_format_write_string(FlipperFormat* flipper_format, const char* key, FuriString* data);
309
319 FlipperFormat* flipper_format,
320 const char* key,
321 const char* data);
322
333 FlipperFormat* flipper_format,
334 const char* key,
335 uint64_t* data,
336 const uint16_t data_size);
337
348 FlipperFormat* flipper_format,
349 const char* key,
350 const uint64_t* data,
351 const uint16_t data_size);
352
363 FlipperFormat* flipper_format,
364 const char* key,
365 uint32_t* data,
366 const uint16_t data_size);
367
378 FlipperFormat* flipper_format,
379 const char* key,
380 const uint32_t* data,
381 const uint16_t data_size);
382
393 FlipperFormat* flipper_format,
394 const char* key,
395 int32_t* data,
396 const uint16_t data_size);
397
408 FlipperFormat* flipper_format,
409 const char* key,
410 const int32_t* data,
411 const uint16_t data_size);
412
423 FlipperFormat* flipper_format,
424 const char* key,
425 bool* data,
426 const uint16_t data_size);
427
438 FlipperFormat* flipper_format,
439 const char* key,
440 const bool* data,
441 const uint16_t data_size);
442
453 FlipperFormat* flipper_format,
454 const char* key,
455 float* data,
456 const uint16_t data_size);
457
468 FlipperFormat* flipper_format,
469 const char* key,
470 const float* data,
471 const uint16_t data_size);
472
483 FlipperFormat* flipper_format,
484 const char* key,
485 uint8_t* data,
486 const uint16_t data_size);
487
498 FlipperFormat* flipper_format,
499 const char* key,
500 const uint8_t* data,
501 const uint16_t data_size);
502
510bool flipper_format_write_comment(FlipperFormat* flipper_format, FuriString* data);
511
519bool flipper_format_write_comment_cstr(FlipperFormat* flipper_format, const char* data);
520
529bool flipper_format_delete_key(FlipperFormat* flipper_format, const char* key);
530
540bool flipper_format_update_string(FlipperFormat* flipper_format, const char* key, FuriString* data);
541
552 FlipperFormat* flipper_format,
553 const char* key,
554 const char* data);
555
567 FlipperFormat* flipper_format,
568 const char* key,
569 const uint32_t* data,
570 const uint16_t data_size);
571
583 FlipperFormat* flipper_format,
584 const char* key,
585 const int32_t* data,
586 const uint16_t data_size);
587
599 FlipperFormat* flipper_format,
600 const char* key,
601 const bool* data,
602 const uint16_t data_size);
603
615 FlipperFormat* flipper_format,
616 const char* key,
617 const float* data,
618 const uint16_t data_size);
619
631 FlipperFormat* flipper_format,
632 const char* key,
633 const uint8_t* data,
634 const uint16_t data_size);
635
647 FlipperFormat* flipper_format,
648 const char* key,
649 FuriString* data);
650
662 FlipperFormat* flipper_format,
663 const char* key,
664 const char* data);
665
678 FlipperFormat* flipper_format,
679 const char* key,
680 const uint32_t* data,
681 const uint16_t data_size);
682
695 FlipperFormat* flipper_format,
696 const char* key,
697 const int32_t* data,
698 const uint16_t data_size);
699
712 FlipperFormat* flipper_format,
713 const char* key,
714 const bool* data,
715 const uint16_t data_size);
716
729 FlipperFormat* flipper_format,
730 const char* key,
731 const float* data,
732 const uint16_t data_size);
733
746 FlipperFormat* flipper_format,
747 const char* key,
748 const uint8_t* data,
749 const uint16_t data_size);
750
751#ifdef __cplusplus
752}
753#endif
bool flipper_format_get_value_count(FlipperFormat *flipper_format, const char *key, uint32_t *count)
Get the count of values by key.
Definition flipper_format.c:172
bool flipper_format_write_hex(FlipperFormat *flipper_format, const char *key, const uint8_t *data, const uint16_t data_size)
Write key and array of hex-formatted bytes.
Definition flipper_format.c:380
bool flipper_format_read_string(FlipperFormat *flipper_format, const char *key, FuriString *data)
Read a string by key.
Definition flipper_format.c:181
bool flipper_format_read_int32(FlipperFormat *flipper_format, const char *key, int32_t *data, const uint16_t data_size)
Read array of int32 by key.
Definition flipper_format.c:276
bool flipper_format_update_string_cstr(FlipperFormat *flipper_format, const char *key, const char *data)
Updates the value of the first matching key to a string value.
Definition flipper_format.c:432
bool flipper_format_buffered_file_open_always(FlipperFormat *flipper_format, const char *path)
Open file.
Definition flipper_format.c:94
bool flipper_format_rewind(FlipperFormat *flipper_format)
Rewind the RW pointer.
Definition flipper_format.c:125
bool flipper_format_file_close(FlipperFormat *flipper_format)
Closes the file, use only if FlipperFormat allocated as a file.
Definition flipper_format.c:105
FlipperFormat * flipper_format_file_alloc(Storage *storage)
Allocate FlipperFormat as file.
Definition flipper_format.c:33
bool flipper_format_write_string_cstr(FlipperFormat *flipper_format, const char *key, const char *data)
Write key and string.
Definition flipper_format.c:199
bool flipper_format_update_int32(FlipperFormat *flipper_format, const char *key, const int32_t *data, const uint16_t data_size)
Updates the value of the first matching key to a int32 array value.
Definition flipper_format.c:465
bool flipper_format_write_uint32(FlipperFormat *flipper_format, const char *key, const uint32_t *data, const uint16_t data_size)
Write key and array of uint32.
Definition flipper_format.c:260
bool flipper_format_file_open_new(FlipperFormat *flipper_format, const char *path)
Open file.
Definition flipper_format.c:100
bool flipper_format_write_comment(FlipperFormat *flipper_format, FuriString *data)
Write comment.
Definition flipper_format.c:396
bool flipper_format_insert_or_update_uint32(FlipperFormat *flipper_format, const char *key, const uint32_t *data, const uint16_t data_size)
Updates the value of the first matching key to a uint32 array value, or adds the key and value if the...
Definition flipper_format.c:561
void flipper_format_set_strict_mode(FlipperFormat *flipper_format, bool strict_mode)
Set FlipperFormat mode.
Definition flipper_format.c:121
bool flipper_format_update_string(FlipperFormat *flipper_format, const char *key, FuriString *data)
Updates the value of the first matching key to a string value.
Definition flipper_format.c:419
bool flipper_format_write_comment_cstr(FlipperFormat *flipper_format, const char *data)
Write comment.
Definition flipper_format.c:401
bool flipper_format_update_float(FlipperFormat *flipper_format, const char *key, const float *data, const uint16_t data_size)
Updates the value of the first matching key to a float array value.
Definition flipper_format.c:497
bool flipper_format_update_hex(FlipperFormat *flipper_format, const char *key, const uint8_t *data, const uint16_t data_size)
Updates the value of the first matching key to an array of hex-formatted bytes.
Definition flipper_format.c:513
bool flipper_format_buffered_file_open_existing(FlipperFormat *flipper_format, const char *path)
Open existing file, buffered mode.
Definition flipper_format.c:52
bool flipper_format_read_hex(FlipperFormat *flipper_format, const char *key, uint8_t *data, const uint16_t data_size)
Read array of hex-formatted bytes by key.
Definition flipper_format.c:366
void flipper_format_free(FlipperFormat *flipper_format)
Free FlipperFormat.
Definition flipper_format.c:115
bool flipper_format_key_exist(FlipperFormat *flipper_format, const char *key)
Check if the key exists.
Definition flipper_format.c:135
FlipperFormat * flipper_format_buffered_file_alloc(Storage *storage)
Allocate FlipperFormat as file, buffered mode.
Definition flipper_format.c:40
bool flipper_format_insert_or_update_int32(FlipperFormat *flipper_format, const char *key, const int32_t *data, const uint16_t data_size)
Updates the value of the first matching key to a int32 array value, or adds the key and value if the ...
Definition flipper_format.c:578
bool flipper_format_write_string(FlipperFormat *flipper_format, const char *key, FuriString *data)
Write key and string.
Definition flipper_format.c:187
bool flipper_format_insert_or_update_hex(FlipperFormat *flipper_format, const char *key, const uint8_t *data, const uint16_t data_size)
Updates the value of the first matching key to an array of hex-formatted bytes, or adds the key and v...
Definition flipper_format.c:629
bool flipper_format_insert_or_update_bool(FlipperFormat *flipper_format, const char *key, const bool *data, const uint16_t data_size)
Updates the value of the first matching key to a bool array value, or adds the key and value if the k...
Definition flipper_format.c:595
bool flipper_format_insert_or_update_string_cstr(FlipperFormat *flipper_format, const char *key, const char *data)
Updates the value of the first matching key to a string value, or adds the key and value if the key d...
Definition flipper_format.c:545
bool flipper_format_write_float(FlipperFormat *flipper_format, const char *key, const float *data, const uint16_t data_size)
Write key and array of float.
Definition flipper_format.c:350
bool flipper_format_file_open_existing(FlipperFormat *flipper_format, const char *path)
Open existing file.
Definition flipper_format.c:47
FlipperFormat * flipper_format_string_alloc(void)
Allocate FlipperFormat as string.
Definition flipper_format.c:26
bool flipper_format_read_float(FlipperFormat *flipper_format, const char *key, float *data, const uint16_t data_size)
Read array of float by key.
Definition flipper_format.c:336
bool flipper_format_buffered_file_close(FlipperFormat *flipper_format)
Closes the file, use only if FlipperFormat allocated as a buffered file.
Definition flipper_format.c:110
bool flipper_format_seek_to_end(FlipperFormat *flipper_format)
Move the RW pointer at the end.
Definition flipper_format.c:130
bool flipper_format_write_bool(FlipperFormat *flipper_format, const char *key, const bool *data, const uint16_t data_size)
Write key and array of bool.
Definition flipper_format.c:320
bool flipper_format_update_bool(FlipperFormat *flipper_format, const char *key, const bool *data, const uint16_t data_size)
Updates the value of the first matching key to a bool array value.
Definition flipper_format.c:481
bool flipper_format_file_open_always(FlipperFormat *flipper_format, const char *path)
Open file.
Definition flipper_format.c:89
bool flipper_format_write_header(FlipperFormat *flipper_format, FuriString *filetype, const uint32_t version)
Write the header (file type and version).
Definition flipper_format.c:153
bool flipper_format_read_uint32(FlipperFormat *flipper_format, const char *key, uint32_t *data, const uint16_t data_size)
Read array of uint32 by key.
Definition flipper_format.c:245
bool flipper_format_write_header_cstr(FlipperFormat *flipper_format, const char *filetype, const uint32_t version)
Write the header (file type and version).
Definition flipper_format.c:162
bool flipper_format_read_hex_uint64(FlipperFormat *flipper_format, const char *key, uint64_t *data, const uint16_t data_size)
Read array of uint64 in hex format by key.
Definition flipper_format.c:214
bool flipper_format_insert_or_update_string(FlipperFormat *flipper_format, const char *key, FuriString *data)
Updates the value of the first matching key to a string value, or adds the key and value if the key d...
Definition flipper_format.c:529
bool flipper_format_file_open_append(FlipperFormat *flipper_format, const char *path)
Open existing file for writing and add values to the end of file.
Definition flipper_format.c:58
bool flipper_format_write_int32(FlipperFormat *flipper_format, const char *key, const int32_t *data, const uint16_t data_size)
Write key and array of int32.
Definition flipper_format.c:290
bool flipper_format_read_header(FlipperFormat *flipper_format, FuriString *filetype, uint32_t *version)
Read the header (file type and version).
Definition flipper_format.c:144
bool flipper_format_update_uint32(FlipperFormat *flipper_format, const char *key, const uint32_t *data, const uint16_t data_size)
Updates the value of the first matching key to a uint32 array value.
Definition flipper_format.c:448
bool flipper_format_delete_key(FlipperFormat *flipper_format, const char *key)
Removes the first matching key and its value.
Definition flipper_format.c:406
bool flipper_format_insert_or_update_float(FlipperFormat *flipper_format, const char *key, const float *data, const uint16_t data_size)
Updates the value of the first matching key to a float array value, or adds the key and value if the ...
Definition flipper_format.c:612
bool flipper_format_read_bool(FlipperFormat *flipper_format, const char *key, bool *data, const uint16_t data_size)
Read array of bool by key.
Definition flipper_format.c:306
bool flipper_format_write_hex_uint64(FlipperFormat *flipper_format, const char *key, const uint64_t *data, const uint16_t data_size)
Write key and array of uint64 in hex format.
Definition flipper_format.c:229
APIs for working with storages, directories and files.
Definition flipper_format.c:12
Definition string.c:4
Definition storage_i.h:23