1 /*------------------------------------------------------------------------------
 2 Name:      StatusQosFactory.h
 3 Project:   xmlBlaster.org
 4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
 5 ------------------------------------------------------------------------------*/
 6 
 7 #ifndef _UTIL_QOS_STATUSQOSFACTORY_H
 8 #define _UTIL_QOS_STATUSQOSFACTORY_H
 9 
10 #include <util/xmlBlasterDef.h>
11 #include <util/qos/StatusQosData.h>
12 #include <util/parser/XmlHandlerBase.h>
13 
14 /**
15  * Parsing xml QoS (quality of service) of return status. 
16  * <p />
17  * <pre>
18  *  &lt;qos>
19  *     &lt;state id='OK' info='QUEUED[bilbo]'/>
20  *     &lt;key oid='yourMessageOid'/> <!-- org::xmlBlaster::client::qos::PublishReturnQos and EraseReturnQos only -->
21  *     &lt;subscribe id='_subId:1/> <!-- org::xmlBlaster::client::qos::SubscribeReturnQos and org::xmlBlaster::client::qos::UnSubscribeQos only -->
22  *  &lt;/qos>
23  * </pre>
24  * @see org.xmlBlaster.util.qos.StatusQosData
25  * @see org.xmlBlaster.test.classtest.qos.StatusQosFactoryTest
26  * @author xmlBlaster@marcelruff.info
27  * @author laghi@swissinfo.org
28  */
29 
30 namespace org { namespace xmlBlaster { namespace util { namespace qos {
31 
32 class Dll_Export StatusQosFactory: public org::xmlBlaster::util::parser::XmlHandlerBase
33 {
34 private:
35    std::string                    ME;
36    org::xmlBlaster::util::Global& global_;
37    org::xmlBlaster::util::I_Log&    log_;
38    StatusQosData                  statusQosData_;
39 
40    /** helper flag for SAX parsing: parsing inside <state> ? */
41    bool inState_; //     = false;
42    bool inSubscribe_; //  = false;
43    bool inKey_; //       = false;
44    bool inQos_;
45    bool inIsPersistent_; // QosData
46 
47    void prep();
48 
49 public:
50    StatusQosFactory(org::xmlBlaster::util::Global& global);
51 
52    /**
53     * Start element, event from SAX parser.
54     * <p />
55     * @param name Tag name
56     * @param attrs the attributes of the tag
57     */
58    void startElement(const std::string &name, const parser::AttributeMap& attrs);
59 
60    /**
61     * End element, event from SAX parser.
62     * <p />
63     * @param name Tag name
64     */
65    void endElement(const std::string &name);
66 
67    StatusQosData readObject(const std::string& qos);
68 
69 };
70 
71 }}}} // namespaces
72 
73 #endif


syntax highlighted by Code2HTML, v. 0.9.1