55 CProperty(
int entity,
const char* name,
int line ) :
77 protected: FILE* FileOpen(
const std::string& filename,
const char* method);
80 public:
bool Load(
const std::string& filename );
83 public:
bool Save(
const std::string& filename);
86 public:
bool WarnUnused();
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)
109 return (ReadFloat( entity, name, value/unit_length ) * unit_length);
113 public:
void WriteLength(
int entity,
const char *name,
double value);
116 public:
double ReadAngle(
int entity,
const char *name,
double value)
118 return (ReadFloat( entity, name, value/unit_angle ) * unit_angle);
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);
227 public:
int GetEntityCount();
230 public:
const char *GetEntityType(
int entity);
234 public:
int LookupEntity(
const char *type);
238 public:
int GetEntityParent(
int entity);
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);
252 public:
CProperty* GetProperty(
int entity,
const char *name);
256 bool PropertyExists(
int section,
const char* token );
259 private:
void SetPropertyValue(
CProperty* property,
int index,
const char *value);
262 public:
const char *GetPropertyValue(
CProperty* property,
int index);
265 private:
void DumpProperties();
291 CToken(
int include,
int type,
const char* value ) :
292 include(include), type(type), value(value) {}
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) {}
std::string name
Name of property.
std::map< std::string, CMacro > macros
bool used
Flag set if property has been used.
The Stage library uses its own namespace.
int line
Line this property came from.
CProperty(int entity, const char *name, int line)
CMacro(const char *macroname, const char *entityname, int line, int starttoken, int endtoken)
int entity
Index of entity this property belongs to.
CToken(int include, int type, const char *value)
double ReadLength(int entity, const char *name, double value)
CEntity(int parent, const char *type)
std::vector< CToken > tokens
std::vector< CEntity > entities
double ReadAngle(int entity, const char *name, double value)
std::vector< int > values
A list of token indexes.
std::map< std::string, CProperty * > properties