X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Floader%2FParsedSource.h;h=619f2b952283a63009a7e8ed8224d2a5788324a7;hb=0e7b9eca67383e45e04aa419cb783c92722f7801;hp=b0578a78e548d017f7834d7cd810e889f0992089;hpb=cc3d698b8c1ad09d7a3f9e3f28bc84e0ac1735ea;p=l2e.git diff --git a/src/loader/ParsedSource.h b/src/loader/ParsedSource.h index b0578a7..619f2b9 100644 --- a/src/loader/ParsedSource.h +++ b/src/loader/ParsedSource.h @@ -1,7 +1,11 @@ #ifndef LOADER_PARSEDSOURCE_H_ #define LOADER_PARSEDSOURCE_H_ -#include "fwd.h" +namespace loader { + class Literal; + class PropertyList; + class Value; +} #include #include @@ -51,6 +55,7 @@ public: enum Type { ARRAY_VALUES, ARRAY_PROPS, + ARRAY_IDENTS, BOOLEAN, COLOR, NUMBER, @@ -62,15 +67,27 @@ public: }; public: + /// array of values explicit Literal(const std::vector &); + /// array of objects Literal(const std::string &, const std::vector &); + /// array of identifiers + Literal(const std::string &, const std::vector &); + /// boolean explicit Literal(bool); + /// color Literal(int r, int g, int b, int a = 255); + /// number explicit Literal(int number); + /// path string Literal(const std::string &dir, const std::string &path); + /// string Literal(const std::string &); + /// vector Literal(int x, int y); + /// object Literal(const std::string &typeName, PropertyList *properties); + /// script explicit Literal(const std::vector &); ~Literal(); private: @@ -79,12 +96,14 @@ private: public: Type GetType() const { return type; } - bool IsArray() const { return GetType() == ARRAY_VALUES || GetType() == ARRAY_PROPS; } + bool IsArray() const { return GetType() == ARRAY_VALUES || GetType() == ARRAY_PROPS || GetType() == ARRAY_IDENTS; } bool IsObject() const { return GetType() == OBJECT; } - int ArraySize() const { return GetType() == ARRAY_VALUES ? GetValues().size() : GetPropertyLists().size(); } + int ArraySize() const { return GetType() == ARRAY_VALUES ? GetValues().size() + : (GetType() == ARRAY_PROPS ? GetPropertyLists().size() : GetIdentifiers().size()); } const std::vector &GetValues() const; const std::vector &GetPropertyLists() const; + const std::vector &GetIdentifiers() const; bool GetBoolean() const; int GetRed() const; int GetGreen() const; @@ -103,6 +122,7 @@ private: std::string typeName, str; std::vector values; std::vector propertyLists; + std::vector identifiers; std::vector script; int i1, i2, i3, i4; bool b; @@ -259,4 +279,4 @@ ostream &operator <<(ostream &, const loader::Literal &); } -#endif /* LOADER_PARSEDSOURCE_H_ */ +#endif