]> git.localhorst.tv Git - l2e.git/blobdiff - src/loader/ParsedSource.h
added utility function to create headers
[l2e.git] / src / loader / ParsedSource.h
index d5347e55c201d5e02a9492369acdc519ec6740cc..98ecd8423c401652f235c01a5ed7d68d40b1379b 100644 (file)
@@ -28,6 +28,7 @@ public:
                BOOLEAN,
                COLOR,
                NUMBER,
+               PATH,
                STRING,
                VECTOR,
                OBJECT
@@ -39,9 +40,14 @@ public:
        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);
+       ~Literal();
+private:
+       Literal(const Literal &);
+       Literal &operator =(const Literal &);
 
 public:
        Type GetType() const { return type; }
@@ -78,7 +84,16 @@ public:
        explicit Value(const std::string &identifier)
        : literal(0), identifier(identifier), isLiteral(false) { }
        explicit Value(Literal *literal)
-       : literal(literal), isLiteral(false) { }
+       : literal(literal), isLiteral(true) { }
+       ~Value();
+private:
+       Value(const Value &);
+       Value &operator =(const Value &);
+
+public:
+       bool IsLiteral() const { return isLiteral; }
+       const Literal &GetLiteral() const;
+       const std::string &GetIdentifier() const;
 
 private:
        Literal *literal;
@@ -91,13 +106,24 @@ private:
 class PropertyList {
 
 public:
+       PropertyList() { }
        ~PropertyList();
+private:
+       PropertyList(const PropertyList &);
+       PropertyList &operator =(const PropertyList &);
 
 public:
        void SetProperty(const std::string &name, Value *value) {
                props[name] = value;
        }
 
+       typedef std::map<std::string, Value *>::iterator Iterator;
+       typedef std::map<std::string, Value *>::const_iterator ConstIterator;
+       Iterator Begin() { return props.begin(); }
+       ConstIterator Begin() const { return props.begin(); }
+       Iterator End() { return props.end(); }
+       ConstIterator End() const { return props.end(); }
+
 private:
        std::map<std::string, Value *> props;
 
@@ -110,6 +136,9 @@ public:
        Declaration(const std::string &typeName, const std::string &identifier)
        : typeName(typeName), identifier(identifier) { }
        virtual ~Declaration() { }
+private:
+       Declaration(const Declaration &);
+       Declaration &operator =(const Declaration &);
 
 public:
        const std::string &TypeName() const { return typeName; }
@@ -128,6 +157,10 @@ class Definition
 public:
        Definition(const std::string &typeName, const std::string &identifier)
        : Declaration(typeName, identifier), value(0), isLiteral(false) { }
+       virtual ~Definition();
+private:
+       Definition(const Definition &);
+       Definition &operator =(const Definition &);
 
 public:
        void SetValue(Literal *);
@@ -151,7 +184,10 @@ class ParsedSource {
 
 public:
        ParsedSource() { }
-       ~ParsedSource() { }
+       ~ParsedSource();
+private:
+       ParsedSource(const ParsedSource &);
+       ParsedSource &operator =(const ParsedSource &);
 
 public:
        void AddDeclaration(Declaration *);
@@ -170,6 +206,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;