From 77e98c8c03eae08f50efbf681d0c9c792746bbb6 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 17 Jan 2010 23:41:02 -0500 Subject: [PATCH] Enhancement - Hooks - Improved the conditional compilation. --- src/Hooks.cpp | 15 ++++++++++----- src/Hooks.h | 5 +++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/Hooks.cpp b/src/Hooks.cpp index 1cf399747..6afa0f05d 100644 --- a/src/Hooks.cpp +++ b/src/Hooks.cpp @@ -47,6 +47,7 @@ void Hooks::initialize () //////////////////////////////////////////////////////////////////////////////// bool Hooks::trigger (const std::string& event) { +#ifdef HAVE_LIBLUA // TODO Look up scripts/functions hooking this event. // TODO Load the scripts if necessary. @@ -61,8 +62,9 @@ bool Hooks::trigger (const std::string& event) } else throw std::string ("Unrecognized hook event '") + event + "'"; +#endif - return false; + return true; } //////////////////////////////////////////////////////////////////////////////// @@ -94,6 +96,8 @@ bool Hooks::eventType (const std::string& event, std::string& type) } //////////////////////////////////////////////////////////////////////////////// +#ifdef HAVE_LIBLUA + bool Hooks::triggerProgramEvent (const std::string& event) { std::cout << "Hooks::triggerProgramEvent " << event << std::endl; @@ -101,28 +105,29 @@ bool Hooks::triggerProgramEvent (const std::string& event) // TODO Is this event hooked? // TODO Is the associated script loaded? // TODO Call the function - return false; + return true; } //////////////////////////////////////////////////////////////////////////////// bool Hooks::triggerListEvent (const std::string& event) { std::cout << "Hooks::triggerListEvent " << event << std::endl; - return false; + return true; } //////////////////////////////////////////////////////////////////////////////// bool Hooks::triggerTaskEvent (const std::string& event) { std::cout << "Hooks::triggerTaskEvent " << event << std::endl; - return false; + return true; } //////////////////////////////////////////////////////////////////////////////// bool Hooks::triggerFieldEvent (const std::string& event) { std::cout << "Hooks::triggerFieldEvent " << event << std::endl; - return false; + return true; } +#endif //////////////////////////////////////////////////////////////////////////////// diff --git a/src/Hooks.h b/src/Hooks.h index ad596637e..34aade486 100644 --- a/src/Hooks.h +++ b/src/Hooks.h @@ -30,6 +30,7 @@ #include #include #include "API.h" +#include "auto.h" class Hooks { @@ -44,13 +45,17 @@ public: bool eventType (const std::string&, std::string&); private: +#ifdef HAVE_LIBLUA bool triggerProgramEvent (const std::string&); bool triggerListEvent (const std::string&); bool triggerTaskEvent (const std::string&); bool triggerFieldEvent (const std::string&); +#endif private: +#ifdef HAVE_LIBLUA API api; +#endif std::vector scripts; };