OnixS C++ ICE Binary Order Entry Handler 1.0.0
API Documentation
Loading...
Searching...
No Matches
Integral.h
Go to the documentation of this file.
1// Copyright Onix Solutions Limited [OnixS]. All rights reserved.
2//
3// This software owned by Onix Solutions Limited [OnixS] and is
4// protected by copyright law and international copyright treaties.
5//
6// Access to and use of the software is governed by the terms of the applicable
7// OnixS Software Services Agreement (the Agreement) and Customer end user license
8// agreements granting a non-assignable, non-transferable and non-exclusive license
9// to use the software for it's own data processing purposes under the terms defined
10// in the Agreement.
11//
12// Except as otherwise granted within the terms of the Agreement, copying or
13// reproduction of any part of this source code or associated reference material
14// to any other location for further reproduction or redistribution, and any
15// amendments to this copyright notice, are expressly prohibited.
16//
17// Any reproduction or redistribution for sale or hiring of the Software not in
18// accordance with the terms of the Agreement is a violation of copyright law.
19//
20
21#pragma once
22
23#include <OnixS/ICE/BOE/ABI.h>
25
26#include <string>
27
29
30typedef int8_t Int8;
31typedef uint8_t UInt8;
32
33typedef int16_t Int16;
34typedef uint16_t UInt16;
35
36typedef int32_t Int32;
37typedef uint32_t UInt32;
38
39typedef int64_t Int64;
40typedef uint64_t UInt64;
41
43template
44<
45 typename Type,
46 Type Constant
47>
49{
51 typedef Type Value;
52
54 constexpr
55 operator Value() const noexcept
56 {
57 return Constant;
58 }
59
61 constexpr
62 Value operator()() const noexcept
63 {
64 return Constant;
65 }
66
68 constexpr
69 static Value value() noexcept
70 {
71 return Constant;
72 }
73};
74
75
78void toStr(std::string&, Int8);
79
81inline
83std::string
85 Int8 number)
86{
87 std::string str;
88
89 toStr(str, number);
90
91 return str;
92}
93
96void
98 std::string&,
99 UInt8);
100
102inline
104std::string
106 UInt8 number)
107{
108 std::string str;
109
110 toStr(str, number);
111
112 return str;
113}
114
117void
119 std::string&,
120 Int16);
121
123inline
125std::string
127 Int16 number)
128{
129 std::string str;
130
131 toStr(str, number);
132
133 return str;
134}
135
138void
140 std::string&,
141 UInt16);
142
144inline
146std::string
148 UInt16 number)
149{
150 std::string str;
151
152 toStr(str, number);
153
154 return str;
155}
156
159void
161 std::string&,
162 Int32);
163
165inline
167std::string
169 Int32 number)
170{
171 std::string str;
172
173 toStr(str, number);
174
175 return str;
176}
177
180void
182 std::string&,
183 UInt32);
184
186inline
188std::string
190 UInt32 number)
191{
192 std::string str;
193
194 toStr(str, number);
195
196 return str;
197}
198
201void
203 std::string&,
204 Int64);
205
207inline
209std::string
211 Int64 number)
212{
213 std::string str;
214
215 toStr(str, number);
216
217 return str;
218}
219
222void
224 std::string&,
225 UInt64);
226
228inline
230std::string
232 UInt64 number)
233{
234 std::string str;
235
236 toStr(str, number);
237
238 return str;
239}
240
244size_t
246 Int8,
247 Char*,
248 size_t);
249
250
254size_t
256 UInt8,
257 Char*,
258 size_t);
259
263size_t
265 Int16,
266 Char*,
267 size_t);
268
269
273size_t
275 UInt16,
276 Char*,
277 size_t);
278
279
283size_t
285 Int32,
286 Char*,
287 size_t);
288
289
292size_t
295 UInt32,
296 Char*,
297 size_t);
298
302size_t
304 Int64,
305 Char*,
306 size_t);
307
308
312size_t
314 UInt64,
315 Char*,
316 size_t);
317
319template
320<
321 typename Type,
322 Type Constant
323>
324inline
325void
327 std::string& str,
329{
330 toStr(str, constant());
331}
332
334template
335<
336 typename Type,
337 Type Constant
338>
339inline
341std::string
344 <Type, Constant> constant)
345{
346 std::string str;
347
348 toStr(str, constant);
349
350 return str;
351}
352
359bool fromStr(Int8&, const Char*, size_t) noexcept;
360
366bool fromStr(Int8& value, const std::string& str) noexcept
367{
368 return
369 fromStr(
370 value,
371 str.c_str(),
372 str.size());
373}
374
381bool
383 UInt8&,
384 const Char*,
385 size_t) noexcept;
386
391inline
394 UInt8& value,
395 const std::string& str) noexcept
396{
397 return
398 fromStr(
399 value,
400 str.c_str(),
401 str.size());
402}
403
410bool
412 Int16&,
413 const Char*,
414 size_t) noexcept;
415
420inline
423 Int16& value,
424 const std::string& str) noexcept
425{
426 return
427 fromStr(
428 value,
429 str.c_str(),
430 str.size());
431}
432
439bool
441 UInt16&,
442 const Char*,
443 size_t) noexcept;
444
451 UInt16& value,
452 const std::string& str) noexcept
453{
454 return
455 fromStr(
456 value,
457 str.c_str(),
458 str.size());
459}
460
467bool
469 Int32&,
470 const Char*,
471 size_t) noexcept;
472
477inline
480 Int32& value,
481 const std::string& str) noexcept
482{
483 return
484 fromStr(
485 value,
486 str.c_str(),
487 str.size());
488}
489
496bool
498 UInt32&,
499 const Char*,
500 size_t) noexcept;
501
506inline
509 UInt32& value,
510 const std::string& str) noexcept
511{
512 return
513 fromStr(
514 value,
515 str.c_str(),
516 str.size());
517}
518
525bool
527 Int64&,
528 const Char*,
529 size_t) noexcept;
530
535inline
538 Int64& value,
539 const std::string& str) noexcept
540{
541 return
542 fromStr(
543 value,
544 str.c_str(),
545 str.size());
546}
547
554bool
556 UInt64&,
557 const Char*,
558 size_t) noexcept;
559
564inline
567 UInt64& value,
568 const std::string& str) noexcept
569{
570 return
571 fromStr(
572 value,
573 str.c_str(),
574 str.size());
575}
576
#define ONIXS_ICEBOE_MESSAGING_NAMESPACE_BEGIN
Definition ABI.h:102
#define ONIXS_ICEBOE_MESSAGING_NAMESPACE_END
Definition ABI.h:106
#define ONIXS_ICEBOE_EXPORTED
Definition Compiler.h:153
#define ONIXS_ICEBOE_NODISCARD
Definition Compiler.h:154
char Char
Character type alias.
Definition String.h:31
std::string toStr(const FixedPointDecimal< Mantissa, Exponent > &)
Serializes a fixed-point decimal into a string.
bool fromStr(Decimal &, const Char *, size_t) noexcept
Deserializes a decimal number from the given text presentation.
constexpr Value operator()() const noexcept
Definition Integral.h:62
static constexpr Value value() noexcept
Definition Integral.h:69