gloox  1.0.28
stanzaextension.h
1 /*
2  Copyright (c) 2006-2023 by Jakob Schröter <js@camaya.net>
3  This file is part of the gloox library. http://camaya.net/gloox
4 
5  This software is distributed under a license. The full license
6  agreement can be found in the file LICENSE in this distribution.
7  This software may not be copied, modified, sold or distributed
8  other than expressed in the named license agreement.
9 
10  This software is distributed without any warranty.
11 */
12 
13 
14 #ifndef STANZAEXTENSION_H__
15 #define STANZAEXTENSION_H__
16 
17 #include "macros.h"
18 
19 #include <string>
20 
21 namespace gloox
22 {
23 
24  class Tag;
25  class Stanza;
26 
31  {
35  ExtOOB,
37  ExtGPGSigned,
41  ExtReceipt,
43  ExtDelay,
45  ExtAMP,
48  ExtCaps,
56  ExtVersion,
58  ExtXHtmlIM,
92  ExtIOData,
94  ExtUser
97  };
98 
203  class GLOOX_API StanzaExtension
204  {
205  public:
211  StanzaExtension( int type ) : m_valid( false ), m_extensionType( type ) {}
212 
216  virtual ~StanzaExtension() {}
217 
224  virtual Stanza* embeddedStanza() const { return 0; }
225 
232  virtual Tag* embeddedTag() const { return 0; }
233 
240  virtual const std::string& filterString() const = 0;
241 
253  virtual StanzaExtension* newInstance( const Tag* tag ) const = 0;
254 
259  virtual Tag* tag() const = 0;
260 
265  virtual StanzaExtension* clone() const = 0;
266 
271  int extensionType() const { return m_extensionType; }
272 
273  protected:
274  bool m_valid;
275 
276  private:
277  int m_extensionType;
278 
279  };
280 
281 }
282 
283 #endif // STANZAEXTENSION_H__
This class abstracts a stanza extension, which is usually an XML child element in a specific namespac...
virtual const std::string & filterString() const =0
virtual Tag * tag() const =0
virtual Tag * embeddedTag() const
virtual Stanza * embeddedStanza() const
virtual StanzaExtension * newInstance(const Tag *tag) const =0
virtual StanzaExtension * clone() const =0
This is the base class for XMPP stanza abstractions.
Definition: stanza.h:34
This is an abstraction of an XML element.
Definition: tag.h:47
The namespace for the gloox library.
Definition: adhoc.cpp:28
StanzaExtensionType
@ ExtGPGEncrypted
@ ExtRegistration
@ ExtLastActivity
@ ExtMUCUnique
@ ExtAdhocCommand
@ ExtPrivateXML
@ ExtFeatureNeg
@ ExtPubSubEvent
@ ExtDiscoItems
@ ExtDiscoInfo
@ ExtPubSubOwner
@ ExtMessageEvent
@ ExtGPGSigned
@ ExtVCardUpdate
@ ExtAttention
@ ExtSessionCreation
@ ExtFlexOffline
@ ExtNonSaslAuth
@ ExtChatState
@ ExtResourceBind