FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
PluginEvent.h
1 /**********************************************************\
2 Original Author: Richard Bateman (taxilian)
3 
4 Created: Oct 19, 2009
5 License: Dual license model; choose one of two:
6  New BSD License
7  http://www.opensource.org/licenses/bsd-license.php
8  - or -
9  GNU Lesser General Public License, version 2.1
10  http://www.gnu.org/licenses/lgpl-2.1.html
11 
12 Copyright 2009 PacketPass, Inc and the Firebreath development team
13 \**********************************************************/
14 
15 #pragma once
16 #ifndef H_FB_PLUGINEVENT
17 #define H_FB_PLUGINEVENT
18 
19 #include <string>
20 #include <map>
21 #include <stdexcept>
22 #include <boost/cast.hpp>
23 #include "APITypes.h"
24 
25 namespace FB {
26 
37  {
38  public:
39  PluginEvent() { };
40  virtual ~PluginEvent() { };
41 
42  public:
43 
59  template<class T>
60  T* get()
61  {
62  return boost::polymorphic_cast<T*>(this);
63  }
64 
72  template<class T>
73  bool validType()
74  {
75  T* out(dynamic_cast<T*>(this));
76  return out != NULL;
77  }
78  };
79 };
80 
81 #endif
82 
bool validType()
Returns true if the object can be cast to the specified type.
Definition: PluginEvent.h:73
Plugin event base class.
Definition: PluginEvent.h:36