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
528
537bool flipper_format_delete_key(FlipperFormat* flipper_format, const char* key);
538
548bool flipper_format_update_string(FlipperFormat* flipper_format, const char* key, FuriString* data);
549
560 FlipperFormat* flipper_format,
561 const char* key,
562 const char* data);
563
575 FlipperFormat* flipper_format,
576 const char* key,
577 const uint32_t* data,
578 const uint16_t data_size);
579
591 FlipperFormat* flipper_format,
592 const char* key,
593 const int32_t* data,
594 const uint16_t data_size);
595
607 FlipperFormat* flipper_format,
608 const char* key,
609 const bool* data,
610 const uint16_t data_size);
611
623 FlipperFormat* flipper_format,
624 const char* key,
625 const float* data,
626 const uint16_t data_size);
627
639 FlipperFormat* flipper_format,
640 const char* key,
641 const uint8_t* data,
642 const uint16_t data_size);
643
655 FlipperFormat* flipper_format,
656 const char* key,
657 FuriString* data);
658
670 FlipperFormat* flipper_format,
671 const char* key,
672 const char* data);
673
686 FlipperFormat* flipper_format,
687 const char* key,
688 const uint32_t* data,
689 const uint16_t data_size);
690
703 FlipperFormat* flipper_format,
704 const char* key,
705 const int32_t* data,
706 const uint16_t data_size);
707
720 FlipperFormat* flipper_format,
721 const char* key,
722 const bool* data,
723 const uint16_t data_size);
724
737 FlipperFormat* flipper_format,
738 const char* key,
739 const float* data,
740 const uint16_t data_size);
741
754 FlipperFormat* flipper_format,
755 const char* key,
756 const uint8_t* data,
757 const uint16_t data_size);
758
759#ifdef __cplusplus
760}
761#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:437
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:470
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:566
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:424
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:502
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:518
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:583
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:634
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:600
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:550
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:486
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:534
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_write_empty_line(FlipperFormat *flipper_format)
Write empty line (Improves readability for human based parsing)
Definition flipper_format.c:406
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:453
bool flipper_format_delete_key(FlipperFormat *flipper_format, const char *key)
Removes the first matching key and its value.
Definition flipper_format.c:411
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:617
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