Argo  1.0
A C++ library for handling JSON.
Public Types | Public Member Functions | List of all members
argo::token Class Reference

Lexical tokens read from a JSON message. More...

#include <token.hpp>

Public Types

enum  token_type {
  begin_array_e, begin_object_e, end_array_e, end_object_e,
  name_separator_e, value_separator_e, number_int_e, number_double_e,
  string_e, false_e, true_e, null_e
}
 Type of the token. Matches the RFC except that ints and floats are separated out. More...
 

Public Member Functions

 token () noexcept
 Constructor. null token.
 
 token (const token &other)
 Copy constructor. Deep copy.
 
 token (token &&other)
 Move constructor. Shallow copy.
 
 token (token_type t)
 
 token (token_type t, const char *raw_value, size_t len)
 
virtual ~token ()
 
tokenoperator= (const token &other)
 Assignment. Deep copy.
 
tokenoperator= (token &&other)
 Move. Shallow copy.
 
const std::string & get_raw_value () const
 Get the raw untranslated JSON value.
 
token_type get_type () const
 Get the token type.
 

Detailed Description

Lexical tokens read from a JSON message.

A lexical token read from a JSON message. The underlying string and number values are held in non-converted form to allow a caller further up the stack to decide how to interpret them.

Definition at line 41 of file token.hpp.

Member Enumeration Documentation

Type of the token. Matches the RFC except that ints and floats are separated out.

Enumerator
begin_array_e 

[

begin_object_e 

{

end_array_e 

]

end_object_e 

}

name_separator_e 

:

value_separator_e 

,

number_int_e 

whole number

number_double_e 

floating point number

string_e 

sting in JSON format

false_e 

false

true_e 

true

null_e 

null

Definition at line 46 of file token.hpp.

Constructor & Destructor Documentation

token::token ( token_type  t)

Constructor given a type - used for the various structural tokens where the type implies the textual representation.

Definition at line 66 of file token.cpp.

token::token ( token_type  t,
const char *  raw_value,
size_t  len 
)

Constructor given a type and a raw string value. A copy is taken of the string data.

Definition at line 70 of file token.cpp.

token::~token ( )
virtual

Destructor.

Definition at line 74 of file token.cpp.


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