Qpid Proton C++  0.13.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
error_condition.hpp
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 #include "./internal/config.hpp"
28 
29 #include <string>
30 #include <iosfwd>
31 
32 struct pn_condition_t;
33 
34 namespace proton {
35 
39  error_condition(pn_condition_t* c);
41 
42  public:
45 
48  PN_CPP_EXTERN error_condition(std::string description);
49 
51  PN_CPP_EXTERN error_condition(std::string name, std::string description);
52 
55  PN_CPP_EXTERN error_condition(std::string name, std::string description, proton::value properties);
56 
57 #if PN_CPP_HAS_DEFAULTED_FUNCTIONS
58  error_condition(const error_condition&) = default;
59  error_condition(error_condition&&) = default;
60  error_condition& operator=(const error_condition&) = default;
61  error_condition& operator=(error_condition&&) = default;
62 #endif
63 
67 #if PN_CPP_HAS_EXPLICIT_CONVERSIONS
68  PN_CPP_EXTERN explicit operator bool() const;
69 #endif
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 // XXX Document these
101 PN_CPP_EXTERN bool operator==(const error_condition& x, const error_condition& y);
102 PN_CPP_EXTERN std::ostream& operator<<(std::ostream& o, const error_condition& err);
104 
105 } // proton
106 
107 #endif // PROTON_ERROR_CONDITION_H
std::ostream & operator<<(std::ostream &, const binary &)
Print a binary value.
bool empty() const
No condition has been set.
value properties() const
Extra information for condition.
std::string name() const
Condition name.
std::string description() const
Descriptive string for condition.
A holder for any AMQP value, simple or complex.
Definition: value.hpp:69
error_condition()
Create an empty error condition.
Definition: error_condition.hpp:44
std::string what() const
Simple printable string for condition.
bool operator!() const
If you are using a C++11 compiler, you may use an error_condition in boolean contexts.
Describes an endpoint error state.
Definition: error_condition.hpp:37