Rosetta  2018.17
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
utility::json Namespace Reference

Functions

void verify_present_exactly_once (nlohmann::json const &json, std::string const &element_name)
 verifies that the element is present exactly once. returns at all if true; throws utility_exist otherwise More...
 
void extract_boolean_from_json (nlohmann::json const &json, std::string const &bool_name, bool &return_bool)
 utility function - verifies that a particular boolean is in the json exactly once More...
 
void extract_number_from_json (nlohmann::json const &json, std::string const &number_name, platform::Real &return_number)
 utility function - verifies that a particular numeric value is in the json exactly once. Note JSON spec does not discriminate float vs int; we use floating point here, and your ints will be ok. More...
 
void extract_nonempty_string_from_json (nlohmann::json const &json, std::string const &string_name, std::string &return_string)
 utility function - verifies that a particular string is in the json exactly once, and is nonempty More...
 
void extract_nonempty_array_from_json (nlohmann::json const &json, std::string const &array_name, nlohmann::json &return_array)
 utility function - verifies that a particular json array is in the json exactly once, and is nonempty More...
 
void extract_nonempty_object_from_json (nlohmann::json const &json, std::string const &object_name, nlohmann::json &return_object)
 utility function - verifies that a particular json object is in the json exactly once, and is nonempty More...
 

Function Documentation

void utility::json::extract_boolean_from_json ( nlohmann::json const &  json,
std::string const &  bool_name,
bool return_bool 
)

utility function - verifies that a particular boolean is in the json exactly once

References utility_exit_with_message, and verify_present_exactly_once().

void utility::json::extract_nonempty_array_from_json ( nlohmann::json const &  json,
std::string const &  array_name,
nlohmann::json &  return_array 
)

utility function - verifies that a particular json array is in the json exactly once, and is nonempty

References utility_exit_with_message, and verify_present_exactly_once().

void utility::json::extract_nonempty_object_from_json ( nlohmann::json const &  json,
std::string const &  object_name,
nlohmann::json &  return_object 
)

utility function - verifies that a particular json object is in the json exactly once, and is nonempty

References utility_exit_with_message, and verify_present_exactly_once().

void utility::json::extract_nonempty_string_from_json ( nlohmann::json const &  json,
std::string const &  string_name,
std::string &  return_string 
)

utility function - verifies that a particular string is in the json exactly once, and is nonempty

References ObjexxFCL::is_string(), utility_exit_with_message, and verify_present_exactly_once().

void utility::json::extract_number_from_json ( nlohmann::json const &  json,
std::string const &  number_name,
platform::Real return_number 
)

utility function - verifies that a particular numeric value is in the json exactly once. Note JSON spec does not discriminate float vs int; we use floating point here, and your ints will be ok.

utility function - verifies that a particular numeric value is in the json exactly once. Note JSON spec does not discriminate float vs int; we use floating point here, and your ints will be ok. You will need to cast it back to core::Size yourself after!

References utility_exit_with_message, and verify_present_exactly_once().

void utility::json::verify_present_exactly_once ( nlohmann::json const &  json,
std::string const &  element_name 
)

verifies that the element is present exactly once. returns at all if true; throws utility_exist otherwise

References utility_exit_with_message.

Referenced by extract_boolean_from_json(), extract_nonempty_array_from_json(), extract_nonempty_object_from_json(), extract_nonempty_string_from_json(), and extract_number_from_json().