JSON Voorhees
Killer JSON for C++
Loading...
Searching...
No Matches
jsonv::ast_node::basic_string_token< TSelf, KIndexToken, KEscaped > Class Template Reference
+ Inheritance diagram for jsonv::ast_node::basic_string_token< TSelf, KIndexToken, KEscaped >:
+ Collaboration diagram for jsonv::ast_node::basic_string_token< TSelf, KIndexToken, KEscaped >:

Public Types

using value_type = std::conditional_t< KEscaped, std::string, string_view >
 The return type of value is based on if the string is canonical or escaped.
 

Public Member Functions

constexpr basic_string_token (const char *token_begin, std::size_t token_size)
 
constexpr bool canonical () const noexcept
 Was the source JSON for this string encoded in the canonical UTF-8 representation? If this is true, there is no need to translate JSON escape sequences to extract a std::string value.
 
constexpr bool escaped () const noexcept
 Did the source JSON for this string contain escape sequences? If this is true, JSON escape sequences must be translated into their canonical UTF-8 representation on extraction.
 
constexpr std::size_t token_size () const
 
value_type value () const
 
- Public Member Functions inherited from jsonv::ast_node::basic_dynamic_size_token< TSelf, KIndexToken >
constexpr basic_dynamic_size_token (const char *token_begin, std::size_t token_size)
 
constexpr std::size_t token_size () const
 
- Public Member Functions inherited from jsonv::ast_node::base< TSelf, KIndexToken >
string_view token_raw () const
 
 operator ast_node () const
 Allow implicit conversion to the more generic ast_node.
 

Additional Inherited Members

- Static Public Member Functions inherited from jsonv::ast_node::base< TSelf, KIndexToken >
static constexpr ast_node_type type ()
 Get the ast_node_type type.
 
- Protected Member Functions inherited from jsonv::ast_node::base< TSelf, KIndexToken >
constexpr base (const char *token_begin)
 

Detailed Description

template<typename TSelf, ast_node_type KIndexToken, bool KEscaped>
class jsonv::ast_node::basic_string_token< TSelf, KIndexToken, KEscaped >

Definition at line 289 of file ast.hpp.

Member Typedef Documentation

◆ value_type

template<typename TSelf , ast_node_type KIndexToken, bool KEscaped>
using jsonv::ast_node::basic_string_token< TSelf, KIndexToken, KEscaped >::value_type = std::conditional_t<KEscaped, std::string, string_view>

The return type of value is based on if the string is canonical or escaped.

Strings in canonical representation can be returned directly from the text through a string_view.

Definition at line 294 of file ast.hpp.

Constructor & Destructor Documentation

◆ basic_string_token()

template<typename TSelf , ast_node_type KIndexToken, bool KEscaped>
constexpr jsonv::ast_node::basic_string_token< TSelf, KIndexToken, KEscaped >::basic_string_token ( const char token_begin,
std::size_t  token_size 
)
inlineexplicitconstexpr

Definition at line 297 of file ast.hpp.

Member Function Documentation

◆ canonical()

template<typename TSelf , ast_node_type KIndexToken, bool KEscaped>
constexpr bool jsonv::ast_node::basic_string_token< TSelf, KIndexToken, KEscaped >::canonical ( ) const
inlineconstexprnoexcept

Was the source JSON for this string encoded in the canonical UTF-8 representation? If this is true, there is no need to translate JSON escape sequences to extract a std::string value.

This is the opposite of escaped.

Definition at line 305 of file ast.hpp.

◆ escaped()

template<typename TSelf , ast_node_type KIndexToken, bool KEscaped>
constexpr bool jsonv::ast_node::basic_string_token< TSelf, KIndexToken, KEscaped >::escaped ( ) const
inlineconstexprnoexcept

Did the source JSON for this string contain escape sequences? If this is true, JSON escape sequences must be translated into their canonical UTF-8 representation on extraction.

This is the opposite of canonical.

Definition at line 312 of file ast.hpp.

◆ token_size()

template<typename TSelf , ast_node_type KIndexToken, bool KEscaped>
constexpr std::size_t jsonv::ast_node::basic_string_token< TSelf, KIndexToken, KEscaped >::token_size ( ) const
inlineconstexpr

Definition at line 317 of file ast.hpp.

◆ value()

template<typename TSelf , ast_node_type KIndexToken, bool KEscaped>
value_type jsonv::ast_node::basic_string_token< TSelf, KIndexToken, KEscaped >::value ( ) const
inline

Definition at line 322 of file ast.hpp.


The documentation for this class was generated from the following file: