SDL++
C++wrapperfortheSDLlibrary.

event/MultiComparator.h

Go to the documentation of this file.
00001 
00021 #ifndef SDL_EVENT_MULTICOMPARATOR_H
00022 #define SDL_EVENT_MULTICOMPARATOR_H
00023 
00024 #include <SDL.h>
00025 
00026 namespace sdl {
00027 namespace event {
00036     template<typename Device, int EventType, int... Ids>
00037     struct MultiComparator {
00045         static bool compare (const SDL_Event* event) { return false; };
00046     }; //MultiComparator
00047 
00055     template<typename Device, int EventType>
00056     struct MultiComparator<Device, EventType> {
00064         static bool compare (const SDL_Event* event) { return false; };
00065     }; //MultiComparator
00066 
00076     template<typename Device, int EventType, int Id, int... Ids>
00077     struct MultiComparator<Device, EventType, Id, Ids...> {
00085         static bool compare (const SDL_Event* event) {
00086             return (EventType == event->type && Device::which (event) == Id) || MultiComparator<Device, EventType, Ids...>::compare (event);
00087         };
00088     }; //MultiComparator
00089 }; //event
00090 }; //sdl
00091 
00092 #endif //SDL_EVENT_MULTICOMPARATOR_H
00093 
 All Classes Namespaces Files Functions Variables Typedefs