privatexml.h
/*
Copyright (c) 2004-2023 by Jakob Schröter <js@camaya.net>
This file is part of the gloox library. http://camaya.net/gloox
This software is distributed under a license. The full license
agreement can be found in the file LICENSE in this distribution.
This software may not be copied, modified, sold or distributed
other than expressed in the named license agreement.
This software is distributed without any warranty.
*/
#ifndef PRIVATEXML_H__
#define PRIVATEXML_H__
#include "iqhandler.h"
#include "privatexmlhandler.h"
#include <string>
#include <list>
#include <map>
namespace gloox
{
class ClientBase;
class Tag;
class Stanza;
class GLOOX_API PrivateXML : public IqHandler
{
public:
PrivateXML( ClientBase* parent );
virtual ~PrivateXML();
std::string requestXML( const std::string& tag, const std::string& xmlns, PrivateXMLHandler* pxh );
std::string storeXML( const Tag* tag, PrivateXMLHandler* pxh );
// reimplemented from IqHandler.
virtual bool handleIq( const IQ& iq ) { (void)iq; return false; }
// reimplemented from IqHandler.
virtual void handleIqID( const IQ& iq, int context );
protected:
ClientBase* m_parent;
private:
#ifdef PRIVATEXML_TEST
public:
#endif
class Query : public StanzaExtension
{
public:
Query( const std::string& tag, const std::string& xmlns )
: StanzaExtension( ExtPrivateXML )
{
m_privateXML = new Tag( tag, XMLNS, xmlns );
}
Query( const Tag* tag = 0 );
~Query() { delete m_privateXML; }
const Tag* privateXML() const { return m_privateXML; }
// reimplemented from StanzaExtension
virtual const std::string& filterString() const;
// reimplemented from StanzaExtension
virtual StanzaExtension* newInstance( const Tag* tag ) const
{
return new Query( tag );
}
// reimplemented from StanzaExtension
virtual Tag* tag() const;
// reimplemented from StanzaExtension
virtual StanzaExtension* clone() const
{
Query* q = new Query();
q->m_privateXML = m_privateXML ? m_privateXML->clone() : 0;
return q;
}
private:
const Tag* m_privateXML;
};
enum IdType
{
RequestXml,
StoreXml
};
typedef std::map<std::string, PrivateXMLHandler*> TrackMap;
TrackMap m_track;
};
}
#endif // PRIVATEXML_H__
gloox::ClientBase
This is the common base class for a Jabber/XMPP Client and a Jabber Component.
Definition clientbase.h:79
gloox::IQ
An abstraction of an IQ stanza.
Definition iq.h:34
gloox::IqHandler
A virtual interface which can be reimplemented to receive IQ stanzas.
Definition iqhandler.h:32
gloox::PrivateXMLHandler
A virtual interface which can be reimplemented to store and receive private XML data.
Definition privatexmlhandler.h:36
gloox::PrivateXML::handleIq
virtual bool handleIq(const IQ &iq)
Definition privatexml.h:72
gloox::PrivateXML::PrivateXML
PrivateXML(ClientBase *parent)
Definition privatexml.cpp:54
gloox::PrivateXML::requestXML
std::string requestXML(const std::string &tag, const std::string &xmlns, PrivateXMLHandler *pxh)
Definition privatexml.cpp:74
gloox::PrivateXML::storeXML
std::string storeXML(const Tag *tag, PrivateXMLHandler *pxh)
Definition privatexml.cpp:88
gloox::StanzaExtension
This class abstracts a stanza extension, which is usually an XML child element in a specific namespac...
Definition stanzaextension.h:204
gloox::Stanza
This is the base class for XMPP stanza abstractions.
Definition stanza.h:34
gloox::Tag
This is an abstraction of an XML element.
Definition tag.h:47
gloox
The namespace for the gloox library.
Definition adhoc.cpp:28
gloox::XMLNS
const std::string XMLNS
Definition gloox.cpp:122
gloox::ExtPrivateXML
@ ExtPrivateXML
Definition stanzaextension.h:63