]> git.localhorst.tv Git - l2e.git/blobdiff - src/loader/ParsedSource.h
lousy implementation of "array of identifiers" type
[l2e.git] / src / loader / ParsedSource.h
index b0578a78e548d017f7834d7cd810e889f0992089..c843de1889add9c37d22247ced22477533c37af1 100644 (file)
@@ -51,6 +51,7 @@ public:
        enum Type {
                ARRAY_VALUES,
                ARRAY_PROPS,
+               ARRAY_IDENTS,
                BOOLEAN,
                COLOR,
                NUMBER,
@@ -62,15 +63,27 @@ public:
        };
 
 public:
+       /// array of values
        explicit Literal(const std::vector<Value *> &);
+       /// array of objects
        Literal(const std::string &, const std::vector<PropertyList *> &);
+       /// array of identifiers
+       Literal(const std::string &, const std::vector<std::string> &);
+       /// 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<ScriptToken *> &);
        ~Literal();
 private:
@@ -79,12 +92,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<Value *> &GetValues() const;
        const std::vector<PropertyList *> &GetPropertyLists() const;
+       const std::vector<std::string> &GetIdentifiers() const;
        bool GetBoolean() const;
        int GetRed() const;
        int GetGreen() const;
@@ -103,6 +118,7 @@ private:
        std::string typeName, str;
        std::vector<Value *> values;
        std::vector<PropertyList *> propertyLists;
+       std::vector<std::string> identifiers;
        std::vector<ScriptToken *> script;
        int i1, i2, i3, i4;
        bool b;