Orcus
Public Attributes | Static Public Attributes | List of all members
orcus::parse_quoted_string_state Struct Reference

#include <parser_global.hpp>

Public Attributes

const char * str
 
size_t length
 
bool transient
 

Static Public Attributes

static constexpr size_t error_no_closing_quote = 1
 
static constexpr size_t error_illegal_escape_char = 2
 

Detailed Description

Stores state of string parsing. Upon successful parsing the str points to the first character of the string and the length stores the size of the string. When the parsing fails, the str value becomes nullptr and the length stores the error code.

Member Data Documentation

bool orcus::parse_quoted_string_state::transient

When true, the str pointer points to the temporary buffer storage provided by the caller instead of the original character stream. The caller must allocate memory and copy the value to it before the buffer content changes if the parsed string value needs to be stored.

When false, str points to a position in the original stream, and the caller doens't need to allocate memory to store the string value as long as the original character stream is alive.