|
TrueReality
v0.1.1912
|
A file. More...
#include <File.h>


Public Member Functions | |
| File () | |
| ctor. More... | |
| File (std::string fileName) | |
| Constructor that takes in the file name. More... | |
| ~File () | |
| dtor. More... | |
| virtual bool | ReadFromFile (std::string fileName) |
| Reads from a file and parses the JSON into a Root node. More... | |
| virtual bool | ReadFromFile () |
| Reads from a file and parses the JSON into a Root Node. More... | |
| virtual bool | WriteToFile (std::string fileName) |
| Writes the internal Root Node to a JSON file. More... | |
| virtual bool | WriteToFile () |
| Writes the Root Node to a JSON file. More... | |
| virtual void | SetFileName (std::string fileName) |
| Sets a new file name. More... | |
| virtual std::string | GetFileName () const |
| Returns the name of the current file. More... | |
| virtual void | SetFilePath (std::string newPath) |
| Sets the path of where the file will be read from or written to. More... | |
| virtual std::string | GetFilePath () const |
| Returns the path of where the file is read or written to. More... | |
| virtual bool | FileExists () |
| Returns true if the file name and path exist on the HD. More... | |
| void | Clear () override |
| Clears the internal JSON Root node. More... | |
| virtual Value & | GetJSONRoot () override |
| Returns a reference to the internal JSON Root node. More... | |
| virtual void | PrintJSONRoot () override |
| Prints out to the screen the whole JSON Root content. More... | |
| virtual bool | KeyPresent (const std::string &key) const override |
| Checks if the JSON Root Node has an entry with a given key present. More... | |
| virtual bool | IsNull (const std::string &key) const override |
| Checks if the value stored at the specific key is a NULL. More... | |
| virtual void | SetNull (const std::string &key) override |
| Sets the value stored at the specific key to NULL. More... | |
| virtual bool | IsBool (const std::string &key) const override |
| Checks if the value stored at the specific key is a Boolean. More... | |
| virtual bool | GetBool (const std::string &key) const override |
| Returns the Boolean value stored at the given key. More... | |
| virtual void | SetBool (const std::string &key, const bool &value) override |
| Sets the Boolean value to be stored at the given key. More... | |
| virtual bool | IsTrue (const std::string &key) const override |
| Checks if the value stored at the specific key is True. More... | |
| virtual bool | IsFalse (const std::string &key) const override |
| Checks if the value stored at the specific key is False. More... | |
| virtual bool | IsNumber (const std::string &key) const override |
| Checks if the value stored at the specific key is a Number. More... | |
| virtual bool | IsInt (const std::string &key) const override |
| Checks if the value stored at the specific key is an Integer. More... | |
| virtual int | GetInt (const std::string &key) const override |
| Returns the Integer value stored at the given key. More... | |
| virtual void | SetInt (const std::string &key, const int &value) override |
| Sets the Integer value to be stored at the given key. More... | |
| virtual bool | IsDouble (const std::string &key) const override |
| Checks if the value stored at the specific key is a Double. More... | |
| virtual double | GetDouble (const std::string &key) const override |
| Returns the Double value stored at the given key. More... | |
| virtual void | SetDouble (const std::string &key, const double &value) override |
| Sets the Double value to be stored at the given key. More... | |
| virtual bool | IsUInt (const std::string &key) const override |
| Checks if the value stored at the specific key is an Unsigned Integer. More... | |
| virtual unsigned int | GetUInt (const std::string &key) const override |
| Returns the Unsigned Integer value stored at the given key. More... | |
| virtual void | SetUInt (const std::string &key, const unsigned int &value) override |
| Sets the Unsigned Integer value to be stored at the given key. More... | |
| virtual bool | IsInt64 (const std::string &key) const override |
| Checks if the value stored at the specific key is a 64bit Integer. More... | |
| virtual Int64 | GetInt64 (const std::string &key) const override |
| Returns the 64bit Integer value stored at the given key. More... | |
| virtual void | SetInt64 (const std::string &key, const Int64 &value) override |
| Sets the 64bit Integer value to be stored at the given key. More... | |
| virtual bool | IsUInt64 (const std::string &key) const override |
| Checks if the value stored at the specific key is a 64bit Integer. More... | |
| virtual UInt64 | GetUInt64 (const std::string &key) const override |
| Returns the 64bit Integer value stored at the given key. More... | |
| virtual void | SetUInt64 (const std::string &key, const UInt64 &value) override |
| Sets the 64bit Integer value to be stored at the given key. More... | |
| virtual bool | IsFloat (const std::string &key) const override |
| Checks if the value stored at the specific key is a float. More... | |
| virtual float | GetFloat (const std::string &key) const override |
| Returns the float value stored at the given key. More... | |
| virtual void | SetFloat (const std::string &key, const float &value) override |
| Sets the float value to be stored at the given key. More... | |
| virtual bool | IsString (const std::string &key) const override |
| Checks if the value stored at the specific key is a String. More... | |
| virtual const std::string | GetString (const std::string &key) const override |
| Returns the String value stored at the given key. More... | |
| virtual void | SetString (const std::string &key, const std::string &value) override |
| Sets the String to be stored at the given key. More... | |
| virtual bool | IsArray (const std::string &key) const override |
| Checks if the value stored at the specific key is an Array. More... | |
| virtual Array | GetArray (const std::string &key) const override |
| Returns the Array value stored at the given key. More... | |
| virtual void | SetArray (const std::string &key, Array &value) override |
| Sets the Array to be stored at the given key. More... | |
| virtual bool | IsObject (const std::string &key) const override |
| Checks if the value stored at the specific key is an Object. More... | |
| virtual Object | GetObject (const std::string &key) const override |
| Returns the Object value stored at the given key. More... | |
| virtual void | SetObject (const std::string &key, Object &value) override |
| Sets the Array to be stored at the given key. More... | |
Static Public Attributes | |
| static const std::string | DEFAULT_JSON_FILE_NAME = std::string("Default.json") |
| The default JSON file name. More... | |
Private Attributes | |
| std::string | mFileName |
| Filename of the file. More... | |
| std::string | mFilePath |
| Full pathname of the file. More... | |
| Value | mRoot |
| The root. More... | |
Additional Inherited Members |
| trUtil::JSON::File::File | ( | std::string | fileName | ) |
Constructor that takes in the file name.
The user still needs to Open the file for reading or writing.
| fileName | Filename of the file. |
Definition at line 51 of file File.cpp.
References trUtil::PathUtils::GetUserConfigPath(), mFileName, and mFilePath.

|
overridevirtual |
Clears the internal JSON Root node.
Implements trUtil::JSON::Base.
Definition at line 184 of file File.cpp.
References trUtil::JSON::Value::Clear(), and mRoot.

|
virtual |
Returns true if the file name and path exist on the HD.
Definition at line 178 of file File.cpp.
References trUtil::FileUtils::FileExists(), trUtil::FileUtils::GetInstance(), mFileName, and mFilePath.
Referenced by trUtil::VersionUtil::VersionUtil().


|
overridevirtual |
Returns the Array value stored at the given key.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 410 of file File.cpp.
References trUtil::JSON::Value::GetArray(), and mRoot.

|
overridevirtual |
Returns the Boolean value stored at the given key.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 226 of file File.cpp.
References trUtil::JSON::Value::GetBool(), and mRoot.
Referenced by IsFalse(), and IsTrue().


|
overridevirtual |
Returns the Double value stored at the given key.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 302 of file File.cpp.
References trUtil::JSON::Value::GetDouble(), and mRoot.

|
virtual |
|
virtual |
Returns the path of where the file is read or written to.
Definition at line 172 of file File.cpp.
References mFilePath.
Referenced by trUtil::VersionUtil::VersionUtil().

|
overridevirtual |
Returns the float value stored at the given key.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 374 of file File.cpp.
References trUtil::JSON::Value::GetFloat(), and mRoot.

|
overridevirtual |
Returns the Integer value stored at the given key.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 284 of file File.cpp.
References trUtil::JSON::Value::GetInt(), and mRoot.
Referenced by trUtil::VersionUtil::GetBuildVersion(), trUtil::VersionUtil::GetMajorVersion(), and trUtil::VersionUtil::GetMinorVersion().


|
overridevirtual |
Returns the 64bit Integer value stored at the given key.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 338 of file File.cpp.
References trUtil::JSON::Value::GetInt64(), and mRoot.

|
overridevirtual |
|
overridevirtual |
Returns the Object value stored at the given key.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 428 of file File.cpp.
References trUtil::JSON::Value::GetObject(), and mRoot.

|
overridevirtual |
Returns the String value stored at the given key.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 392 of file File.cpp.
References trUtil::JSON::Value::GetString(), and mRoot.
Referenced by trUtil::VersionUtil::GetYYMMVersion().


|
overridevirtual |
Returns the Unsigned Integer value stored at the given key.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 320 of file File.cpp.
References trUtil::JSON::Value::GetUInt(), and mRoot.

|
overridevirtual |
Returns the 64bit Integer value stored at the given key.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 356 of file File.cpp.
References trUtil::JSON::Value::GetUInt64(), and mRoot.

|
overridevirtual |
Checks if the value stored at the specific key is an Array.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 404 of file File.cpp.
References trUtil::JSON::Value::IsArray(), and mRoot.

|
overridevirtual |
Checks if the value stored at the specific key is a Boolean.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 220 of file File.cpp.
References trUtil::JSON::Value::IsBool(), and mRoot.

|
overridevirtual |
Checks if the value stored at the specific key is a Double.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 296 of file File.cpp.
References trUtil::JSON::Value::IsDouble(), and mRoot.

|
overridevirtual |
Checks if the value stored at the specific key is False.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 255 of file File.cpp.
References GetBool(), and KeyPresent().

|
overridevirtual |
Checks if the value stored at the specific key is a float.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 368 of file File.cpp.
References trUtil::JSON::Value::IsFloat(), and mRoot.

|
overridevirtual |
Checks if the value stored at the specific key is an Integer.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 278 of file File.cpp.
References trUtil::JSON::Value::IsInt(), and mRoot.

|
overridevirtual |
Checks if the value stored at the specific key is a 64bit Integer.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 332 of file File.cpp.
References trUtil::JSON::Value::IsInt64(), and mRoot.

|
overridevirtual |
Checks if the value stored at the specific key is a NULL.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 208 of file File.cpp.
References trUtil::JSON::Value::IsNull(), and mRoot.

|
overridevirtual |
Checks if the value stored at the specific key is a Number.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 272 of file File.cpp.
References trUtil::JSON::Value::IsNumber(), and mRoot.

|
overridevirtual |
Checks if the value stored at the specific key is an Object.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 422 of file File.cpp.
References trUtil::JSON::Value::IsObject(), and mRoot.

|
overridevirtual |
Checks if the value stored at the specific key is a String.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 386 of file File.cpp.
References trUtil::JSON::Value::IsString(), and mRoot.

|
overridevirtual |
Checks if the value stored at the specific key is True.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 238 of file File.cpp.
References GetBool(), and KeyPresent().

|
overridevirtual |
Checks if the value stored at the specific key is an Unsigned Integer.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 314 of file File.cpp.
References trUtil::JSON::Value::IsUInt(), and mRoot.

|
overridevirtual |
Checks if the value stored at the specific key is a 64bit Integer.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 350 of file File.cpp.
References trUtil::JSON::Value::IsUInt64(), and mRoot.

|
overridevirtual |
Checks if the JSON Root Node has an entry with a given key present.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 202 of file File.cpp.
References trUtil::JSON::Value::HasMember(), and mRoot.
Referenced by IsFalse(), and IsTrue().


|
overridevirtual |
Prints out to the screen the whole JSON Root content.
Implements trUtil::JSON::Base.
Definition at line 196 of file File.cpp.
References mRoot.
|
virtual |
Reads from a file and parses the JSON into a Root node.
| fileName | Filename of the file. |
Definition at line 69 of file File.cpp.
References trUtil::JSON::Value::Clear(), trUtil::JSON::Value::GetJsonValue(), LOG_D, LOG_E, LOG_ERROR, trUtil::Exception::LogException(), mFileName, mFilePath, and mRoot.
Referenced by trUtil::VersionUtil::VersionUtil().


|
virtual |
|
overridevirtual |
Sets the Array to be stored at the given key.
| key | The key. | |
| [in,out] | value | The value. |
Implements trUtil::JSON::Base.
Definition at line 416 of file File.cpp.
References mRoot, and trUtil::JSON::Value::SetArray().

|
overridevirtual |
Sets the Boolean value to be stored at the given key.
| key | The key. |
| value | The value. |
Implements trUtil::JSON::Base.
Definition at line 232 of file File.cpp.
References mRoot, and trUtil::JSON::Value::SetBool().

|
overridevirtual |
Sets the Double value to be stored at the given key.
| key | The key. |
| value | The value. |
Implements trUtil::JSON::Base.
Definition at line 308 of file File.cpp.
References mRoot, and trUtil::JSON::Value::SetDouble().

|
virtual |
Sets a new file name.
If a file has been opened already, this will close it.
| fileName | Filename of the file. |
Definition at line 154 of file File.cpp.
References mFileName.
Referenced by trUtil::VersionUtil::VersionUtil().

|
virtual |
Sets the path of where the file will be read from or written to.
By default the it sill be saved in the PathUtils::GetUserDataPath() + PathUtils::CONFIG_PATH folder.
| newPath | Full pathname of the new file. |
Definition at line 166 of file File.cpp.
References mFilePath.
Referenced by trUtil::VersionUtil::VersionUtil().

|
overridevirtual |
Sets the float value to be stored at the given key.
| key | The key. |
| value | The value. |
Implements trUtil::JSON::Base.
Definition at line 380 of file File.cpp.
References mRoot, and trUtil::JSON::Value::SetFloat().

|
overridevirtual |
Sets the Integer value to be stored at the given key.
| key | The key. |
| value | The value. |
Implements trUtil::JSON::Base.
Definition at line 290 of file File.cpp.
References mRoot, and trUtil::JSON::Value::SetInt().
Referenced by trUtil::VersionUtil::SetBuildVersion(), trUtil::VersionUtil::SetMajorVersion(), trUtil::VersionUtil::SetMinorVersion(), and trUtil::VersionUtil::SetYYMMVersion().


|
overridevirtual |
Sets the 64bit Integer value to be stored at the given key.
| key | The key. |
| value | The value. |
Implements trUtil::JSON::Base.
Definition at line 344 of file File.cpp.
References mRoot, and trUtil::JSON::Value::SetInt64().

|
overridevirtual |
Sets the value stored at the specific key to NULL.
| key | The key. |
Implements trUtil::JSON::Base.
Definition at line 214 of file File.cpp.
References mRoot, and trUtil::JSON::Value::SetNull().

|
overridevirtual |
Sets the Array to be stored at the given key.
| key | The key. | |
| [in,out] | value | The value. |
Implements trUtil::JSON::Base.
Definition at line 434 of file File.cpp.
References mRoot, and trUtil::JSON::Value::SetObject().

|
overridevirtual |
Sets the String to be stored at the given key.
| key | The key. |
| value | The value. |
Implements trUtil::JSON::Base.
Definition at line 398 of file File.cpp.
References mRoot, and trUtil::JSON::Value::SetString().
Referenced by trUtil::VersionUtil::SetYYMMVersion().


|
overridevirtual |
Sets the Unsigned Integer value to be stored at the given key.
| key | The key. |
| value | The value. |
Implements trUtil::JSON::Base.
Definition at line 326 of file File.cpp.
References mRoot, and trUtil::JSON::Value::SetUInt().

|
overridevirtual |
Sets the 64bit Integer value to be stored at the given key.
| key | The key. |
| value | The value. |
Implements trUtil::JSON::Base.
Definition at line 362 of file File.cpp.
References mRoot, and trUtil::JSON::Value::SetUInt64().

|
virtual |
Writes the internal Root Node to a JSON file.
| fileName | Filename of the file. |
Definition at line 123 of file File.cpp.
References LOG_D, LOG_ERROR, trUtil::Exception::LogException(), mFileName, mFilePath, and mRoot.
Referenced by trUtil::VersionUtil::SaveVersionFile().


|
virtual |
|
static |
|
private |
Filename of the file.
Definition at line 573 of file File.h.
Referenced by File(), FileExists(), GetFileName(), ReadFromFile(), SetFileName(), and WriteToFile().
|
private |
Full pathname of the file.
Definition at line 575 of file File.h.
Referenced by File(), FileExists(), GetFilePath(), ReadFromFile(), SetFilePath(), and WriteToFile().
|
private |
The root.
Definition at line 578 of file File.h.
Referenced by Clear(), GetArray(), GetBool(), GetDouble(), GetFloat(), GetInt(), GetInt64(), GetJSONRoot(), GetObject(), GetString(), GetUInt(), GetUInt64(), IsArray(), IsBool(), IsDouble(), IsFloat(), IsInt(), IsInt64(), IsNull(), IsNumber(), IsObject(), IsString(), IsUInt(), IsUInt64(), KeyPresent(), PrintJSONRoot(), ReadFromFile(), SetArray(), SetBool(), SetDouble(), SetFloat(), SetInt(), SetInt64(), SetNull(), SetObject(), SetString(), SetUInt(), SetUInt64(), and WriteToFile().