3 /// Virtual protocol packet builder wrapper
7 Copyright (C) 2005-2012, 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.
29 //////////////////////////////////////////////////////////////////////////////
30 // DBDataBuilder class
33 DBDataBuilder::DBDataBuilder(const DBData
&orig
)
38 DBDataBuilder::~DBDataBuilder()
42 bool DBDataBuilder::BuildRecord(DBData
&data
, size_t &offset
,
45 if( offset
== m_orig
.GetOffset() ) {
50 data
.CopyMeta(m_orig
);
52 // copy the buffer, to the new offset
53 if( m_orig
.GetOffset() > m_orig
.GetData().GetSize() )
54 throw std::logic_error(_("DBDataBuilder: offset greater than size"));
55 size_t actual
= m_orig
.GetData().GetSize() - m_orig
.GetOffset();
56 size_t total
= offset
+ actual
;
57 unsigned char *buf
= data
.UseData().GetBuffer(total
);
59 m_orig
.GetData().GetData() + m_orig
.GetOffset(),
61 data
.UseData().ReleaseBuffer(total
);
64 data
.SetOffset(offset
);
69 bool DBDataBuilder::FetchRecord(DBData
&data
, const IConverter
*ic
)
75 bool DBDataBuilder::EndOfFile() const