X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fargumentstore.cpp;h=22cb11f5f7ccdca7547ccb3474a3eed09d27f967;hb=e1b8089be727f651fc2022d6e7ff775047730e85;hp=532d66aaa230e49a63209be828de19ab3b5ed5aa;hpb=81d65ed026039319b31ac9aa5aad2bab6c978fb9;p=libs%2Fdatafile.git diff --git a/source/argumentstore.cpp b/source/argumentstore.cpp index 532d66a..22cb11f 100644 --- a/source/argumentstore.cpp +++ b/source/argumentstore.cpp @@ -1,5 +1,8 @@ +#include #include "argumentstore.h" +using namespace std; + namespace Msp { namespace DataFile { @@ -19,7 +22,30 @@ ArgumentStore::ArgumentStore(const StatementInfo &n): } } +ArgumentStore::ArgumentStore(const ArgumentStore &other): + info(other.info), + store(new char[info.args_size]) +{ + copy_from(other.store); +} + +ArgumentStore &ArgumentStore::operator=(const ArgumentStore &other) +{ + if(&other.info!=&info) + throw invalid_argument("ArgumentStore::operator="); + + destroy(); + copy_from(other.store); + + return *this; +} + ArgumentStore::~ArgumentStore() +{ + destroy(); +} + +void ArgumentStore::destroy() { for(unsigned i=0; i(other+info.arg_offsets[i])); + break; + case SymbolType::signature: + new(store+info.arg_offsets[i]) SymbolType::Store(*reinterpret_cast(other+info.arg_offsets[i])); + break; + default: + copy(other+info.arg_offsets[i], other+(i+1