Qpid Proton C++ 0.33.0
error_condition.hpp
Go to the documentation of this file.
1#ifndef PROTON_ERROR_CONDITION_H
2#define PROTON_ERROR_CONDITION_H
3
4/*
5 *
6 * Licensed to the Apache Software Foundation (ASF) under one
7 * or more contributor license agreements. See the NOTICE file
8 * distributed with this work for additional information
9 * regarding copyright ownership. The ASF licenses this file
10 * to you under the Apache License, Version 2.0 (the
11 * "License"); you may not use this file except in compliance
12 * with the License. You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing,
17 * software distributed under the License is distributed on an
18 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19 * KIND, either express or implied. See the License for the
20 * specific language governing permissions and limitations
21 * under the License.
22 *
23 */
24
25#include "./internal/export.hpp"
26#include "./internal/config.hpp"
27#include "./value.hpp"
28
29#include <string>
30#include <iosfwd>
31
34
35struct pn_condition_t;
36
37namespace proton {
38
42 error_condition(pn_condition_t* c);
44
45 public:
48
51 PN_CPP_EXTERN error_condition(std::string description);
52
54 PN_CPP_EXTERN error_condition(std::string name, std::string description);
55
58 PN_CPP_EXTERN error_condition(std::string name, std::string description, proton::value properties);
59
60#if PN_CPP_HAS_DEFAULTED_FUNCTIONS && PN_CPP_HAS_DEFAULTED_MOVE_INITIALIZERS
62 error_condition(const error_condition&) = default;
63 error_condition& operator=(const error_condition&) = default;
65 error_condition& operator=(error_condition&&) = default;
67#endif
68
69#if PN_CPP_HAS_EXPLICIT_CONVERSIONS
73 PN_CPP_EXTERN explicit operator bool() const;
74#endif
75
77 PN_CPP_EXTERN bool operator!() const;
78
80 PN_CPP_EXTERN bool empty() const;
81
83 PN_CPP_EXTERN std::string name() const;
84
86 PN_CPP_EXTERN std::string description() const;
87
89 PN_CPP_EXTERN value properties() const;
90
92 PN_CPP_EXTERN std::string what() const;
93
94 private:
95 std::string name_;
96 std::string description_;
97 proton::value properties_;
98
100 friend class internal::factory<error_condition>;
102};
103
105PN_CPP_EXTERN bool operator==(const error_condition& x, const error_condition& y);
106
108PN_CPP_EXTERN std::ostream& operator<<(std::ostream& o, const error_condition& err);
109
110} // proton
111
112#endif // PROTON_ERROR_CONDITION_H
Describes an endpoint error state.
Definition: error_condition.hpp:40
std::string description() const
Descriptive string for condition.
std::string name() const
Condition name.
error_condition(std::string description)
Create an error condition with only a description.
bool operator!() const
No condition set.
bool empty() const
No condition has been set.
error_condition()
Create an empty error condition.
Definition: error_condition.hpp:47
error_condition(std::string name, std::string description, proton::value properties)
Unsettled API - Create an error condition with name, description, and informational properties.
error_condition(std::string name, std::string description)
Create an error condition with a name and description.
value properties() const
Extra information for condition.
std::string what() const
Simple printable string for condition.
A holder for any AMQP value, simple or complex.
Definition: value.hpp:57
The main Proton namespace.
Definition: annotation_key.hpp:33
std::ostream & operator<<(std::ostream &, const binary &)
Print a binary value.
bool operator==(const error_condition &x, const error_condition &y)
A holder for any AMQP value, simple or complex.