X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Floader%2FParsedSource.h;h=5012729b93344e0f521b9fd79b1bf1803b384260;hb=21539c358e849b44106b4af3f5941b4131c0f2d1;hp=8401777f54e0f43ebac98a6ed2e3286a268ec87f;hpb=09e8cfd4d7b2d187fed0870ebdb2e9e3f77fe4b9;p=l2e.git diff --git a/src/loader/ParsedSource.h b/src/loader/ParsedSource.h index 8401777..5012729 100644 --- a/src/loader/ParsedSource.h +++ b/src/loader/ParsedSource.h @@ -36,7 +36,7 @@ public: public: explicit Literal(const std::vector &); - explicit Literal(const std::vector &); + Literal(const std::string &, const std::vector &); explicit Literal(bool); Literal(int r, int g, int b, int a = 255); explicit Literal(int number); @@ -51,6 +51,9 @@ private: public: Type GetType() const { return type; } + bool IsArray() const { return GetType() == ARRAY_VALUES || GetType() == ARRAY_PROPS; } + bool IsObject() const { return GetType() == OBJECT; } + int ArraySize() const { return GetType() == ARRAY_VALUES ? GetValues().size() : GetPropertyLists().size(); } const std::vector &GetValues() const; const std::vector &GetPropertyLists() const; @@ -68,7 +71,7 @@ public: private: PropertyList *props; - std::string str; + std::string typeName, str; std::vector values; std::vector propertyLists; int i1, i2, i3, i4; @@ -206,6 +209,9 @@ public: const std::map &Definitions() const { return definitions; } const std::set &Exports() const { return exports; } +public: + void WriteHeader(std::ostream &) const; + private: std::map declarations; std::map definitions;