-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathFieldByteVector.cpp
More file actions
83 lines (69 loc) · 1.36 KB
/
Copy pathFieldByteVector.cpp
File metadata and controls
83 lines (69 loc) · 1.36 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright (c) 2009, Object Computing, Inc.
// All rights reserved.
// See the file license.txt for licensing information.
#include <Common/QuickFASTPch.h>
#include "FieldByteVector.h"
#include <Common/Exceptions.h>
using namespace ::QuickFAST;
using namespace ::QuickFAST::Messages;
FieldByteVector::FieldByteVector(const std::string & value)
: Field(true)
, value_(value)
{
}
FieldByteVector::FieldByteVector(const uchar * buffer, size_t length)
: Field(true)
, value_(std::string(reinterpret_cast<const char *>(buffer), length))
{
}
FieldByteVector::FieldByteVector()
: Field(false)
, value_()
{
}
FieldByteVector::~FieldByteVector()
{
}
Field::FieldType
FieldByteVector::getType() const
{
return Field::BYTEVECTOR;
}
bool
FieldByteVector::isString() const
{
return true;
}
const std::string &
FieldByteVector::toByteVector() const
{
if(!valid_)
{
FieldNotPresent ex("Field not present");
}
return value_;
}
const std::string &
FieldByteVector::toString() const
{
if(!valid_)
{
FieldNotPresent ex("Field not present");
}
return value_;
}
FieldCPtr
FieldByteVector::create(const std::string & value)
{
return new FieldByteVector(value);
}
FieldCPtr
FieldByteVector::create(const uchar * buffer, size_t length)
{
return new FieldByteVector(buffer, length);
}
FieldCPtr
FieldByteVector::createNull()
{
return new FieldByteVector;
}