Brunot
Loading...
Searching...
No Matches
sys::Json Class Reference

#include <Json.h>

Public Member Functions

 Json (std::string filePath)
 Constructor that opens and parses a JSON file.
 Json ()=default
 Json (const Json &)=default
 Json (Json &&)=default
 ~Json ()=default
auto data () -> json &
auto jsonDump (int pretty) -> void
template<typename T>
auto read (const std::string &keyPath, T &value) const -> bool
auto clear () -> void
auto save () -> void
auto saveAs (const std::string &newFilePath) -> void
template<typename T>
auto operator[] (T *key)

Static Public Member Functions

static auto test () -> void
static auto savingTest () -> void

Private Member Functions

auto open (std::string filePath) -> bool

Private Attributes

bool isValid {false}
json j
std::string filePath

Constructor & Destructor Documentation

◆ Json() [1/4]

sys::Json::Json ( std::string filePath)

Constructor that opens and parses a JSON file.

Parameters
filePathThe path to the JSON file to be opened and parsed.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Json() [2/4]

sys::Json::Json ( )
default

◆ Json() [3/4]

sys::Json::Json ( const Json & )
default
Here is the call graph for this function:

◆ Json() [4/4]

sys::Json::Json ( Json && )
default
Here is the call graph for this function:

◆ ~Json()

sys::Json::~Json ( )
default

Member Function Documentation

◆ clear()

auto sys::Json::clear ( ) ->void

clears the current JSON data

Here is the call graph for this function:
Here is the caller graph for this function:

◆ data()

auto sys::Json::data ( ) ->json &
Here is the caller graph for this function:

◆ jsonDump()

auto sys::Json::jsonDump ( int pretty) ->void
Here is the call graph for this function:
Here is the caller graph for this function:

◆ open()

auto sys::Json::open ( std::string filePath) ->bool
private

Open a stream for reading made private to prevent the stream from being reused

Parameters
filePathThe path to the JSON file to be opened and parsed.
Returns
true if opened and parsed successfully, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator[]()

template<typename T>
auto sys::Json::operator[] ( T * key)
inline

◆ read()

template<typename T>
auto sys::Json::read ( const std::string & keyPath,
T & value ) const->bool
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ save()

auto sys::Json::save ( ) ->void

saves current JSON data to the original file path call after modifying the JSON data

Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveAs()

auto sys::Json::saveAs ( const std::string & newFilePath) ->void

saves current JSON data to a new file path call after modifying the JSON data

Parameters
newFilePathThe new path to save the JSON file to.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ savingTest()

auto sys::Json::savingTest ( ) ->void
static
Here is the call graph for this function:

◆ test()

auto sys::Json::test ( ) ->void
static
Here is the call graph for this function:

Member Data Documentation

◆ filePath

std::string sys::Json::filePath
private

◆ isValid

bool sys::Json::isValid {false}
private

◆ j

json sys::Json::j
private

The documentation for this class was generated from the following files:
  • /home/egrazil/sites/Brunot/The House/source/System/Json.h
  • /home/egrazil/sites/Brunot/The House/source/System/Json.cpp