]> git.localhorst.tv Git - l2e.git/blobdiff - src/loader/ParsedSource.h
fixed trigger type switch in Map
[l2e.git] / src / loader / ParsedSource.h
index 36f3810ab434cb8805bb188b95348f6984165a91..64baaaa4d3cb99cec172e65acbdcb14f7e69fd72 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef LOADER_PARSEDSOURCE_H_
 #define LOADER_PARSEDSOURCE_H_
 
+#include "fwd.h"
+
 #include <iosfwd>
 #include <map>
 #include <set>
@@ -16,9 +18,6 @@
 
 namespace loader {
 
-class PropertyList;
-class Value;
-
 class Literal {
 
 public:
@@ -28,6 +27,7 @@ public:
                BOOLEAN,
                COLOR,
                NUMBER,
+               PATH,
                STRING,
                VECTOR,
                OBJECT
@@ -35,10 +35,11 @@ public:
 
 public:
        explicit Literal(const std::vector<Value *> &);
-       explicit Literal(const std::vector<PropertyList *> &);
+       Literal(const std::string &, const std::vector<PropertyList *> &);
        explicit Literal(bool);
        Literal(int r, int g, int b, int a = 255);
        explicit Literal(int number);
+       Literal(const std::string &dir, const std::string &path);
        Literal(const std::string &);
        Literal(int x, int y);
        Literal(const std::string &typeName, PropertyList *properties);
@@ -49,6 +50,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<Value *> &GetValues() const;
        const std::vector<PropertyList *> &GetPropertyLists() const;
@@ -66,7 +70,7 @@ public:
 
 private:
        PropertyList *props;
-       std::string str;
+       std::string typeName, str;
        std::vector<Value *> values;
        std::vector<PropertyList *> propertyLists;
        int i1, i2, i3, i4;
@@ -204,6 +208,9 @@ public:
        const std::map<std::string, Definition *> &Definitions() const { return definitions; }
        const std::set<std::string> &Exports() const { return exports; }
 
+public:
+       void WriteHeader(std::ostream &) const;
+
 private:
        std::map<std::string, Declaration *> declarations;
        std::map<std::string, Definition *> definitions;