OnixS C++ CME MDP Premium Market Data Handler 5.10.3
Users' manual and API documentation
Loading...
Searching...
No Matches
String.h
Go to the documentation of this file.
1#pragma once
2
4#include <OnixS/CME/MDH/ABI.h>
5
6#if !defined(ONIXS_CMEMDH_MESSAGING_NO_DEPRECATED)
7
8ONIXS_CMEMDH_DEPRECATED_HEADER("This header is deprecated. Use <OnixS/CME/MDH/messaging/StrRef.h> instead.")
9
10#include <OnixS/CME/MDH/messaging/String.h>
12
13#include <string>
14
16
17using Char ONIXS_CMEMDH_DEPRECATED = Messaging::Char;
18
19class StrRef : public Messaging::StrRef
20{
21 typedef Messaging::StrRef Base;
22
23public:
24 using Iterator ONIXS_CMEMDH_DEPRECATED = const Messaging::Char*;
25
27 StrRef() noexcept
28 : Base()
29 {
30 }
31
33 StrRef(const Messaging::Char* chars, size_t size) noexcept
34 : Base(chars, size)
35 {
36 }
37
39 StrRef(const Messaging::Char* chars) noexcept
40 : Base(chars ? Base(chars) : Base())
41 {
42 }
43
45 StrRef(const std::string& str) noexcept
46 : Base(str.data(), str.size())
47 {
48 }
49
50 StrRef(Base ref) noexcept
51 : Base(ref)
52 {
53 }
54
56 const Messaging::Char* items() const noexcept
57 {
58 return data();
59 }
60
62 void reset() noexcept
63 {
64 static_cast<Base&>(*this) = Base();
65 }
66
68 void reset(const Messaging::Char* chars, size_t size) noexcept
69 {
70 static_cast<Base&>(*this) = Base(chars, size);
71 }
72};
73
74#if defined(ONIXS_CMEMDH_CXX17)
75inline bool operator==(Messaging::StrRef ref, const std::string& str)
76{
77 return ref == Messaging::toStrRef(str);
78}
79
80inline bool operator!=(Messaging::StrRef ref, const std::string& str)
81{
82 return ref != Messaging::toStrRef(str);
83}
84
85inline bool operator==(const std::string& str, Messaging::StrRef ref)
86{
87 return ref == Messaging::toStrRef(str);
88}
89
90inline bool operator!=(const std::string& str, Messaging::StrRef ref)
91{
92 return ref != Messaging::toStrRef(str);
93}
94#endif
95
96using Messaging::toStr;
97using Messaging::toStrRef;
98
99inline bool operator==(const StrRef& ref, const std::string& str)
100{
101 return static_cast<Messaging::StrRef>(ref) == Messaging::toStrRef(str);
102}
103
104inline bool operator!=(const StrRef& ref, const std::string& str)
105{
106 return static_cast<Messaging::StrRef>(ref) != Messaging::toStrRef(str);
107}
108
109inline bool operator==(const std::string& str, const StrRef& ref)
110{
111 return static_cast<Messaging::StrRef>(ref) == Messaging::toStrRef(str);
112}
113
114inline bool operator!=(const std::string& str, const StrRef& ref)
115{
116 return static_cast<Messaging::StrRef>(ref) != Messaging::toStrRef(str);
117}
118
120
121#endif
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition Bootstrap.h:54
#define ONIXS_CMEMDH_NAMESPACE_END
Definition Bootstrap.h:55
#define ONIXS_CMEMDH_DEPRECATED
Definition Compiler.h:167
#define ONIXS_CMEMDH_DEPRECATED_HEADER(msg)
Definition Compiler.h:168
bool operator!=(const TimeSpan &left, const TimeSpan &right) noexcept
Compares Timespans.
Definition Time.h:342
char Char
Character type alias.
Definition String.h:30
bool operator==(const TimeSpan &left, const TimeSpan &right) noexcept
Compares Timespans.
Definition Time.h:335
std::basic_string_view< Char > StrRef
Definition StrRef.h:46