CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JsonDocument Class Reference

#include <json_document.h>

Inheritance diagram for JsonDocument:
Collaboration diagram for JsonDocument:

Classes

struct  PrintOptions
 

Public Member Functions

 ~JsonDocument ()
 
std::string PrintCanonical ()
 
std::string PrintPretty ()
 
const JSONroot () const
 
bool IsValid () const
 

Static Public Member Functions

static JsonDocumentCreate (const std::string &text)
 
static std::string EscapeString (const std::string &input)
 
static JSONSearchInObject (const JSON *json_object, const std::string &name, const json_type type)
 

Private Member Functions

 JsonDocument ()
 
bool Parse (const std::string &text)
 
std::string PrintValue (JSON *value, PrintOptions print_options)
 
std::string PrintArray (JSON *first_child, PrintOptions print_options)
 
std::string PrintObject (JSON *first_child, PrintOptions print_options)
 
- Private Member Functions inherited from SingleCopy
 SingleCopy ()
 

Private Attributes

block_allocator allocator_
 
JSONroot_
 
char * raw_text_
 

Static Private Attributes

static const unsigned kDefaultBlockSize = 2048
 

Detailed Description

Definition at line 17 of file json_document.h.

Constructor & Destructor Documentation

JsonDocument::~JsonDocument ( )

Definition at line 46 of file json_document.cc.

JsonDocument::JsonDocument ( )
private

Definition at line 43 of file json_document.cc.

Member Function Documentation

string JsonDocument::EscapeString ( const std::string &  input)
static

Definition at line 25 of file json_document.cc.

Referenced by PrintValue().

Here is the caller graph for this function:

bool JsonDocument::IsValid ( ) const
inline
bool JsonDocument::Parse ( const std::string &  text)
private

Parses a JSON string in text.

Returns
true if parsing was successful

Definition at line 55 of file json_document.cc.

Referenced by Create().

Here is the call graph for this function:

Here is the caller graph for this function:

string JsonDocument::PrintArray ( JSON first_child,
PrintOptions  print_options 
)
private

Definition at line 81 of file json_document.cc.

Referenced by PrintValue().

Here is the call graph for this function:

Here is the caller graph for this function:

string JsonDocument::PrintCanonical ( )

JSON string in a canonical format:

  • No whitespaces
  • Variable names and strings in quotes

Can be used as a canonical representation to sign or encrypt a JSON text.

Definition at line 112 of file json_document.cc.

Here is the call graph for this function:

string JsonDocument::PrintObject ( JSON first_child,
PrintOptions  print_options 
)
private

Definition at line 118 of file json_document.cc.

Referenced by PrintCanonical(), PrintPretty(), and PrintValue().

Here is the call graph for this function:

Here is the caller graph for this function:

string JsonDocument::PrintPretty ( )

JSON string for humans.

Definition at line 146 of file json_document.cc.

Here is the call graph for this function:

std::string JsonDocument::PrintValue ( JSON value,
PrintOptions  print_options 
)
private

Definition at line 153 of file json_document.cc.

Referenced by PrintArray(), and PrintObject().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

block_allocator JsonDocument::allocator_
private

Definition at line 47 of file json_document.h.

Referenced by Parse().

const unsigned JsonDocument::kDefaultBlockSize = 2048
staticprivate

Definition at line 33 of file json_document.h.

char* JsonDocument::raw_text_
private

Definition at line 49 of file json_document.h.

Referenced by Parse(), and ~JsonDocument().

JSON* JsonDocument::root_
private

Definition at line 48 of file json_document.h.

Referenced by IsValid(), Parse(), PrintCanonical(), PrintPretty(), and root().


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