CoolProp  6.6.0
An open-source fluid property and humid air property database
Classes | Enumerations | Functions
cpjson Namespace Reference

Classes

struct  value_information
 

Enumerations

enum  schema_validation_code { SCHEMA_VALIDATION_OK = 0 , SCHEMA_INVALID_JSON , INPUT_INVALID_JSON , SCHEMA_NOT_VALIDATED }
 

Functions

void JSON_string_to_rapidjson (const std::string &JSON_string, rapidjson::Document &doc)
 Convert a JSON-formatted string to a rapidjson::Document object. More...
 
value_information get_information (rapidjson::Value &v)
 
std::string json2string (const rapidjson::Value &v)
 
int get_integer (const rapidjson::Value &v, std::string m)
 A convenience function to get a double from a JSON value, including error checking. More...
 
double get_double (const rapidjson::Value &v, std::string m)
 A convenience function to get a double from a JSON value, including error checking. More...
 
bool get_bool (const rapidjson::Value &v, std::string m)
 A convenience function to get a bool from a JSON value, including error checking. More...
 
std::string get_string (const rapidjson::Value &v, std::string m)
 A convenience function to get a string from a JSON value, including error checking. More...
 
std::vector< double > get_double_array (const rapidjson::Value &v)
 A convenience function to get a double array compactly. More...
 
std::vector< double > get_double_array (const rapidjson::Value &v, std::string m)
 A convenience function to get a double array compactly. More...
 
std::vector< CoolPropDblget_long_double_array (const rapidjson::Value &v)
 A convenience function to get a long double array compactly. More...
 
std::vector< std::vector< double > > get_double_array2D (const rapidjson::Value &v)
 A convenience function to get a 2D double array compactly. More...
 
std::vector< std::vector< CoolPropDbl > > get_long_double_array2D (const rapidjson::Value &v)
 A convenience function to get a 2D long double array compactly. More...
 
std::vector< CoolPropDblget_long_double_array (const rapidjson::Value &v, std::string name)
 A convenience function to get a long double array compactly. More...
 
std::vector< std::string > get_string_array (const rapidjson::Value &v)
 A convenience function to get a string array compactly. More...
 
std::vector< std::string > get_string_array (const rapidjson::Value &v, std::string m)
 A convenience function to get a string array compactly. More...
 
template<typename T >
std::string to_string (const T &v)
 A convenience function to get a std::string from a JSON value. More...
 
void set_double_array2D (const char *key, const std::vector< std::vector< double >> &vec, rapidjson::Value &value, rapidjson::Document &doc)
 A convenience function to set a 2D array of double compactly. More...
 
void set_string (const std::string &key, const std::string &s, rapidjson::Value &value, rapidjson::Document &doc)
 A convenience function to set a string compactly. More...
 
void set_string_array (const char *key, const std::vector< std::string > &vec, rapidjson::Value &value, rapidjson::Document &doc)
 A convenience function to set a string array compactly. More...
 
void set_int_array (const char *key, const std::vector< int > &vec, rapidjson::Value &value, rapidjson::Document &doc)
 A convenience function to set an integer array compactly. More...
 
void set_double_array (const char *key, const std::vector< double > &vec, rapidjson::Value &value, rapidjson::Document &doc)
 A convenience function to set a double array compactly. More...
 
void set_long_double_array (const char *const key, const std::vector< CoolPropDbl > &vec, rapidjson::Value &value, rapidjson::Document &doc)
 A convenience function to set a double array compactly. More...
 
schema_validation_code validate_schema (const std::string &schemaJson, const std::string &inputJson, std::string &errstr)
 

Enumeration Type Documentation

◆ schema_validation_code

Enumerator
SCHEMA_VALIDATION_OK 
SCHEMA_INVALID_JSON 
INPUT_INVALID_JSON 
SCHEMA_NOT_VALIDATED 

Definition at line 303 of file rapidjson_include.h.

Function Documentation

◆ get_bool()

bool cpjson::get_bool ( const rapidjson::Value &  v,
std::string  m 
)
inline

A convenience function to get a bool from a JSON value, including error checking.

Definition at line 87 of file rapidjson_include.h.

◆ get_double()

double cpjson::get_double ( const rapidjson::Value &  v,
std::string  m 
)
inline

A convenience function to get a double from a JSON value, including error checking.

Definition at line 75 of file rapidjson_include.h.

◆ get_double_array() [1/2]

std::vector<double> cpjson::get_double_array ( const rapidjson::Value &  v)
inline

A convenience function to get a double array compactly.

Definition at line 112 of file rapidjson_include.h.

◆ get_double_array() [2/2]

std::vector<double> cpjson::get_double_array ( const rapidjson::Value &  v,
std::string  m 
)
inline

A convenience function to get a double array compactly.

Definition at line 127 of file rapidjson_include.h.

◆ get_double_array2D()

std::vector<std::vector<double> > cpjson::get_double_array2D ( const rapidjson::Value &  v)
inline

A convenience function to get a 2D double array compactly.

Definition at line 151 of file rapidjson_include.h.

◆ get_information()

value_information cpjson::get_information ( rapidjson::Value &  v)
inline

Definition at line 37 of file rapidjson_include.h.

◆ get_integer()

int cpjson::get_integer ( const rapidjson::Value &  v,
std::string  m 
)
inline

A convenience function to get a double from a JSON value, including error checking.

Definition at line 63 of file rapidjson_include.h.

◆ get_long_double_array() [1/2]

std::vector<CoolPropDbl> cpjson::get_long_double_array ( const rapidjson::Value &  v)
inline

A convenience function to get a long double array compactly.

Definition at line 136 of file rapidjson_include.h.

◆ get_long_double_array() [2/2]

std::vector<CoolPropDbl> cpjson::get_long_double_array ( const rapidjson::Value &  v,
std::string  name 
)
inline

A convenience function to get a long double array compactly.

Definition at line 199 of file rapidjson_include.h.

◆ get_long_double_array2D()

std::vector<std::vector<CoolPropDbl> > cpjson::get_long_double_array2D ( const rapidjson::Value &  v)
inline

A convenience function to get a 2D long double array compactly.

Definition at line 176 of file rapidjson_include.h.

◆ get_string()

std::string cpjson::get_string ( const rapidjson::Value &  v,
std::string  m 
)
inline

A convenience function to get a string from a JSON value, including error checking.

Definition at line 99 of file rapidjson_include.h.

◆ get_string_array() [1/2]

std::vector<std::string> cpjson::get_string_array ( const rapidjson::Value &  v)
inline

A convenience function to get a string array compactly.

Definition at line 217 of file rapidjson_include.h.

◆ get_string_array() [2/2]

std::vector<std::string> cpjson::get_string_array ( const rapidjson::Value &  v,
std::string  m 
)
inline

A convenience function to get a string array compactly.

Definition at line 229 of file rapidjson_include.h.

◆ json2string()

std::string cpjson::json2string ( const rapidjson::Value &  v)
inline

Definition at line 55 of file rapidjson_include.h.

◆ JSON_string_to_rapidjson()

void cpjson::JSON_string_to_rapidjson ( const std::string &  JSON_string,
rapidjson::Document &  doc 
)
inline

Convert a JSON-formatted string to a rapidjson::Document object.

Definition at line 26 of file rapidjson_include.h.

◆ set_double_array()

void cpjson::set_double_array ( const char *  key,
const std::vector< double > &  vec,
rapidjson::Value &  value,
rapidjson::Document &  doc 
)
inline

A convenience function to set a double array compactly.

Definition at line 286 of file rapidjson_include.h.

◆ set_double_array2D()

void cpjson::set_double_array2D ( const char *  key,
const std::vector< std::vector< double >> &  vec,
rapidjson::Value &  value,
rapidjson::Document &  doc 
)
inline

A convenience function to set a 2D array of double compactly.

Definition at line 247 of file rapidjson_include.h.

◆ set_int_array()

void cpjson::set_int_array ( const char *  key,
const std::vector< int > &  vec,
rapidjson::Value &  value,
rapidjson::Document &  doc 
)
inline

A convenience function to set an integer array compactly.

Definition at line 277 of file rapidjson_include.h.

◆ set_long_double_array()

void cpjson::set_long_double_array ( const char *const  key,
const std::vector< CoolPropDbl > &  vec,
rapidjson::Value &  value,
rapidjson::Document &  doc 
)
inline

A convenience function to set a double array compactly.

Definition at line 295 of file rapidjson_include.h.

◆ set_string()

void cpjson::set_string ( const std::string &  key,
const std::string &  s,
rapidjson::Value &  value,
rapidjson::Document &  doc 
)
inline

A convenience function to set a string compactly.

Definition at line 262 of file rapidjson_include.h.

◆ set_string_array()

void cpjson::set_string_array ( const char *  key,
const std::vector< std::string > &  vec,
rapidjson::Value &  value,
rapidjson::Document &  doc 
)
inline

A convenience function to set a string array compactly.

Definition at line 268 of file rapidjson_include.h.

◆ to_string()

template<typename T >
std::string cpjson::to_string ( const T &  v)
inline

A convenience function to get a std::string from a JSON value.

Definition at line 239 of file rapidjson_include.h.

◆ validate_schema()

schema_validation_code cpjson::validate_schema ( const std::string &  schemaJson,
const std::string &  inputJson,
std::string &  errstr 
)
inline

Validate a JSON-formatted string against a JSON-formatted schema string

Definition at line 313 of file rapidjson_include.h.