#include "fson/String.hh"

Holds the decoded character sequence — escapes resolved, \uXXXX decoded to UTF-8. The writer re-escapes on output.

enum class Form { Quoted, Multiline };

String( std::string = "", Form = Form::Quoted );
std::string const& getValue() const;
void setValue( std::string );
Form getForm() const;
void setForm( Form );

Form::Multiline

Form::Multiline marks a value that was written as a |-block. The writer re-emits it as a block only in the Fson dialect and only when the content ends in \n (every block line adds one); otherwise, and under the Json / Json5 dialects, it is written as an ordinary quoted string.

Presentation — indentation, any author \-continuation — is normalised; the decoded content is preserved exactly.

String s( "Welcome\nto the app\n", String::Form::Multiline );
// Fson dialect writes:
//   key: |Welcome
//        |to the app

Escaping on output

The writer escapes only the mandatory set (", \, control characters — with \b \f \n \r \t shorthands, \u00XX otherwise). All other bytes, including raw UTF-8 and U+2028 / U+2029, pass through unescaped. Strings are always written double-quoted regardless of the source quote. static FsonWriter::encodeString(text) performs this escaping without the surrounding quotes.