]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/statement.cpp
Remove the loaded flag from PackSource files
[libs/datafile.git] / source / statement.cpp
index 29961a963fcfa97ce6d8461c0a384a64ce465bcd..b1ff05826e314441fd3e93ced8c5117f295b5824 100644 (file)
@@ -1,5 +1,6 @@
 #include <msp/strings/format.h>
 #include "statement.h"
+#include "type.h"
 
 using namespace std;
 
@@ -8,12 +9,14 @@ namespace DataFile {
 
 Statement::Statement():
        valid(false),
+       control(false),
        line(0)
 { }
 
 Statement::Statement(const string &kw):
        keyword(kw),
        valid(true),
+       control(!kw.compare(0, 2, "__")),
        line(0)
 { }
 
@@ -33,5 +36,38 @@ string Statement::get_signature() const
        return result;
 }
 
+
+StatementInfo::StatementInfo():
+       args_size(0)
+{ }
+
+StatementInfo::StatementInfo(const string &k, const string &s):
+       key(k, s),
+       args_size(0)
+{
+       for(string::const_iterator i=key.signature.begin(); i!=key.signature.end(); ++i)
+       {
+               arg_offsets.push_back(args_size);
+               switch(*i)
+               {
+               case IntType::signature:
+                       args_size += sizeof(IntType::Store);
+                       break;
+               case FloatType::signature:
+                       args_size += sizeof(FloatType::Store);
+                       break;
+               case BoolType::signature:
+                       args_size += sizeof(BoolType::Store);
+                       break;
+               case StringType::signature:
+                       args_size += sizeof(StringType::Store);
+                       break;
+               case SymbolType::signature:
+                       args_size += sizeof(SymbolType::Store);
+                       break;
+               }
+       }
+}
+
 } // namespace DataFile
 } // namespace Msp