|
YATL
|
YATL - Yet Another TOML Library. More...
#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include <stdio.h>Go to the source code of this file.
Data Structures | |
| struct | YATL_Line |
| Opaque line structure. More... | |
| struct | YATL_Cursor |
| Opaque cursor structure. More... | |
| struct | YATL_Span |
| Opaque span structure. More... | |
| struct | YATL_Doc |
| Opaque document structure. More... | |
Macros | |
| #define | YATL_LINE_SIZE 96 |
| Size of opaque YATL_Line_t structure in bytes. | |
| #define | YATL_CURSOR_SIZE 96 |
| Size of opaque YATL_Cursor_t structure in bytes. | |
| #define | YATL_SPAN_SIZE 160 |
| Size of opaque YATL_Span_t structure in bytes. | |
| #define | YATL_DOC_SIZE 64 |
| Size of opaque YATL_Doc_t structure in bytes. | |
| #define | YATL_ENABLE_LOGGING |
| Enable YATL logging. | |
| #define | LOG_LEVEL YATL_LOG_DEBUG |
| #define | YATL_LOG(level, fmt, ...) |
| Log a message with level, file, line, and function context. | |
Typedefs | |
| typedef struct YATL_Line | YATL_Line_t |
| Opaque line structure. | |
| typedef struct YATL_Cursor | YATL_Cursor_t |
| Opaque cursor structure. | |
| typedef struct YATL_Span | YATL_Span_t |
| Opaque span structure. | |
| typedef struct YATL_Doc | YATL_Doc_t |
| Opaque document structure. | |
Enumerations | |
| enum | YATL_log_level_t { YATL_LOG_DEBUG , YATL_LOG_INFO , YATL_LOG_WARN , YATL_LOG_ERROR } |
| Log levels for YATL diagnostic messages. More... | |
| enum | YATL_SpanType_t { YATL_S_NONE , YATL_S_NODE_TABLE , YATL_S_NODE_ARRAY , YATL_S_NODE_ARRAY_TABLE , YATL_S_NODE_INLINE_TABLE , YATL_S_LEAF_KEYVAL , YATL_S_LEAF_COMMENT , YATL_S_SLICE_KEY , YATL_S_SLICE_VALUE } |
| Span type enumeration. More... | |
| enum | YATL_ValueType_t { YATL_TYPE_BAREVALUE , YATL_TYPE_STRING , YATL_TYPE_ARRAY , YATL_TYPE_INLINE_TABLE } |
| Value type enumeration. More... | |
| enum | YATL_Result_t { YATL_DONE = 1 , YATL_OK = 0 , YATL_ERR_IO = -1 , YATL_ERR_SYNTAX = -2 , YATL_ERR_NOT_FOUND = -3 , YATL_ERR_TYPE = -4 , YATL_ERR_BUFFERi = -5 , YATL_ERR_NOMEM = -6 , YATL_ERR_INVALID_ARG } |
| Result/error codes returned by YATL functions. More... | |
Functions | |
| YATL_Cursor_t | YATL_cursor_create (void) |
| Create an initialized cursor. | |
| YATL_Span_t | YATL_span_create (void) |
| Create an initialized span. | |
| YATL_Doc_t | YATL_doc_create (void) |
| Create an initialized document. | |
| YATL_Result_t | YATL_doc_load (YATL_Doc_t *doc, const char *path) |
| Load a TOML document from a file. | |
| YATL_Result_t | YATL_doc_loads (YATL_Doc_t *doc, const char *str, size_t len) |
| Load a TOML document from a string. | |
| YATL_Result_t | YATL_doc_save (YATL_Doc_t *doc, const char *path) |
| Save a document to a file. | |
| void | YATL_doc_free (YATL_Doc_t *doc) |
| Free document resources. | |
| YATL_Result_t | YATL_doc_clear_boneyard (YATL_Doc_t *doc) |
| Clear the document boneyard. | |
| YATL_Result_t | YATL_doc_span (const YATL_Doc_t *doc, YATL_Span_t *out_span) |
| Get a span covering the entire document. | |
| YATL_Result_t | YATL_span_find_next (const YATL_Span_t *in_span, YATL_Cursor_t *cursor, YATL_Span_t *out_span) |
| Find the next span within a boundary span. | |
| YATL_Result_t | YATL_span_find_name (const YATL_Span_t *in_span, const char *name, YATL_Span_t *out_span) |
| Find a table or key-value by name. | |
| YATL_Result_t | YATL_span_find_next_by_name (const YATL_Span_t *in_span, const char *name, const YATL_Cursor_t *in_cursor, YATL_Cursor_t *out_cursor, YATL_Span_t *out_span) |
| Find next table or key-value by name with cursor support. | |
| YATL_Result_t | YATL_span_iter_line (const YATL_Span_t *span, YATL_Cursor_t *cursor, const char **out_text, size_t *out_len) |
| Iterate over line segments within a span. | |
| YATL_Result_t | YATL_cursor_move (YATL_Cursor_t *cursor, long npos) |
| Move a cursor by a character offset. | |
| const char * | YATL_span_type_name (YATL_SpanType_t type) |
| Get the string name of a span type. | |
| YATL_Result_t | YATL_span_keyval_slice (const YATL_Span_t *in_span, YATL_Span_t *key, YATL_Span_t *val) |
| Slice a key-value span into separate key and value spans. | |
| YATL_SpanType_t | YATL_span_type (const YATL_Span_t *span) |
| Get the type of a span. | |
| YATL_Result_t | YATL_span_text (const YATL_Span_t *in_span, const char **out_text, size_t *out_len) |
| Get text content of a single-line span. | |
| YATL_Result_t | YATL_span_get_string (const YATL_Span_t *in_span, const char *key, const char **out_text, size_t *out_len) |
| Convenience function to find a key and get its string value. | |
| YATL_Result_t | YATL_span_ml_set_value (YATL_Span_t *span, const char **lines, const size_t *lengths, size_t line_count) |
| Set the value of a span, supporting multi-line values. | |
| YATL_Result_t | YATL_span_set_value (YATL_Span_t *span, const char *value, size_t length) |
| Set the value of a span with a single-line value.Replaces the value content of a span with new content provided as a single string. The operation is atomic - if parsing fails, the original content is preserved. | |
YATL - Yet Another TOML Library.
A format-preserving TOML parser and writer for C. Provides a DOM-like view for in-line editing with round-trip serialization without loss of formatting.