OPAL
Classes | Typedefs | Functions
json.h File Reference

Header file declaring interface for various operations with JSON. More...

#include "json11/json11.hpp"
#include <string>
#include <stdexcept>
#include <fstream>

Go to the source code of this file.

Classes

class  util::JsonParseException
 Simple exception class representing a failure occurred during parsing a JSON file (runtime error). More...
 

Typedefs

using util::Json = json11::Json
 Type of JSON object.
 

Functions

Json util::JsonFromFile (const std::string &fileName)
 Read JSON from file, specified by name. More...
 
Json util::JsonFromFile (const char *fileName)
 Read JSON from file, specified by name. More...
 
Json util::JsonFromFile (std::ifstream &inputStream)
 Read JSON from file stream. More...
 
Json util::JsonFromString (const std::string &inputStr)
 Read JSON from string (for ex. More...
 

Detailed Description

Header file declaring interface for various operations with JSON.

Author
Denis Zobnin

Function Documentation

§ JsonFromFile() [1/3]

Json util::JsonFromFile ( const std::string &  fileName)

Read JSON from file, specified by name.

Parameters
[in]fileNameName of file to read.
Returns
Parsed Json object.
Exceptions
JsonParseException.

§ JsonFromFile() [2/3]

Json util::JsonFromFile ( const char *  fileName)

Read JSON from file, specified by name.

See JsonFromFile(std::string).

§ JsonFromFile() [3/3]

Json util::JsonFromFile ( std::ifstream &  inputStream)

Read JSON from file stream.

See JsonFromFile(std::string).

§ JsonFromString()

Json util::JsonFromString ( const std::string &  inputStr)

Read JSON from string (for ex.

file contents).

Parameters
[in]inputStrString from which data is read.
Returns
Parsed Json object.
Exceptions
JsonParseException.