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

Enumerations

enum  schema_validation_code { SCHEMA_VALIDATION_OK = 0 , SCHEMA_INVALID_JSON , INPUT_INVALID_JSON , SCHEMA_NOT_VALIDATED }
 Result of validate_schema() below. More...
 

Functions

CoolProp::SurfaceTensionCorrelation make_surface_tension_correlation (const nlohmann::json &j)
 
CoolProp::SaturationAncillaryFunction make_saturation_ancillary (const nlohmann::json &j)
 
CoolProp::PCSAFTFluid make_pcsaft_fluid (const nlohmann::json &fluid)
 
nlohmann::json parse (std::string_view text)
 
nlohmann::json from_cbor (const std::uint8_t *data, std::size_t size)
 
std::string json2string (const nlohmann::json &v)
 Serialize an nlohmann::json value to a pretty-printed string. More...
 
int get_integer (const nlohmann::json &v, const std::string &m)
 
double get_double (const nlohmann::json &v, const std::string &m)
 
bool get_bool (const nlohmann::json &v, const std::string &m)
 
std::string get_string (const nlohmann::json &v, const std::string &m)
 
std::vector< double > get_double_array (const nlohmann::json &v)
 
std::vector< double > get_double_array (const nlohmann::json &v, const std::string &m)
 
std::vector< CoolPropDblget_long_double_array (const nlohmann::json &v)
 
std::vector< CoolPropDblget_long_double_array (const nlohmann::json &v, const std::string &name)
 
std::vector< std::vector< double > > get_double_array2D (const nlohmann::json &v)
 
std::vector< std::vector< CoolPropDbl > > get_long_double_array2D (const nlohmann::json &v)
 
std::vector< std::string > get_string_array (const nlohmann::json &v)
 
std::vector< std::string > get_string_array (const nlohmann::json &v, const std::string &m)
 
schema_validation_code validate_schema (std::string_view schemaJson, std::string_view inputJson, std::string &errstr)
 

Enumeration Type Documentation

◆ schema_validation_code

Result of validate_schema() below.

Enumerator
SCHEMA_VALIDATION_OK 
SCHEMA_INVALID_JSON 
INPUT_INVALID_JSON 
SCHEMA_NOT_VALIDATED 

Definition at line 174 of file json.h.

Function Documentation

◆ from_cbor()

nlohmann::json cpjson::from_cbor ( const std::uint8_t *  data,
std::size_t  size 
)
inline

Decode a CBOR byte buffer into an nlohmann::json document. Throws CoolProp::ValueError (never a raw nlohmann exception) on failure.

Definition at line 49 of file json.h.

◆ get_bool()

bool cpjson::get_bool ( const nlohmann::json &  v,
const std::string &  m 
)
inline

Definition at line 88 of file json.h.

◆ get_double()

double cpjson::get_double ( const nlohmann::json &  v,
const std::string &  m 
)
inline

Definition at line 81 of file json.h.

◆ get_double_array() [1/2]

std::vector< double > cpjson::get_double_array ( const nlohmann::json &  v)
inline

Definition at line 102 of file json.h.

◆ get_double_array() [2/2]

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

Definition at line 113 of file json.h.

◆ get_double_array2D()

std::vector< std::vector< double > > cpjson::get_double_array2D ( const nlohmann::json &  v)
inline

Definition at line 136 of file json.h.

◆ get_integer()

int cpjson::get_integer ( const nlohmann::json &  v,
const std::string &  m 
)
inline

Definition at line 62 of file json.h.

◆ get_long_double_array() [1/2]

std::vector< CoolPropDbl > cpjson::get_long_double_array ( const nlohmann::json &  v)
inline

Definition at line 119 of file json.h.

◆ get_long_double_array() [2/2]

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

Definition at line 130 of file json.h.

◆ get_long_double_array2D()

std::vector< std::vector< CoolPropDbl > > cpjson::get_long_double_array2D ( const nlohmann::json &  v)
inline

Definition at line 146 of file json.h.

◆ get_string()

std::string cpjson::get_string ( const nlohmann::json &  v,
const std::string &  m 
)
inline

Definition at line 95 of file json.h.

◆ get_string_array() [1/2]

std::vector< std::string > cpjson::get_string_array ( const nlohmann::json &  v)
inline

Definition at line 156 of file json.h.

◆ get_string_array() [2/2]

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

Definition at line 167 of file json.h.

◆ json2string()

std::string cpjson::json2string ( const nlohmann::json &  v)
inline

Serialize an nlohmann::json value to a pretty-printed string.

Definition at line 58 of file json.h.

◆ make_pcsaft_fluid()

CoolProp::PCSAFTFluid cpjson::make_pcsaft_fluid ( const nlohmann::json &  fluid)
inline

Definition at line 13 of file PCSAFTFluidFactory.h.

◆ make_saturation_ancillary()

CoolProp::SaturationAncillaryFunction cpjson::make_saturation_ancillary ( const nlohmann::json &  j)
inline

Build a SaturationAncillaryFunction from its JSON description. Parses into a plain-typed SaturationAncillaryFunction::Values bundle and constructs from it, so no nlohmann type crosses the installed-header boundary.

Definition at line 41 of file FluidLibraryFactories.h.

◆ make_surface_tension_correlation()

CoolProp::SurfaceTensionCorrelation cpjson::make_surface_tension_correlation ( const nlohmann::json &  j)
inline

Build a SurfaceTensionCorrelation from its JSON description. Parses into a plain-typed SurfaceTensionCorrelation::Values bundle and constructs from it, so no nlohmann type crosses the installed-header boundary.

Definition at line 26 of file FluidLibraryFactories.h.

◆ parse()

nlohmann::json cpjson::parse ( std::string_view  text)
inline

Parse a JSON-formatted string into an nlohmann::json document. Throws CoolProp::ValueError (never a raw nlohmann exception) on failure.

Definition at line 39 of file json.h.

◆ validate_schema()

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

Validate a JSON-formatted input string against a JSON-formatted draft-07 schema string. On a validation failure, errstr receives a human-comprehensible description. Never propagates a raw nlohmann or Valijson exception to the caller.

Definition at line 186 of file json.h.