blob: b2788acbebbe464f1b550e46b1aad2ee26edf8f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/*
* TransactionBufferReader.cpp
*
* Created on: 7 Jul 2016
* Author: David
*/
#include "TransactionBufferReader.h"
TransactionBufferReader::TransactionBufferReader(TransactionBuffer& tb)
: buf(tb), offset(0), ok(true)
{
}
const char* TransactionBufferReader::GetString(size_t fieldWidth)
{
if (ok)
{
if (offset + fieldWidth <= buf.GetLength())
{
buf.EnsureNull(offset + fieldWidth - 1);
const char* rslt = buf.GetData() + offset;
offset += fieldWidth;
return rslt;
}
ok = false;
}
return "**ERROR**";
}
// End
|