1 /*------------------------------------------------------------------------------
2 Name: UnSubscribeQos.h
3 Project: xmlBlaster.org
4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
5 ------------------------------------------------------------------------------*/
6
7 /**
8 * This class encapsulates the QoS of an unSubcribe() request.
9 * <p />
10 * A full specified <b>unSubcribe</b> qos could look like this:<br />
11 * <pre>
12 *<qos>
13 *</qos>
14 * </pre>
15 * <p />
16 * see xmlBlaster/src/dtd/XmlQoS.xml
17 * @see org.xmlBlaster.util.qos.QueryQosData
18 * @see org.xmlBlaster.util.qos.QueryQosSaxFactory
19 * @see <a href="http://www.xmlblaster.org/xmlBlaster/doc/requirements/interface.unSubscribe.html">unSubscribe interface</a>
20 */
21 #ifndef _CLIENT_QOS_UNSUBSCRIBEQOS_H
22 #define _CLIENT_QOS_UNSUBSCRIBEQOS_H
23
24 #include <util/xmlBlasterDef.h>
25 #include <util/qos/QueryQosData.h>
26
27 namespace org { namespace xmlBlaster { namespace client { namespace qos {
28
29 class Dll_Export UnSubscribeQos
30 {
31 protected:
32 std::string ME;
33 org::xmlBlaster::util::Global& global_;
34 mutable org::xmlBlaster::util::qos::QueryQosData data_;
35
36 public:
37 /**
38 * Constructor for default qos (quality of service).
39 */
40 UnSubscribeQos(org::xmlBlaster::util::Global& global);
41
42 /**
43 * Create the instance.
44 * @param global
45 * @param data The const'ness may be broken when put to persistence.
46 */
47 UnSubscribeQos(org::xmlBlaster::util::Global& global,
48 const org::xmlBlaster::util::qos::QueryQosData& data);
49
50 UnSubscribeQos(const UnSubscribeQos& qos);
51
52 UnSubscribeQos& operator =(const UnSubscribeQos& qos);
53
54 /**
55 * Add a client property key and value.
56 * @param name The unique key, a duplicate key will overwrite the old setting
57 * @param value "vector<unsigned char>" and "unsigned char *" types are treated as a blob
58 * @see ClientProperty::#ClientProperty
59 */
60 template <typename T_VALUE> void addClientProperty(
61 const std::string& name,
62 const T_VALUE& value,
63 const std::string& type="",
64 const std::string& encoding="") {
65 data_.addClientProperty(name, value, type, encoding);
66 }
67
68 /**
69 * Access the value for the given name, if not found returns the defaultValue.
70 */
71 template <typename T_VALUE> T_VALUE getClientProperty(
72 const std::string& name,
73 const T_VALUE& defaultValue) {
74 return data_.getClientProperty(name, defaultValue);
75 }
76
77 bool hasClientProperty(const std::string& name) const {
78 return data_.hasClientProperty(name);
79 }
80
81 /**
82 * Converts the data into a valid XML ASCII std::string.
83 * @return An XML ASCII std::string
84 */
85 std::string toXml() const;
86
87 const org::xmlBlaster::util::qos::QueryQosData& getData() const;
88 };
89
90 }}}}
91
92 #endif
syntax highlighted by Code2HTML, v. 0.9.1