KrisLibrary
1.0.0
|
A simple file format that has named items and whitespace-delimited values. More...
#include <SimpleFile.h>
Public Member Functions | |
SimpleFile (const char *fn) | |
SimpleFile (istream &in) | |
bool | Load (const char *fn) |
bool | Load (istream &in) |
bool | Save (const char *fn) |
bool | Save (ostream &out) |
operator bool () const | |
void | AllowItem (const std::string &str, bool caseSensitive=false) |
bool | empty () |
size_t | count (const string &name) |
void | erase (const string &name) |
std::vector< PrimitiveValue > & | operator[] (const string &name) |
std::vector< PrimitiveValue > & | operator[] (const char *name) |
bool | CheckSize (const string &name, int size, const char *errorString=NULL) |
bool | CheckType (const string &name, int type, const char *errorString=NULL) |
std::vector< int > | AsInteger (const string &name) |
std::vector< double > | AsDouble (const string &name) |
std::vector< std::string > | AsString (const string &name) |
Public Attributes | |
bool | loaded |
std::map< std::string, std::vector< PrimitiveValue > > | entries |
std::map< std::string, bool > | validItems |
A simple file format that has named items and whitespace-delimited values.
Files are a list of endline-separated item-values pairs. All values on a line are input into the value. Values beginning with " are read as a string until a closing ". Comments are denoted by # and run until an endline.