]> git.tdb.fi Git - libs/datafile.git/commitdiff
Add an easier way to construct statements for writing
authorMikko Rasa <tdb@tdb.fi>
Sun, 9 Mar 2008 01:02:43 +0000 (01:02 +0000)
committerMikko Rasa <tdb@tdb.fi>
Sun, 9 Mar 2008 01:02:43 +0000 (01:02 +0000)
source/statement.h

index f2fa6e629bf7a1d50676bbe25b4f3096e87310dc..efc097bd7e11b4c100627fbd9dcf8a5776433cc0 100644 (file)
@@ -24,7 +24,19 @@ public:
        std::list<Statement> sub;
 
        Statement(): valid(false), line(0) { }
+       Statement(const std::string &kw): keyword(kw), valid(true), line(0) { }
        std::string get_location() const;
+       
+       template<typename T>
+       Statement &append(const T &v)
+       {
+               args.push_back(Value(v));
+               return *this;
+       }
+
+       template<typename T>
+       Statement &operator,(const T &v)
+       { return append(v); }
 };
 
 } // namespace DataFile