OnixS BME SENAF Handler C++ library 2.3.0
API documentation
Loading...
Searching...
No Matches
Warning.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
5 * copyright law and international copyright treaties.
6 *
7 * Access to and use of the software is governed by the terms of the applicable
8 * ONIXS Software Services Agreement (the Agreement) and Customer end user
9 * license agreements granting a non-assignable, non-transferable and
10 * non-exclusive license to use the software for it's own data processing
11 * purposes under the terms defined in the Agreement.
12 *
13 * Except as otherwise granted within the terms of the Agreement, copying or
14 * reproduction of any part of this source code or associated reference material
15 * to any other location for further reproduction or redistribution, and any
16 * amendments to this copyright notice, are expressly prohibited.
17 *
18 * Any reproduction or redistribution for sale or hiring of the Software not in
19 * accordance with the terms of the Agreement is a violation of copyright law.
20 */
21
22#pragma once
23
24#include <OnixS/Senaf/MarketData/Export.h>
25
26#include <iosfwd>
27#include <string>
28
29namespace OnixS { namespace Senaf { namespace MarketData {
30
32struct ONIXS_BME_SENAF_EXPORT KnownWarnings
33{
35 enum Enum
36 {
39 };
40
42 static Enum deserialize(const char* value);
43
45 static const char* toString(Enum value);
46};
47
50
52class ONIXS_BME_SENAF_EXPORT Warning
53{
54public:
56 Warning(const std::string& source, WarningCode code);
57
59 Warning(const std::string& source, WarningCode code, const std::string& description);
60
62 Warning(const Warning& other);
63
66
68 WarningCode code() const;
69
71 const char* description() const;
72
74 const char* source() const;
75
77 std::string toString() const;
78
80 void toString(std::string&) const;
81
83 Warning& operator=(const Warning& other);
84
85private:
86 enum Traits
87 {
88 SourceMaxLength = 128,
89 DescriptionMaxLength = 1024
90 };
91
92 WarningCode code_;
93 char source_[SourceMaxLength];
94 char description_[DescriptionMaxLength];
95};
96
98ONIXS_BME_SENAF_EXPORT std::ostream& operator<<(std::ostream&, const Warning&);
99
101{
102 return code_;
103}
104
105inline const char* Warning::description() const
106{
107 return description_;
108}
109
110inline const char* Warning::source() const
111{
112 return source_;
113}
114
115inline std::string Warning::toString() const
116{
117 std::string str;
118 toString(str);
119 return str;
120}
121
122}}} // namespace OnixS::Senaf::MarketData
std::string toString() const
String presentation of an warning.
Definition Warning.h:115
Warning(const std::string &source, WarningCode code)
Initializes instance with just a code.
Warning & operator=(const Warning &other)
Copies warning attributes from another instance.
const char * source() const
Origin of the warning.
Definition Warning.h:110
void toString(std::string &) const
Appends presentation of an warning to the string.
WarningCode code() const
Code of warning.
Definition Warning.h:100
Warning(const Warning &other)
Initializes as clone of another warning.
const char * description() const
Human readable description.
Definition Warning.h:105
~Warning()
Cleans internal resources.
Warning(const std::string &source, WarningCode code, const std::string &description)
Initializes instance with code and description.
KnownWarnings::Enum WarningCode
Code of warning.
Definition Warning.h:49
std::ostream & operator<<(std::ostream &, const Error &)
Make it printable to formatted C++ I/O streams.
List of known warnings.
Definition Warning.h:33
Enum
List of known warnings.
Definition Warning.h:36
@ Generic
General-purpose warning.
Definition Warning.h:38
static const char * toString(Enum value)
Returns description of a particular warning.
static Enum deserialize(const char *value)
Returns constant from its text presentation.