YATL
Loading...
Searching...
No Matches
Span Modification

Functions for modifying span values. More...

Functions

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.

Detailed Description

Functions for modifying span values.

Function Documentation

◆ YATL_span_ml_set_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.

Replaces the value content of a span with new content, which may span multiple lines. The operation is atomic - if parsing fails, the original content is preserved.

Parameters
spanSpan containing the value to replace
linesArray of line content strings
lengthsArray of lengths for each line
line_countNumber of lines in the arrays
Returns
YATL_OK on success
YATL_ERR_SYNTAX if new value would create invalid TOML
YATL_ERR_NOMEM if memory allocation fails
YATL_ERR_INVALID_ARG if any parameter is NULL/uninitialized or line_count is 0
// Single-line example
const char *line = "new_value";
size_t len = strlen(line);
YATL_span_set_value(&span, &line, &len, 1);
// Multi-line example (e.g., for multiline strings)
const char *lines[] = {"first line", "second line", "third line"};
size_t lengths[] = {10, 11, 10};
YATL_span_set_value(&span, lines, lengths, 3);
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 conten...

◆ YATL_span_set_value()

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.

Parameters
spanSpan containing the value to replace
valueNew value string
lengthLength of the new value string in bytes
Returns
YATL_OK on success
YATL_ERR_SYNTAX if new value would create invalid TOML
YATL_ERR_NOMEM if memory allocation fails
YATL_ERR_INVALID_ARG if any parameter is NULL/uninitialized