OnixS CME Drop Copy Handler C++ library 5.7.1
API documentation
Loading...
Searching...
No Matches
Warning.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 protected by copyright law
4// and international copyright treaties.
5//
6// Access to and use of the software is governed by the terms of the applicable OnixS Software
7// Services Agreement (the Agreement) and Customer end user license agreements granting
8// a non-assignable, non-transferable and non-exclusive license to use the software
9// for it's own data processing purposes under the terms defined in the Agreement.
10//
11// Except as otherwise granted within the terms of the Agreement, copying or reproduction of any
12// part of this source code or associated reference material to any other location for further
13// reproduction or redistribution, and any amendments to this copyright notice, are expressly
14// 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
22#include "OnixS/CME/DropCopy/Export.h"
24
25namespace OnixS { namespace CME { namespace DropCopy {
26
28struct ONIXS_CME_DROP_COPY_EXPORT KnownWarnings
29{
31 enum Enum
32 {
35
40 };
41
43 static Enum deserialize(const char* value);
44
46 static const char* toString(Enum value);
47};
48
51
53class ONIXS_CME_DROP_COPY_EXPORT Warning
54{
55public:
57 Warning(const std::string& source, WarningCode code);
58
60 Warning(const std::string& source, WarningCode code, const std::string& description);
61
63 Warning(const Warning& other);
64
67
69 WarningCode code() const;
70
72 const char* description() const;
73
75 const char* source() const;
76
78 std::string toString() const;
79
81 void toString(std::string&) const;
82
84 Warning& operator=(const Warning& other);
85
86private:
87 enum Traits
88 {
89 SourceMaxLength = 128,
90 DescriptionMaxLength = 1024
91 };
92
93 WarningCode code_;
94 char source_[SourceMaxLength];
95 char description_[DescriptionMaxLength];
96};
97
99{
100 return code_;
101}
102
103inline const char* Warning::description() const
104{
105 return description_;
106}
107
108inline const char* Warning::source() const
109{
110 return source_;
111}
112
113inline std::string Warning::toString() const
114{
115 std::string str;
116 toString(str);
117 return str;
118}
119
120}}}
121
122namespace std {
123// Outputs message into standard stream.
124ONIXS_CME_DROP_COPY_EXPORT std::ostream&
125operator<<(std::ostream&, const OnixS::CME::DropCopy::Warning&);
126}
std::string toString() const
String presentation of an warning.
Definition Warning.h:113
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:108
void toString(std::string &) const
Appends presentation of an warning to the string.
WarningCode code() const
Code of warning.
Definition Warning.h:98
Warning(const Warning &other)
Initializes as clone of another warning.
const char * description() const
Human readable description.
Definition Warning.h:103
~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:50
STL namespace.
std::ostream & operator<<(std::ostream &, const OnixS::CME::DropCopy::Error &)
List of known warnings.
Definition Warning.h:29
Enum
List of known warnings.
Definition Warning.h:32
@ Generic
General-purpose warning.
Definition Warning.h:34
static const char * toString(Enum value)
Returns description of a particular warning.
static Enum deserialize(const char *value)
Returns constant from its text presentation.