gloox  1.0.9
jingleplugin.h
1 /*
2  Copyright (c) 2008-2013 by Jakob Schroeter <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 JINGLEPLUGIN_H__
15 #define JINGLEPLUGIN_H__
16 
17 #include "macros.h"
18 #include "util.h"
19 
20 #include <string>
21 #include <list>
22 
23 namespace gloox
24 {
25 
26  class Tag;
27 
28  namespace Jingle
29  {
30 
31  class Plugin;
33 
37  typedef std::list<const Plugin*> PluginList;
38 
52  class GLOOX_API Plugin
53  {
54 
55  friend class PluginFactory;
56 
57  public:
61  Plugin() : m_factory( 0 ) {}
62 
66  virtual ~Plugin() { util::clearList( m_plugins ) ; }
67 
72  void addPlugin( const Plugin* plugin ) { if( plugin ) m_plugins.push_back( plugin ); }
73 
78  const PluginList& plugins() const { return m_plugins; }
79 
85  virtual const StringList features() const { return StringList(); }
86 
94  virtual const std::string& filterString() const = 0;
95 
100  virtual Tag* tag() const = 0;
101 
108  virtual Plugin* newInstance( const Tag* tag ) const = 0;
109 
114  virtual Plugin* clone() const = 0;
115 
116  protected:
117  PluginList m_plugins;
118  PluginFactory* m_factory;
119 
120  private:
121  void setFactory( PluginFactory* factory ) { m_factory = factory; }
122 
123  };
124 
125  }
126 
127 }
128 
129 #endif // JINGLEPLUGIN_H__