Skip to content

Commit

Permalink
API: Add value flags for controlling scalar output style.
Browse files Browse the repository at this point in the history
These allow plain, single quotes, and double quotes styles.
  • Loading branch information
tlsa committed Oct 20, 2021
1 parent 70f51fd commit d40411c
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions include/cyaml/cyaml.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,63 @@ typedef enum cyaml_flag {
* \ref cyaml_strval strings.
*/
CYAML_FLAG_CASE_INSENSITIVE = (1 << 8),
/**
* When saving, emit scalar value with plain style (no quotes).
*
* \note This is ignored if the value is non-scaler.
*
* \note In cases where conflicting scalar style flags are set, the
* the one with the highest precedence is used. From lowest to
* highest precedence:
* \ref CYAML_FLAG_SCALAR_PLAIN,
* \ref CYAML_FLAG_SCALAR_FOLDED,
* \ref CYAML_FLAG_SCALAR_LITERAL,
* \ref CYAML_FLAG_SCALAR_QUOTE_SINGLE,
* \ref CYAML_FLAG_SCALAR_QUOTE_DOUBLE,
*
* If none of these are set, libyaml's default behaviour is used.
*/
CYAML_FLAG_SCALAR_PLAIN = (1 << 9),
/**
* When saving, emit scalar value with folded style:
*
* ```yaml
* string: >
* This string
* really has no line breaks!
* ```
*
* See the notes for \ref CYAML_FLAG_SCALAR_PLAIN for applicability
* and precedence.
*/
CYAML_FLAG_SCALAR_FOLDED = (1 << 10),
/**
* When saving, emit scalar value with literal style:
*
* ```yaml
* string: |
* This is a
* multi-line string!
* ```
*
* See the notes for \ref CYAML_FLAG_SCALAR_PLAIN for applicability
* and precedence.
*/
CYAML_FLAG_SCALAR_LITERAL = (1 << 11),
/**
* When saving, emit scalar value with single quotes (`'`).
*
* See the notes for \ref CYAML_FLAG_SCALAR_PLAIN for applicability
* and precedence.
*/
CYAML_FLAG_SCALAR_QUOTE_SINGLE = (1 << 12),
/**
* When saving, emit scalar value with double quotes (`"`).
*
* See the notes for \ref CYAML_FLAG_SCALAR_PLAIN for applicability
* and precedence.
*/
CYAML_FLAG_SCALAR_QUOTE_DOUBLE = (1 << 13),
} cyaml_flag_e;

/**
Expand Down

0 comments on commit d40411c

Please sign in to comment.