]> git.tdb.fi Git - libs/datafile.git/blob - source/statement.h
Rewrite the type system
[libs/datafile.git] / source / statement.h
1 /* $Id$
2
3 This file is part of libmspdatafile
4 Copyright © 2006-2008, 2010  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_DATAFILE_STATEMENT_H_
9 #define MSP_DATAFILE_STATEMENT_H_
10
11 #include <list>
12 #include "value.h"
13
14 namespace Msp {
15 namespace DataFile {
16
17 class Statement
18 {
19 public:
20         typedef std::vector<Value> Arguments;
21
22         std::string keyword;
23         Arguments   args;
24         bool        valid;
25         std::string source;
26         unsigned    line;
27         std::list<Statement> sub;
28
29         Statement();
30         Statement(const std::string &);
31         std::string get_location() const;
32         std::string get_signature() const;
33         
34         template<typename T>
35         Statement &append(const T &v)
36         {
37                 args.push_back(v);
38                 return *this;
39         }
40
41         template<typename T>
42         Statement &operator,(const T &v)
43         { return append(v); }
44 };
45
46 } // namespace DataFile
47 } // namespace Msp
48
49 #endif