3 /// Virtual protocol packet builder wrapper
7 Copyright (C) 2005-2011, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
28 //////////////////////////////////////////////////////////////////////////////
29 // DBDataBuilder class
32 DBDataBuilder::DBDataBuilder(const DBData
&orig
)
37 DBDataBuilder::~DBDataBuilder()
41 bool DBDataBuilder::BuildRecord(DBData
&data
, size_t &offset
,
44 if( offset
== m_orig
.GetOffset() ) {
49 data
.CopyMeta(m_orig
);
51 // copy the buffer, to the new offset
52 if( m_orig
.GetOffset() > m_orig
.GetData().GetSize() )
53 throw std::logic_error("DBDataBuilder: offset greater than size");
54 size_t actual
= m_orig
.GetData().GetSize() - m_orig
.GetOffset();
55 size_t total
= offset
+ actual
;
56 unsigned char *buf
= data
.UseData().GetBuffer(total
);
58 m_orig
.GetData().GetData() + m_orig
.GetOffset(),
60 data
.UseData().ReleaseBuffer(total
);
63 data
.SetOffset(offset
);
68 bool DBDataBuilder::FetchRecord(DBData
&data
, const IConverter
*ic
)
74 bool DBDataBuilder::EndOfFile() const