X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Floader%2FInterpreter.h;h=b12efaedebb35fe3fac09057ffb13600aa3348ff;hb=02db07fbdd774a0a3b10806aa77d782059ba62cc;hp=b826d2cf7be2b15b03c58903b7b3078881545d04;hpb=ac3755adc509404528ef7de58695bf8e3bfb7dcd;p=l2e.git diff --git a/src/loader/Interpreter.h b/src/loader/Interpreter.h index b826d2c..b12efae 100644 --- a/src/loader/Interpreter.h +++ b/src/loader/Interpreter.h @@ -8,12 +8,14 @@ #ifndef LOADER_INTERPRETER_H_ #define LOADER_INTERPRETER_H_ +#include "ParsedSource.h" #include "TypeDescription.h" #include "../geometry/Vector.h" #include "../graphics/Color.h" #include "../graphics/ComplexAnimation.h" #include +#include #include #include #include @@ -47,7 +49,7 @@ namespace graphics { namespace loader { class Definition; -class ParsedSource; +class Literal; class PropertyList; class Value; @@ -71,43 +73,50 @@ public: void *GetObject(int typeId, const std::string &name); static void CreateTypeDescriptions(); + struct ParsedDefinition { + ParsedDefinition(const Definition *dfn, int type, int id) + : dfn(dfn), type(type), id(id) { } + const Definition *dfn; + int type; + int id; + }; struct PostponedDefinition { - PostponedDefinition(int type, int id, std::ptrdiff_t offset, const char *identifier, int linkedType) - : type(type), id(id), offset(offset), identifier(identifier), linkedType(linkedType) { } + PostponedDefinition(int type, int id, std::ptrdiff_t offset, const char *identifier, int linkedType, bool inlined) + : type(type), id(id), offset(offset), identifier(identifier), linkedType(linkedType), inlined(inlined) { } int type; int id; std::ptrdiff_t offset; const char *identifier; int linkedType; + bool inlined; }; - const std::vector &PostponedDefinitions() { return postponedDefinitions; } + const std::set &ExportedIdentifiers() const { return source.Exports(); } + const ParsedDefinition &GetDefinition(const std::string &identifier) const { return parsedDefinitions.at(identifier); } + const std::map &Images() const { return imageCache; } + const std::vector &PostponedDefinitions() const { return postponedDefinitions; } + const std::map > &Values() const { return values; } private: void ReadDefinition(const Definition &); void ReadLiteral(const Definition &); void ReadObject(const Definition &); + void ReadLiteral(int typeId, int id, char *dest, const Literal &); void *GetObject(int typeId, const Value &value); void ReadObject(int typeId, int id, char *dest, const PropertyList &); + SDL_Surface *GetImage(const std::string &); + + bool CanLink(const Value &) const; + void Postpone(int type, int id, std::ptrdiff_t offset, const std::string &identifier, int linkedType, bool inlined); + private: const ParsedSource &source; - struct ParsedDefinition { - ParsedDefinition(const Definition *dfn, int type, int id) - : dfn(dfn), type(type), id(id) { } - const Definition *dfn; - int type; - int id; - }; - std::map parsedDefinitions; - bool CanLink(const Value &) const; - void Postpone(int type, int id, std::ptrdiff_t offset, const std::string &identifier, int linkedType); + std::map parsedDefinitions; std::vector postponedDefinitions; - std::map imageCache; - std::map > values; };