CrystalSpace

Public API Reference

iutil/eventhandlers.h

Go to the documentation of this file.
00001 /*
00002   Copyright (C) 2005 by Adam D. Bradley <[email protected]>
00003   
00004   This library is free software; you can redistribute it and/or
00005   modify it under the terms of the GNU Library General Public
00006   License as published by the Free Software Foundation; either
00007   version 2 of the License, or (at your option) any later version.
00008   
00009   This library is distributed in the hope that it will be useful,
00010   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012   Library General Public License for more details.
00013   
00014   You should have received a copy of the GNU Library General Public
00015   License along with this library; if not, write to the Free
00016   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 */
00018 
00019 #ifndef __CS_IUTIL_EVENTHANDLERS_H__
00020 #define __CS_IUTIL_EVENTHANDLERS_H__
00021 
00022 #include "csutil/hash.h"
00023 
00032 typedef csStringID csHandlerID;
00033 #define CS_HANDLER_INVALID csInvalidStringID
00034 #define CS_HANDLERLIST_END csInvalidStringID
00035 
00036 #ifndef CSHASHCOMPUTER_EVENTENGINE_IDS
00037 #define CSHASHCOMPUTER_EVENTENGINE_IDS
00038 template<>
00039 class csHashComputer<const csHandlerID>
00040 {
00041 public:
00042   static uint ComputeHash (const csHandlerID &mid) 
00043   {
00044     return (uint) mid;
00045   }
00046 };
00047 #endif // CSHASHCOMPUTER_EVENTENGINE_IDS
00048 
00049 struct iEventHandler;
00050 
00058 struct iEventHandlerRegistry : public virtual iBase
00059 {
00060   SCF_INTERFACE(iEventHandlerRegistry, 1, 3, 0);
00061 
00067   virtual CS_CONST_METHOD csHandlerID GetGenericID (const char*) = 0;
00068   virtual CS_CONST_METHOD csHandlerID GetGenericPreBoundID (csHandlerID) = 0;
00069   virtual CS_CONST_METHOD csHandlerID GetGenericPostBoundID (csHandlerID) = 0;
00076   virtual csHandlerID GetID (iEventHandler *) = 0;
00082   virtual csHandlerID GetID (const char*) = 0;
00083 
00090   virtual csHandlerID RegisterID (iEventHandler *) = 0;
00094   virtual void ReleaseID (csHandlerID id) = 0;
00098   virtual void ReleaseID (iEventHandler *) = 0;
00104   virtual CS_CONST_METHOD iEventHandler *GetHandler (csHandlerID id) = 0;
00110   virtual CS_CONST_METHOD bool const IsInstanceOf (csHandlerID instanceid, 
00111     csHandlerID genericid) = 0;
00115   virtual CS_CONST_METHOD bool const IsInstance (csHandlerID id) = 0;
00119   virtual CS_CONST_METHOD csHandlerID const GetGeneric (csHandlerID id) = 0;
00123   virtual CS_CONST_METHOD const char *GetString (csHandlerID id) = 0;
00124 }; 
00125 
00128 #endif // __CS_IUTIL_EVENTHANDLERS_H__

Generated for Crystal Space by doxygen 1.4.7