+ /// Get an object of given type that is defined by given
+ /// name.
+ /// If the object identified by name is of another type,
+ /// a cast is performed for compatible types.
+ /// Error is thrown if the object is undefined or a cast
+ /// was unsuccessful.
+ void *GetObject(int typeId, const std::string &name);
+
+ /// Register the type descriptions of builtin types.
+ /// This should be called before any interpretation (like
+ /// calling ReadSource()) is performed.
+ static void CreateTypeDescriptions();
+ /// Represents a parsed definition with resulting type and
+ /// object IDs.
+ struct ParsedDefinition {
+ ParsedDefinition(const Definition *dfn, int type, int id)
+ : dfn(dfn), type(type), id(id) { }
+ const Definition *dfn;
+ int type;
+ int id;
+ };
+ /// Represents a postponed object where the type and
+ /// target location are already known, but the definition
+ /// was not accessible at interpretation time.
+ /// It could become available later or be dynamically
+ /// linked by its identifier.
+ struct PostponedDefinition {
+ PostponedDefinition(
+ char *dest,
+ const char *identifier,
+ int type,
+ bool inlined,
+ bool aggregate)
+ : dest(dest)
+ , identifier(identifier)
+ , type(type)
+ , inlined(inlined)
+ , aggregate(aggregate) { }
+ char *dest;
+ const char *identifier;
+ int type;
+ bool inlined;
+ bool aggregate;
+ };
+
+ /// Get all the identifiers that are marked for export
+ /// by name in the source.
+ const std::set<std::string> &ExportedIdentifiers() const {
+ return source.Exports();
+ }
+ /// Get the object definition for given identifier.
+ const ParsedDefinition &GetDefinition(const std::string &identifier);
+ /// 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;
+ }
+ /// Get all definitions that were postponed because they
+ /// were not in the parsed source.
+ const std::vector<PostponedDefinition> &PostponedDefinitions() const {
+ return postponedDefinitions;
+ }
+ /// A map of object id to object.
+ const std::map<int, std::vector<void *> > &Values() const {
+ return values;
+ }