Extension: Json and NetCDF utilities
#include "dg/file/file.h"
|
Functions | |
JsonType | dg::file::file2Json (std::string filename, enum comments comm=file::comments::are_discarded, enum error err=file::error::is_throw) |
Convenience wrapper to open a file and parse it into a JsonType. | |
void | dg::file::file2Json (std::string filename, JsonType &js, enum comments comm=file::comments::are_discarded, enum error err=file::error::is_throw) |
Same as js = dg::file::file2Json( filename, comm, err) | |
JsonType | dg::file::string2Json (std::string input, enum comments comm=file::comments::are_discarded, enum error err=file::error::is_throw) |
Convenience wrapper to parse a string into a JsonType. | |
void | dg::file::string2Json (std::string input, JsonType &js, enum comments comm=file::comments::are_discarded, enum error err=file::error::is_throw) |
Same as js = string2Json( input, comm, err) | |
template<class ContainerType > | |
dg::file::JsonType | dg::file::vec2json (const ContainerType &shared) |
convert a vector to a json arrray | |
template<class T > | |
dg::file::JsonType | dg::file::vec2json (std::initializer_list< T > shared) |
Specialization for intitializer list. | |
|
inline |
Convenience wrapper to open a file and parse it into a JsonType.
json_utilities.h
filename | Name of the JSON file to parse (the file path is relative to where the calling program is executed) |
comm | determines the handling of comments in the Json file |
err | determines how parser errors are handled by the function error::is_throw: throw a std::runtime_error containing an error message on any error that occurs on parsing; error::is_warning: write the error message to std::cerr and return; error::is_silent: silently return |
filename
|
inline |
Same as js = dg::file::file2Json( filename, comm, err)
|
inline |
Convenience wrapper to parse a string into a JsonType.
Parse a string into a Json Value
std::runtime_error
with the Json error string on any error that occurs on parsing. json_utilities.h
input | The string to interpret as a Json string |
comm | determines the handling of comments in the Json string |
err | determines how parser errors are handled by the function error::is_throw: throw a std::runtime_error containing an error message on any error that occurs on parsing; error::is_warning: write the error message to std::cerr and return; error::is_silent: silently return |
input
|
inline |
Same as js = string2Json( input, comm, err)
dg::file::JsonType dg::file::vec2json | ( | const ContainerType & | shared | ) |
convert a vector to a json arrray
shared | Any shared memory container that allows range based for loops |
dg::file::JsonType dg::file::vec2json | ( | std::initializer_list< T > | shared | ) |
Specialization for intitializer list.