Qpid Proton C++ API  0.38.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 "./value.hpp"
27 
28 #include <string>
29 #include <iosfwd>
30 
33 
34 struct pn_condition_t;
35 
36 namespace proton {
37 
41  error_condition(pn_condition_t* c);
43 
44  public:
46  error_condition() = default;
47 
50  PN_CPP_EXTERN error_condition(std::string description);
51 
53  PN_CPP_EXTERN error_condition(std::string name, std::string description);
54 
57  PN_CPP_EXTERN error_condition(std::string name, std::string description, proton::value properties);
58 
60  error_condition(const error_condition&) = default;
61  error_condition& operator=(const error_condition&) = default;
62  error_condition(error_condition&&) = default;
63  error_condition& operator=(error_condition&&) = default;
65 
69  PN_CPP_EXTERN explicit operator bool() const;
70 
72  PN_CPP_EXTERN bool operator!() const;
73 
75  PN_CPP_EXTERN bool empty() const;
76 
78  PN_CPP_EXTERN std::string name() const;
79 
81  PN_CPP_EXTERN std::string description() const;
82 
84  PN_CPP_EXTERN value properties() const;
85 
87  PN_CPP_EXTERN std::string what() const;
88 
89  private:
90  std::string name_;
91  std::string description_;
92  proton::value properties_;
93 
95  friend class internal::factory<error_condition>;
97 };
98 
100 PN_CPP_EXTERN bool operator==(const error_condition& x, const error_condition& y);
101 
103 PN_CPP_EXTERN std::ostream& operator<<(std::ostream& o, const error_condition& err);
104 
105 } // proton
106 
107 #endif // PROTON_ERROR_CONDITION_H
Describes an endpoint error state.
Definition: error_condition.hpp:39
std::string description() const
Descriptive string for condition.
std::string name() const
Condition name.
error_condition()=default
Create an empty error condition.
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(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
bool operator==(const error_condition &x, const error_condition &y)
std::ostream & operator<<(std::ostream &, const binary &)
Print a binary value.
A holder for any AMQP value, simple or complex.