Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

privatexml.h

00001 /*
00002   Copyright (c) 2004-2008 by Jakob Schroeter <js@camaya.net>
00003   This file is part of the gloox library. http://camaya.net/gloox
00004 
00005   This software is distributed under a license. The full license
00006   agreement can be found in the file LICENSE in this distribution.
00007   This software may not be copied, modified, sold or distributed
00008   other than expressed in the named license agreement.
00009 
00010   This software is distributed without any warranty.
00011 */
00012 
00013 
00014 
00015 #ifndef PRIVATEXML_H__
00016 #define PRIVATEXML_H__
00017 
00018 #include "iqhandler.h"
00019 #include "privatexmlhandler.h"
00020 
00021 #include <string>
00022 #include <list>
00023 #include <map>
00024 
00025 namespace gloox
00026 {
00027 
00028   class ClientBase;
00029   class Tag;
00030   class Stanza;
00031 
00037   class GLOOX_API PrivateXML : public IqHandler
00038   {
00039     public:
00046       PrivateXML( ClientBase* parent );
00047 
00051       virtual ~PrivateXML();
00052 
00060       std::string requestXML( const std::string& tag, const std::string& xmlns, PrivateXMLHandler* pxh );
00061 
00069       std::string storeXML( const Tag* tag, PrivateXMLHandler* pxh );
00070 
00071       // reimplemented from IqHandler.
00072       virtual bool handleIq( const IQ& iq ) { (void)iq; return false; }
00073 
00074       // reimplemented from IqHandler.
00075       virtual void handleIqID( const IQ& iq, int context );
00076 
00077     protected:
00078       ClientBase* m_parent;
00079 
00080     private:
00087       class Query : public StanzaExtension
00088       {
00089         public:
00095           Query( const std::string& tag, const std::string& xmlns )
00096             : StanzaExtension( ExtPrivateXML )
00097           {
00098             m_privateXML = new Tag( tag, XMLNS, xmlns );
00099           }
00100 
00106           Query( const Tag* tag = 0 );
00107 
00111           ~Query() { delete m_privateXML; }
00112 
00117           const Tag* privateXML() const { return m_privateXML; }
00118 
00119           // reimplemented from StanzaExtension
00120           virtual const std::string& filterString() const;
00121 
00122           // reimplemented from StanzaExtension
00123           virtual StanzaExtension* newInstance( const Tag* tag ) const
00124           {
00125             return new Query( tag );
00126           }
00127 
00128           // reimplemented from StanzaExtension
00129           virtual Tag* tag() const;
00130 
00131         private:
00132           const Tag* m_privateXML;
00133 
00134       };
00135 
00136       enum IdType
00137       {
00138         RequestXml,
00139         StoreXml
00140       };
00141 
00142       typedef std::map<std::string, PrivateXMLHandler*> TrackMap;
00143 
00144       TrackMap m_track;
00145   };
00146 
00147 }
00148 
00149 #endif // PRIVATEXML_H__

Generated on Mon Sep 1 09:25:10 2008 for gloox by  doxygen 1.4.1