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

#include <json_document_write.h>

Classes

struct  JsonEntry
 

Public Member Functions

void Add (const std::string &key, const std::string &val)
 
void Add (const std::string &key, const int val)
 
void Add (const std::string &key, const float val)
 
void Add (const std::string &key, const int64_t val)
 
void AddJsonObject (const std::string &key, const std::string &json)
 
std::string GenerateString () const
 
void Clear ()
 

Private Types

enum  JsonVariant { kString, kInteger, kFloat, kJsonObject }
 

Private Member Functions

const std::string Escape (const std::string &input) const
 

Private Attributes

std::vector< JsonEntryentries
 

Detailed Description

This file is part of the CernVM File System. This class is used for marshalling JSON objects to strings.

When creating simple objects is sufficient to call the Add() methods to add new key - values to the final JSON.

When creating complex objects, (an object that contains another object) is necessary to create first the nested object and then add it to the final object with the AddJsonObject. This will take care of all the escaping.

Definition at line 29 of file json_document_write.h.

Member Enumeration Documentation

Enumerator
kString 
kInteger 
kFloat 
kJsonObject 

Definition at line 30 of file json_document_write.h.

Member Function Documentation

void JsonStringGenerator::Add ( const std::string &  key,
const std::string &  val 
)
inline
void JsonStringGenerator::Add ( const std::string &  key,
const int  val 
)
inline

Definition at line 97 of file json_document_write.h.

void JsonStringGenerator::Add ( const std::string &  key,
const float  val 
)
inline

Definition at line 102 of file json_document_write.h.

void JsonStringGenerator::Add ( const std::string &  key,
const int64_t  val 
)
inline

Definition at line 107 of file json_document_write.h.

void JsonStringGenerator::AddJsonObject ( const std::string &  key,
const std::string &  json 
)
inline

Definition at line 112 of file json_document_write.h.

Referenced by receiver::Reactor::HandleSubmitPayload(), and perf::Statistics::PrintJSON().

Here is the caller graph for this function:

void JsonStringGenerator::Clear ( )
inline

Definition at line 132 of file json_document_write.h.

Referenced by perf::Statistics::PrintJSON().

Here is the caller graph for this function:

const std::string JsonStringGenerator::Escape ( const std::string &  input) const
inlineprivate

Definition at line 141 of file json_document_write.h.

Member Data Documentation

std::vector<JsonEntry> JsonStringGenerator::entries
private

Definition at line 175 of file json_document_write.h.


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