X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fstatement.cpp;h=b1ff05826e314441fd3e93ced8c5117f295b5824;hb=43b8dee0bf05dee1b4a07cc001fae0c81ec53a2f;hp=a1bd688bf38016b24e326ce2e863cc6f76f51fd8;hpb=a582163d380833b1370ba067a1fd0ad5c2984723;p=libs%2Fdatafile.git diff --git a/source/statement.cpp b/source/statement.cpp index a1bd688..b1ff058 100644 --- a/source/statement.cpp +++ b/source/statement.cpp @@ -1,12 +1,6 @@ -/* $Id: statement.h 19 2007-08-21 14:11:23Z tdb $ - -This file is part of libmspdatafile -Copyright © 2007, 2010 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - -#include +#include #include "statement.h" +#include "type.h" using namespace std; @@ -15,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) { } @@ -40,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