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

pubsubevent.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 #ifndef PUBSUBEVENT_H__
00014 #define PUBSUBEVENT_H__
00015 
00016 #include "stanzaextension.h"
00017 #include "pubsub.h"
00018 #include "gloox.h"
00019 
00020 namespace gloox
00021 {
00022 
00023   class Tag;
00024 
00025   namespace PubSub
00026   {
00027 
00034     class GLOOX_API Event : public StanzaExtension
00035     {
00036       public:
00037 
00041         struct ItemOperation
00042         {
00051           ItemOperation( bool remove, const std::string& itemid, const Tag* pld = 0)
00052             : retract( remove ), item( itemid ), payload( pld ) {}
00053 
00054           bool retract;
00055           std::string item;
00056           const Tag* payload;
00057         };
00058 
00062         typedef std::list<ItemOperation*> ItemOperationList;
00063 
00068         Event( const Tag* event );
00069 
00073         virtual ~Event();
00074 
00079         PubSub::EventType type() const { return m_type; }
00080 
00086         const StringList& subscriptions() const
00087           { return m_subscriptionIDs ? *m_subscriptionIDs : m_emptyStringList; }
00088 
00093         const ItemOperationList& items() const
00094           { return m_itemOperations ? *m_itemOperations : m_emptyOperationList; }
00095 
00100         const std::string& node() { return m_node; }
00101 
00102         // reimplemented from StanzaExtension
00103         const std::string& filterString() const;
00104 
00105         // reimplemented from StanzaExtension
00106         StanzaExtension* newInstance( const Tag* tag ) const
00107         {
00108           return new Event( tag );
00109         }
00110 
00111         // reimplemented from StanzaExtension
00112         Tag* tag() const;
00113 
00114       private:
00115 
00116         PubSub::EventType m_type;
00117         std::string m_node;
00118         StringList* m_subscriptionIDs;
00119         Tag* m_config;
00120         ItemOperationList* m_itemOperations;
00121         std::string m_collection;
00122 
00123         const ItemOperationList m_emptyOperationList;
00124         const StringList m_emptyStringList;
00125 
00126     };
00127 
00128   }
00129 
00130 }
00131 
00132 #endif // PUBSUBEVENT_H__

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