80 public:
bool Load(
const std::string& filename );
83 public:
bool Save(
const std::string& filename);
89 public:
const std::string
ReadString(
int entity,
const char* name,
const std::string& value);
92 public:
void WriteString(
int entity,
const char *name,
const std::string& value );
95 public:
int ReadInt(
int entity,
const char *name,
int value);
98 public:
void WriteInt(
int entity,
const char *name,
int value);
101 public:
double ReadFloat(
int entity,
const char *name,
double value);
104 public:
void WriteFloat(
int entity,
const char *name,
double value);
107 public:
double ReadLength(
int entity,
const char *name,
double value)
113 public:
void WriteLength(
int entity,
const char *name,
double value);
116 public:
double ReadAngle(
int entity,
const char *name,
double value)
125 public: uint32_t
ReadColor(
int entity,
const char *name, uint32_t value);
130 public:
const char *
ReadFilename(
int entity,
const char *name,
const char *value);
133 public:
int ReadTuple(
const int entity,
const char* name,
134 const unsigned int first,
const unsigned int num,
const char* format, ... );
137 public:
void WriteTuple(
const int entity,
const char *name,
138 const unsigned int first,
const unsigned int count,
const char* format, ... );
145 private:
bool LoadTokens(FILE *file,
int include);
148 private:
bool LoadTokenComment(FILE *file,
int *line,
int include);
151 private:
bool LoadTokenWord(FILE *file,
int *line,
int include);
154 private:
bool LoadTokenInclude(FILE *file,
int *line,
int include);
157 private:
bool LoadTokenNum(FILE *file,
int *line,
int include);
160 private:
bool LoadTokenString(FILE *file,
int *line,
int include);
163 private:
bool LoadTokenSpace(FILE *file,
int *line,
int include);
166 private:
bool SaveTokens(FILE *file);
169 private:
void ClearTokens();
172 private:
bool AddToken(
int type,
const char *value,
int include);
175 private:
bool SetTokenValue(
int index,
const char *value);
178 private:
const char *GetTokenValue(
int index);
181 private:
void DumpTokens();
184 private:
bool ParseTokens();
187 private:
bool ParseTokenInclude(
int *index,
int *line);
190 private:
bool ParseTokenDefine(
int *index,
int *line);
193 private:
bool ParseTokenWord(
int entity,
int *index,
int *line);
196 private:
bool ParseTokenEntity(
int entity,
int *index,
int *line);
199 private:
bool ParseTokenProperty(
int entity,
int *index,
int *line);
202 private:
bool ParseTokenTuple(
CProperty* property,
int *index,
int *line);
205 private:
void ClearMacros();
208 private:
void AddMacro(
const char *macroname,
const char *entityname,
209 int line,
int starttoken,
int endtoken);
215 private: CMacro* LookupMacro(
const char *macroname);
218 private:
void DumpMacros();
221 private:
void ClearEntities();
224 private:
int AddEntity(
int parent,
const char *type);
241 private:
void DumpEntities();
244 private:
void ClearProperties();
247 private:
CProperty* AddProperty(
int entity,
const char *name,
int line);
249 private:
void AddPropertyValue(
CProperty* property,
int index,
int value_token);
259 private:
void SetPropertyValue(
CProperty* property,
int index,
const char *value);
265 private:
void DumpProperties();
271 TokenWord, TokenNum, TokenString,
272 TokenOpenEntity, TokenCloseEntity,
273 TokenOpenTuple, TokenCloseTuple,
291 CToken(
int include,
int type,
const char* value ) :
292 include(include), type(type), value(value) {}
298 private: std::vector<CToken> tokens;
306 std::string macroname;
309 std::string entityname;
315 int starttoken, endtoken;
317 CMacro(
const char *macroname,
const char *entityname,
318 int line,
int starttoken,
int endtoken) :
319 macroname(macroname),
320 entityname(entityname),
322 starttoken(starttoken),
323 endtoken(endtoken) {}
327 private: std::map<std::string,CMacro> macros;
340 CEntity(
int parent,
const char* type ) : parent(parent), type(type) {}
344 private: std::vector<CEntity> entities;
347 private: std::map<std::string,CProperty*> properties;