SuperTuxKart
Public Member Functions | Private Attributes | List of all members
HardwareStats::Json Class Reference

A class to manage json data. More...

#include <hardware_stats.hpp>

Inheritance diagram for HardwareStats::Json:
Inheritance graph
[legend]

Public Member Functions

 Json ()
 Constructor. More...
 
const std::string sanitize (std::string value)
 
template<typename C >
void add (const std::string &key, const C &value)
 Adds a key-value pair to the json string. More...
 
void add (const std::string &key, const std::string &value)
 Specialisation for adding string values. More...
 
void add (const std::string &key, const char *s)
 Specialisation for adding character pointers. More...
 
void finish ()
 
std::string toString ()
 Returns the json data as one string. More...
 

Private Attributes

std::string m_data
 The accumulated json data. More...
 

Detailed Description

A class to manage json data.

Constructor & Destructor Documentation

◆ Json()

HardwareStats::Json::Json ( )
inline

Constructor.

Member Function Documentation

◆ add() [1/3]

template<typename C >
void HardwareStats::Json::add ( const std::string &  key,
const C &  value 
)
inline

Adds a key-value pair to the json string.

◆ add() [2/3]

void HardwareStats::Json::add ( const std::string &  key,
const std::string &  value 
)
inline

Specialisation for adding string values.

String values in are enclosed in "".

◆ add() [3/3]

void HardwareStats::Json::add ( const std::string &  key,
const char *  s 
)
inline

Specialisation for adding character pointers.

String values in are enclosed in "".

◆ toString()

std::string HardwareStats::Json::toString ( )
inline

Returns the json data as one string.

Member Data Documentation

◆ m_data

std::string HardwareStats::Json::m_data
private

The accumulated json data.


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