88 bool Load(std::istream &world_content,
const std::string &
filename = std::string());
100 const std::string
ReadString(
int entity,
const char *name,
const std::string &value);
104 void WriteString(
int entity,
const char *name,
const std::string &value);
108 int ReadInt(
int entity,
const char *name,
int value);
112 void WriteInt(
int entity,
const char *name,
int value);
116 double ReadFloat(
int entity,
const char *name,
double value);
120 void WriteFloat(
int entity,
const char *name,
double value);
124 double ReadLength(
int entity,
const char *name,
double value)
135 double ReadAngle(
int entity,
const char *name,
double value)
145 uint32_t
ReadColor(
int entity,
const char *name, uint32_t value);
151 const char *
ReadFilename(
int entity,
const char *name,
const char *value);
155 int ReadTuple(
const int entity,
const char *name,
const unsigned int first,
156 const unsigned int num,
const char *format, ...);
160 void WriteTuple(
const int entity,
const char *name,
const unsigned int first,
161 const unsigned int count,
const char *format, ...);
168 bool LoadTokens(FILE *file,
int include);
171 bool LoadTokens(std::istream &content,
int include);
175 bool LoadTokenComment(FILE *file,
int *line,
int include);
178 bool LoadTokenComment(std::istream &content,
int *line,
int include);
182 bool LoadTokenWord(FILE *file,
int *line,
int include);
185 bool LoadTokenWord(std::istream &content,
int *line,
int include);
189 bool LoadTokenInclude(FILE *file,
int *line,
int include);
192 bool LoadTokenInclude(std::istream &content,
int *line,
int include);
196 bool LoadTokenNum(FILE *file,
int *line,
int include);
199 bool LoadTokenNum(std::istream &content,
int *line,
int include);
203 bool LoadTokenString(FILE *file,
int *line,
int include);
206 bool LoadTokenString(std::istream &content,
int *line,
int include);
210 bool LoadTokenSpace(FILE *file,
int *line,
int include);
213 bool LoadTokenSpace(std::istream &content,
int *line,
int include);
217 bool SaveTokens(FILE *file);
225 bool AddToken(
int type,
const char *value,
int include);
229 bool SetTokenValue(
int index,
const char *value);
233 const char *GetTokenValue(
int index);
245 bool ParseTokenInclude(
int *index,
int *line);
249 bool ParseTokenDefine(
int *index,
int *line);
253 bool ParseTokenWord(
int entity,
int *index,
int *line);
257 bool ParseTokenEntity(
int entity,
int *index,
int *line);
261 bool ParseTokenProperty(
int entity,
int *index,
int *line);
265 bool ParseTokenTuple(
CProperty *property,
int *index,
int *line);
273 void AddMacro(
const char *macroname,
const char *entityname,
int line,
int starttoken,
282 CMacro *LookupMacro(
const char *macroname);
290 void ClearEntities();
294 int AddEntity(
int parent,
const char *type);
320 void ClearProperties();
324 CProperty *AddProperty(
int entity,
const char *name,
int line);
327 void AddPropertyValue(
CProperty *property,
int index,
int value_token);
339 void SetPropertyValue(
CProperty *property,
int index,
const char *value);
347 void DumpProperties();
377 CToken(
int include,
int type,
const char *value) : include(include), type(type), value(value) {}
384 std::vector<CToken> tokens;
391 std::string macroname;
394 std::string entityname;
400 int starttoken, endtoken;
402 CMacro(
const char *macroname,
const char *entityname,
int line,
int starttoken,
int endtoken)
403 : macroname(macroname), entityname(entityname), line(line), starttoken(starttoken),
411 std::map<std::string, CMacro> macros;
423 CEntity(
int parent,
const char *type) : parent(parent), type(type) {}
428 std::vector<CEntity> entities;
432 std::map<std::string, CProperty *> properties;
Property class.
Definition worldfile.hh:39
std::string name
Name of property.
Definition worldfile.hh:45
int entity
Index of entity this property belongs to.
Definition worldfile.hh:42
bool used
Flag set if property has been used.
Definition worldfile.hh:54
std::vector< int > values
A list of token indexes.
Definition worldfile.hh:48
int line
Line this property came from.
Definition worldfile.hh:51
CProperty(int entity, const char *name, int line)
Definition worldfile.hh:56
const char * GetEntityType(int entity)
Definition worldfile.cc:1299
std::string filename
Definition worldfile.hh:436
CProperty * GetProperty(int entity, const char *name)
Definition worldfile.cc:1375
int GetEntityCount()
Definition worldfile.cc:1283
int ReadTuple(const int entity, const char *name, const unsigned int first, const unsigned int num, const char *format,...)
Definition worldfile.cc:1572
bool WarnUnused()
Definition worldfile.cc:223
double ReadLength(int entity, const char *name, double value)
Definition worldfile.hh:124
bool Load(const std::string &filename)
Definition worldfile.cc:131
const char * GetPropertyValue(CProperty *property, int index)
Definition worldfile.cc:1421
bool LoadCommon()
Definition worldfile.cc:155
void WriteString(int entity, const char *name, const std::string &value)
Definition worldfile.cc:1460
void WriteTuple(const int entity, const char *name, const unsigned int first, const unsigned int count, const char *format,...)
Definition worldfile.cc:1635
const std::string ReadString(int entity, const char *name, const std::string &value)
Definition worldfile.cc:1450
void WriteInt(int entity, const char *name, int value)
Definition worldfile.cc:1480
Worldfile()
Definition worldfile.cc:61
int ReadInt(int entity, const char *name, int value)
Definition worldfile.cc:1470
int GetEntityParent(int entity)
Definition worldfile.cc:1290
void WriteLength(int entity, const char *name, double value)
int LookupEntity(const char *type)
Definition worldfile.cc:1309
const char * ReadFilename(int entity, const char *name, const char *value)
Definition worldfile.cc:1518
double unit_length
Definition worldfile.hh:440
double unit_angle
Definition worldfile.hh:443
uint32_t ReadColor(int entity, const char *name, uint32_t value)
~Worldfile()
Definition worldfile.cc:69
double ReadFloat(int entity, const char *name, double value)
Definition worldfile.cc:1503
FILE * FileOpen(const std::string &filename, const char *method)
Definition worldfile.cc:77
bool PropertyExists(int section, const char *token)
Definition worldfile.cc:1401
bool Save(const std::string &filename)
Definition worldfile.cc:196
void WriteFloat(int entity, const char *name, double value)
Definition worldfile.cc:1489
double ReadAngle(int entity, const char *name, double value)
Definition worldfile.hh:135
The Stage library uses its own namespace.
Definition canvas.hh:8