1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

- added default values to JsonNode

- small cleanup to heroes.json
This commit is contained in:
Ivan Savenko
2011-08-27 21:17:45 +00:00
parent f3b6ecf9a3
commit 33719696d8
7 changed files with 487 additions and 501 deletions

View File

@@ -60,19 +60,18 @@ public:
//non-const accessors, node will change type on type mismatch
bool & Bool();
int & Int();
float & Float();
std::string & String();
JsonVector & Vector();
JsonMap & Struct();
//const accessors, will cause assertion failure on type mismatch
const bool & Bool() const;
const int & Int() const;
const float & Float() const;
const std::string & String() const;
const JsonVector & Vector() const;
const JsonMap & Struct() const;
//if node is null then default value will be returned instead
const bool & Bool(const bool &value = false) const;
const float & Float(const float &value = 0) const;
const std::string & String(const std::string &value = "") const;
const JsonVector & Vector(const JsonVector &value = JsonVector()) const;
const JsonMap & Struct(const JsonMap &value = JsonMap()) const;
//formatted output of this node in JSON format
void write(std::ostream &out, std::string prefix="") const;