-
Notifications
You must be signed in to change notification settings - Fork 20
Format of database file (sad::db::Database, supported from 1.3 )
Database file is a simple JSON file, which could contain properties and objects. An objects are stored in tables, just like in ordinary relational database.
You can use such files to store levels and use database properties to store properties of level.
A file must contain an object, which must contain two properties with names "properties" and "tables". A "properties" value must be an object, whose property names define properties of database and value must be an object with properties "type" and "value", which define type and value of property respectively. A valid type values are POD types + "sad::String" type (in complex types, like unsigned long use one space delimiter to define it, like "unsigned long"). A "tables" properties object must be also an object, a properties of which is used as table names.
A table is described as array of objects, which must contain "type", "active", "majorid", "minorid" values and properties, related to their types. If object duplicate majorid in database or minorid in local tables are found, old objects with such values will be removed.
An example of such file could be found in
{
"properties": {
"myprop": { "type": "int", "value" : 0 }
},
"tables": {
"mocks" : [
{
"type" : "Mock3",
"prop": 3,
"prop2": 3,
"name" : "test",
"active": true,
"majorid": 1,
"minorid": 1
},
{
"type" : "Mock3",
"prop": 3,
"prop2": 3,
"name" : "test2",
"active": true,
"majorid": 2,
"minorid": 2
}
]
}
}