/// Error is thrown if the object is undefined or a cast
/// was unsuccessful.
void *GetObject(int typeId, const std::string &name);
+ const void *GetObject(int typeId, const std::string &name) const;
/// Register the type descriptions of builtin types.
/// This should be called before any interpretation (like
/// linked by its identifier.
struct PostponedDefinition {
PostponedDefinition(
+ char *object,
char *dest,
- const char *identifier,
+ const std::string &identifier,
int type,
bool inlined,
bool aggregate)
- : dest(dest)
+ : object(object)
+ , dest(dest)
, identifier(identifier)
, type(type)
, inlined(inlined)
, aggregate(aggregate) { }
+ char *object;
char *dest;
- const char *identifier;
+ std::string identifier;
int type;
bool inlined;
bool aggregate;
}
/// Get the object definition for given identifier.
const ParsedDefinition &GetDefinition(const std::string &identifier);
+ const ParsedDefinition &GetDefinition(const std::string &identifier) const;
/// Get all images reference by he source.
/// The returned map is indexed by filenames relative to
/// the source file and contains ready-to-blit surfaces.
const std::map<std::string, SDL_Surface *> &Images() const {
return imageCache;
}
+ const std::string &FindImage(SDL_Surface *) const;
/// Get all definitions that were postponed because they
/// were not in the parsed source.
const std::vector<PostponedDefinition> &PostponedDefinitions() const {
const std::map<int, std::vector<void *> > &Values() const {
return values;
}
+ struct Array {
+ void *data;
+ unsigned int typeId;
+ unsigned int size;
+ bool ref;
+ };
+ const std::vector<Array> &Arrays() const {
+ return arrays;
+ }
private:
/// Interpret given definition.
bool CanLink(const Value &) const;
/// Defer linking of given object reference.
void Postpone(
+ char *object,
char *dest,
const std::string &identifier,
int type,
std::vector<PostponedDefinition> postponedDefinitions;
std::map<std::string, SDL_Surface *> imageCache;
std::map<int, std::vector<void *> > values;
+ std::vector<Array> arrays;
};