8 #include "PrimitiveValue.h" 24 bool Load(
const char* fn);
25 bool Load(istream& in);
26 bool Save(
const char* fn);
27 bool Save(ostream& out);
28 operator bool ()
const {
return loaded; }
29 void AllowItem(
const std::string& str,
bool caseSensitive=
false);
32 inline bool empty() {
return entries.empty(); }
33 inline size_t count(
const string& name) {
return entries.count(name); }
34 inline void erase(
const string& name) { entries.erase(entries.find(name)); }
35 inline std::vector<PrimitiveValue>& operator [] (
const string& name) {
return entries[name]; }
36 inline std::vector<PrimitiveValue>& operator [] (
const char* name) {
return entries[string(name)]; }
39 bool CheckSize(
const string& name,
int size,
const char* errorString=NULL);
40 bool CheckType(
const string& name,
int type,
const char* errorString=NULL);
41 std::vector<int> AsInteger(
const string& name);
42 std::vector<double> AsDouble(
const string& name);
43 std::vector<std::string> AsString(
const string& name);
46 std::map<std::string,std::vector<PrimitiveValue> > entries;
47 std::map<std::string,bool> validItems;
A simple file format that has named items and whitespace-delimited values.
Definition: SimpleFile.h:18