Crow  1.0
A C++ microframework for the web
crow::json::rvalue Class Reference

JSON read value. More...

Collaboration diagram for crow::json::rvalue:

Public Member Functions

 rvalue () noexcept
 
 rvalue (type t) noexcept
 
 rvalue (type t, char *s, char *e) noexcept
 
 rvalue (const rvalue &r)
 
 rvalue (rvalue &&r) noexcept
 
rvalueoperator= (const rvalue &r)
 
rvalueoperator= (rvalue &&r) noexcept
 
 operator bool () const noexcept
 
 operator int64_t () const
 
 operator uint64_t () const
 
 operator int () const
 
 operator std::string () const
 Return any json value (not object or list) as a string. More...
 
type t () const
 The type of the JSON value. More...
 
num_type nt () const
 The number type of the JSON value. More...
 
int64_t i () const
 The integer value. More...
 
uint64_t u () const
 The unsigned integer value. More...
 
double d () const
 The double precision floating-point number value. More...
 
bool b () const
 The boolean value. More...
 
detail::r_string s () const
 The string value. More...
 
std::vector< rvaluelo ()
 The list or object value. More...
 
void unescape () const
 Convert escaped string character to their original form ("\\n" -> '
'). More...
 
bool has (const char *str) const
 Check if the json object has the passed string as a key. More...
 
bool has (const std::string &str) const
 
int count (const std::string &str)
 
rvaluebegin () const
 
rvalueend () const
 
const detail::r_stringkey () const
 
size_t size () const
 
const rvalueoperator[] (int index) const
 
const rvalueoperator[] (size_t index) const
 
const rvalueoperator[] (const char *str) const
 
const rvalueoperator[] (const std::string &str) const
 
void set_error ()
 
bool error () const
 
std::vector< std::string > keys ()
 

Private Member Functions

bool is_cached () const
 
void set_cached () const
 
void copy_l (const rvalue &r)
 
void emplace_back (rvalue &&v)
 
void determine_num_type ()
 Determines num_type from the string. More...
 

Private Attributes

char * start_
 
char * end_
 
detail::r_string key_
 
std::unique_ptr< rvalue[]> l_
 
uint32_t lsize_
 
uint16_t lremain_
 
type t_
 
num_type nt_ {num_type::Null}
 
uint8_t option_ {0}
 

Static Private Attributes

static const int cached_bit = 2
 
static const int error_bit = 4
 

Friends

rvalue load_nocopy_internal (char *data, size_t size)
 
rvalue load (const char *data, size_t size)
 
std::ostream & operator<< (std::ostream &os, const rvalue &r)
 

Detailed Description

JSON read value.

Value can mean any json value, including a JSON object. Read means this class is used to primarily read strings into a JSON value.

Constructor & Destructor Documentation

◆ rvalue() [1/5]

crow::json::rvalue::rvalue ( )
inlinenoexcept

◆ rvalue() [2/5]

crow::json::rvalue::rvalue ( type  t)
inlinenoexcept

◆ rvalue() [3/5]

crow::json::rvalue::rvalue ( type  t,
char *  s,
char *  e 
)
inlinenoexcept
Here is the call graph for this function:

◆ rvalue() [4/5]

crow::json::rvalue::rvalue ( const rvalue r)
inline
Here is the call graph for this function:

◆ rvalue() [5/5]

crow::json::rvalue::rvalue ( rvalue &&  r)
inlinenoexcept

Member Function Documentation

◆ operator=() [1/2]

rvalue& crow::json::rvalue::operator= ( const rvalue r)
inline
Here is the call graph for this function:

◆ operator=() [2/2]

rvalue& crow::json::rvalue::operator= ( rvalue &&  r)
inlinenoexcept

◆ operator bool()

crow::json::rvalue::operator bool ( ) const
inlineexplicitnoexcept

◆ operator int64_t()

crow::json::rvalue::operator int64_t ( ) const
inlineexplicit
Here is the call graph for this function:

◆ operator uint64_t()

crow::json::rvalue::operator uint64_t ( ) const
inlineexplicit
Here is the call graph for this function:

◆ operator int()

crow::json::rvalue::operator int ( ) const
inlineexplicit
Here is the call graph for this function:

◆ operator std::string()

crow::json::rvalue::operator std::string ( ) const
inlineexplicit

Return any json value (not object or list) as a string.

Here is the call graph for this function:

◆ t()

type crow::json::rvalue::t ( ) const
inline

The type of the JSON value.

Here is the caller graph for this function:

◆ nt()

num_type crow::json::rvalue::nt ( ) const
inline

The number type of the JSON value.

Here is the caller graph for this function:

◆ i()

int64_t crow::json::rvalue::i ( ) const
inline

The integer value.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ u()

uint64_t crow::json::rvalue::u ( ) const
inline

The unsigned integer value.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ d()

double crow::json::rvalue::d ( ) const
inline

The double precision floating-point number value.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ b()

bool crow::json::rvalue::b ( ) const
inline

The boolean value.

Here is the call graph for this function:

◆ s()

detail::r_string crow::json::rvalue::s ( ) const
inline

The string value.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lo()

std::vector<rvalue> crow::json::rvalue::lo ( )
inline

The list or object value.

Here is the call graph for this function:

◆ unescape()

void crow::json::rvalue::unescape ( ) const
inline

Convert escaped string character to their original form ("\\n" -> '
').

Here is the caller graph for this function:

◆ has() [1/2]

bool crow::json::rvalue::has ( const char *  str) const
inline

Check if the json object has the passed string as a key.

Here is the caller graph for this function:

◆ has() [2/2]

bool crow::json::rvalue::has ( const std::string &  str) const
inline
Here is the call graph for this function:

◆ count()

int crow::json::rvalue::count ( const std::string &  str)
inline
Here is the call graph for this function:

◆ begin()

rvalue* crow::json::rvalue::begin ( ) const
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ end()

rvalue* crow::json::rvalue::end ( ) const
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ key()

const detail::r_string& crow::json::rvalue::key ( ) const
inline
Here is the caller graph for this function:

◆ size()

size_t crow::json::rvalue::size ( ) const
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator[]() [1/4]

const rvalue& crow::json::rvalue::operator[] ( int  index) const
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator[]() [2/4]

const rvalue& crow::json::rvalue::operator[] ( size_t  index) const
inline
Here is the call graph for this function:

◆ operator[]() [3/4]

const rvalue& crow::json::rvalue::operator[] ( const char *  str) const
inline
Here is the call graph for this function:

◆ operator[]() [4/4]

const rvalue& crow::json::rvalue::operator[] ( const std::string &  str) const
inline
Here is the call graph for this function:

◆ set_error()

void crow::json::rvalue::set_error ( )
inline
Here is the caller graph for this function:

◆ error()

bool crow::json::rvalue::error ( ) const
inline

◆ keys()

std::vector<std::string> crow::json::rvalue::keys ( )
inline
Here is the call graph for this function:

◆ is_cached()

bool crow::json::rvalue::is_cached ( ) const
inlineprivate
Here is the caller graph for this function:

◆ set_cached()

void crow::json::rvalue::set_cached ( ) const
inlineprivate
Here is the caller graph for this function:

◆ copy_l()

void crow::json::rvalue::copy_l ( const rvalue r)
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ emplace_back()

void crow::json::rvalue::emplace_back ( rvalue &&  v)
inlineprivate
Here is the caller graph for this function:

◆ determine_num_type()

void crow::json::rvalue::determine_num_type ( )
inlineprivate

Determines num_type from the string.

Friends And Related Function Documentation

◆ load_nocopy_internal

rvalue load_nocopy_internal ( char *  data,
size_t  size 
)
friend

◆ load

rvalue load ( const char *  data,
size_t  size 
)
friend

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const rvalue r 
)
friend

Member Data Documentation

◆ cached_bit

const int crow::json::rvalue::cached_bit = 2
staticprivate

◆ error_bit

const int crow::json::rvalue::error_bit = 4
staticprivate

◆ start_

char* crow::json::rvalue::start_
mutableprivate

◆ end_

char* crow::json::rvalue::end_
mutableprivate

◆ key_

detail::r_string crow::json::rvalue::key_
private

◆ l_

std::unique_ptr<rvalue[]> crow::json::rvalue::l_
private

◆ lsize_

uint32_t crow::json::rvalue::lsize_
private

◆ lremain_

uint16_t crow::json::rvalue::lremain_
private

◆ t_

type crow::json::rvalue::t_
private

◆ nt_

num_type crow::json::rvalue::nt_ {num_type::Null}
private

◆ option_

uint8_t crow::json::rvalue::option_ {0}
mutableprivate

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