OnixS C++ FIX Engine 4.13.0
API Documentation
Loading...
Searching...
No Matches
FieldValueRef.h
Go to the documentation of this file.
1/*
2* Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3*
4* This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5* and international copyright treaties.
6*
7* Access to and use of the software is governed by the terms of the applicable OnixS Software
8* Services Agreement (the Agreement) and Customer end user license agreements granting
9* a non-assignable, non-transferable and non-exclusive license to use the software
10* for it's own data processing purposes under the terms defined in the Agreement.
11*
12* Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13* of this source code or associated reference material to any other location for further reproduction
14* or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15*
16* Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17* the terms of the Agreement is a violation of copyright law.
18*/
19
20#pragma once
21
24
25namespace OnixS {
26namespace FIX {
29
32class
35{
36public:
39
42
45 bool valid() const;
46
49 operator std::string() const;
50
52 bool operator == (const FieldValueRef &) const;
53
55 bool operator != (const FieldValueRef &) const;
56
59 bool operator == (const StringRef &) const;
60
63 bool operator != (const StringRef &) const;
64
73 bool toNumber(Int32 &) const;
74
83 bool toNumber(UInt32 &) const;
84
93 bool toNumber(Int64 &) const;
94
103 bool toNumber(UInt64 &) const;
104
113 bool toNumber(Double &) const;
114
123 bool toNumber(Decimal &) const;
124
133 bool
135 Timestamp &,
138
139
148 bool
151
162 bool toStringRef(StringRef &) const;
163
174 StringRef toStringRef() const;
175
187 bool toChar(char &) const;
188
198 bool toGroup(Group &) const;
199
201 void toString(std::string &) const;
202
204 std::string toString() const;
205
209 FieldValueRef & operator = (const FieldValueRef &);
210
212 void swap(FieldValueRef & other);
213
214private:
215 friend class MessageOperator;
216
217 const void * impl_;
218
219 const Message * container_;
220
222 const Message *,
223 const void *);
224};
225
227{
228 StringRef result;
229
230 if(toStringRef(result))
231 return result;
232 else
233 return StringRef();
234}
235
236inline
237FieldValueRef::
238operator std::string() const
239{
240 std::string str;
241
242 toString(str);
243
244 return str;
245}
246
247inline
248std::string
250{
251 std::string str;
252
253 toString(str);
254
255 return str;
256}
257
258// More comparison operators.
259
260inline
261bool
263 const FieldValueRef & ref,
264 const std::string & str)
265{
266 return ref == StringRef(str);
267}
268
269inline
270bool
272 const FieldValueRef & ref,
273 const std::string & str)
274{
275 return ref != StringRef(str);
276}
277
278inline
279bool
281 const std::string & str,
282 const FieldValueRef & ref)
283{
284 return ref == StringRef(str);
285}
286
287inline
288bool
290 const std::string & str,
291 const FieldValueRef & ref)
292{
293 return ref != StringRef(str);
294}
295
296// More comparison operators.
297
298inline
299bool
301 const FieldValueRef & ref,
302 const char * str)
303{
304 return ref == StringRef(str);
305}
306
307inline
308bool
310 const FieldValueRef & ref,
311 const char * str)
312{
313 return ref != StringRef(str);
314}
315
316inline
317bool
319 const char * str,
320 const FieldValueRef & ref)
321{
322 return ref == StringRef(str);
323}
324
325inline
326bool
328 const char * str,
329 const FieldValueRef & ref)
330{
331 return ref != StringRef(str);
332}
333}
334}
#define ONIXS_FIXENGINE_API_DECL(typeKind, typeName)
Definition ABI.h:57
#define ONIXS_FIXENGINE_API
Definition ABI.h:45
The Decimal type for a better precision.
Definition Numeric.h:48
Implements a concept of a read-only reference to a FIX field value.
bool toNumber(Int32 &) const
Converts the field value into the whole number.
bool toStringRef(StringRef &) const
If the value represents a text, returns a reference to it.
std::string toString() const
Return the string presentation of the field value.
bool toNumber(Decimal &) const
Converts the field value into the floating point value.
bool valid() const
Indicated whether the instance refers to a valid value.
bool toGroup(Group &) const
If a repeating group is associated with the field, allows to get an instance of it.
bool toNumber(Int64 &) const
Converts the field value into the whole number.
FieldValueRef()
The uninitialized value.
FieldValueRef(const FieldValueRef &other)
The shallow copy from another one.
StringRef toStringRef() const
If the value represents a text, returns a reference to it.
bool toChar(char &) const
If the value represent a one-char text, copies it into the given variable.
bool toNumber(Double &) const
Converts the field value into the floating point value.
void toString(std::string &) const
Appends a copy of a text presentation to the std::string.
bool toNumber(UInt64 &) const
Converts the field value into the whole number.
bool toTimeSpan(TimeSpan &, TimeSpanFormat::Enum=TimeSpanFormat::HHMMSSMsec) const
Converts the field value into the timespan.
bool toNumber(UInt32 &) const
Converts the field value into the whole number.
bool toTimestamp(Timestamp &, TimestampFormat::Enum=TimestampFormat::YYYYMMDDHHMMSSNsec) const
Converts the field value into the timestamp of the requested format.
void swap(FieldValueRef &other)
Swaps two references.
Encapsulates operations over the FIX Repeating Group.
Definition Group.h:108
Encapsulates operations over a FIX Message.
Definition Message.h:52
Provides an efficient way of accessing text-based FIX field values.
Definition StringRef.h:62
The time span related functionality.
Definition TimeSpan.h:94
The timestamps related functionality.
Definition Timestamp.h:92
double Double
Definition Numeric.h:41
unsigned int UInt32
Definition Numeric.h:36
long long Int64
Definition Numeric.h:38
bool operator==(const FieldValueRef &ref, const std::string &str)
unsigned long long UInt64
Definition Numeric.h:39
int Int32
Definition Numeric.h:35
bool operator!=(const FieldValueRef &ref, const std::string &str)
@ HHMMSSMsec
Indicates the time span in the "HH:MM:SS.sss" format.
Definition TimeSpan.h:79
@ YYYYMMDDHHMMSSNsec
Indicates the timestamp in the "YYYYMMDD-HH:MM:SS.sssssssss" format.
Definition Timestamp.h:83