diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2011-03-16 14:06:26 +0200 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2011-03-16 14:06:26 +0200 |
commit | 7041ab5d41644bc3310b5c16b9c0aa3818a03d10 (patch) | |
tree | e3cab3306b88a72cd32e13bb4baa192f7d775e65 | |
parent | 01212a19ce05aaa27ff33dae06bed646e7a65535 (diff) |
skeleton for events handler
functions return type correction
-rw-r--r-- | api/ec_pluginapi.h | 4 | ||||
-rw-r--r-- | core/basic-services.cpp | 6 | ||||
-rw-r--r-- | core/commonheaders.h | 1 | ||||
-rw-r--r-- | core/core.project | 2 | ||||
-rw-r--r-- | core/events.cpp | 27 | ||||
-rw-r--r-- | core/events.h | 22 | ||||
-rw-r--r-- | core/main.cpp | 2 | ||||
-rw-r--r-- | core/services.cpp | 8 | ||||
-rw-r--r-- | core/services.h | 2 | ||||
-rw-r--r-- | core/utf8.cpp | 8 |
10 files changed, 67 insertions, 15 deletions
diff --git a/api/ec_pluginapi.h b/api/ec_pluginapi.h index 4176819..50bb776 100644 --- a/api/ec_pluginapi.h +++ b/api/ec_pluginapi.h @@ -35,7 +35,9 @@ typedef struct { void (*CreateServiceFunction)(const char *,SERVICE); void* (*CallService)(const char *,void*); - int (*ServiceExists)(const char *); + bool (*ServiceExists)(const char *); + bool (*RegisterEventHandler)(void*); + bool (*RegisterEventType)(int); } PLUGINLINK; typedef struct diff --git a/core/basic-services.cpp b/core/basic-services.cpp index 2cfcecb..4013cb2 100644 --- a/core/basic-services.cpp +++ b/core/basic-services.cpp @@ -85,10 +85,10 @@ void *wchartoutf8(void* utf8) return ACE_OS::strdup(toUTF8((wchar_t*)utf8).c_str()); } -void *chartoutf8(void* utf8) +/*void *chartoutf8(void* utf8) { return ACE_OS::strdup(toUTF8((char*)utf8).c_str()); -} +}*/ void register_core_services() @@ -100,5 +100,5 @@ void register_core_services() CreateServiceFunction("EC/toUtf16", (SERVICE)toutf16); CreateServiceFunction("EC/WCHARtoUtf8", (SERVICE)wchartoutf8); - CreateServiceFunction("EC/CHARtoUtf8", (SERVICE)chartoutf8); +// CreateServiceFunction("EC/CHARtoUtf8", (SERVICE)chartoutf8); } diff --git a/core/commonheaders.h b/core/commonheaders.h index a838775..ff628d8 100644 --- a/core/commonheaders.h +++ b/core/commonheaders.h @@ -41,6 +41,7 @@ #include "../api/ec_pluginapi.h" #include "services.h" #include "modules.h" +#include "events.h" #include "../api/ec_services.h"
#include "globals.h"
#include "utf8.h"
diff --git a/core/core.project b/core/core.project index c576751..d277579 100644 --- a/core/core.project +++ b/core/core.project @@ -13,6 +13,7 @@ <File Name="modules.cpp"/> <File Name="services.cpp"/> <File Name="utf8.cpp"/> + <File Name="events.cpp"/> </VirtualDirectory> <VirtualDirectory Name="headers"> <File Name="utf8.h"/> @@ -23,6 +24,7 @@ <File Name="services.h"/> <File Name="../api/ec_pluginapi.h"/> <File Name="../api/ec_services.h"/> + <File Name="events.h"/> </VirtualDirectory> <Settings Type="Executable"> <Configuration Name="Debug" CompilerType="gnu gcc" DebuggerType="GNU gdb debugger" Type="Executable" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append"> diff --git a/core/events.cpp b/core/events.cpp new file mode 100644 index 0000000..58e6b24 --- /dev/null +++ b/core/events.cpp @@ -0,0 +1,27 @@ +/* Copyright 2011 sss + * This file is part of evil_core. + * + * evil_core is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * evil_core is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with evil_core. If not, see <http://www.gnu.org/licenses/>.*/ + +#include "commonheaders.h" +#include <boost/signal.hpp> + +bool RegisterEventHandler(void* func) +{ + return false; +} +bool RegisterEventType(int type) +{ + return false; +} diff --git a/core/events.h b/core/events.h new file mode 100644 index 0000000..ec2d714 --- /dev/null +++ b/core/events.h @@ -0,0 +1,22 @@ +/* Copyright 2011 sss + * This file is part of evil_core. + * + * evil_core is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * evil_core is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with evil_core. If not, see <http://www.gnu.org/licenses/>.*/ + +#ifndef EVENTS_H_INCLUDED +#define EVENTS_H_INCLUDED +bool RegisterEventHandler(void*); +bool RegisterEventType(int); + +#endif diff --git a/core/main.cpp b/core/main.cpp index 4a71738..1fe689c 100644 --- a/core/main.cpp +++ b/core/main.cpp @@ -25,7 +25,7 @@ ACE_Log_Msg logger; bool halt_requested = false; -PLUGINLINK pluglink = {&CreateServiceFunction, &CallService, &ServiceExists}; +PLUGINLINK pluglink = {&CreateServiceFunction, &CallService, &ServiceExists, &RegisterEventHandler, &RegisterEventType}; int on_exit() { diff --git a/core/services.cpp b/core/services.cpp index 06e060c..42f8fb8 100644 --- a/core/services.cpp +++ b/core/services.cpp @@ -20,7 +20,7 @@ extern std::list<service*> services; extern boost::mutex service_list_mutex; -int ServiceExists(const char *name); +bool ServiceExists(const char *name); void CreateServiceFunction(const char* name, SERVICE svc) { if(!ServiceExists(name)) @@ -42,7 +42,7 @@ void* CallService(const char *name,void* data) } return 0; } -int ServiceExists(const char *name) +bool ServiceExists(const char *name) { service_list_mutex.lock(); if(!services.empty()) @@ -50,10 +50,10 @@ int ServiceExists(const char *name) std::list<service*>::iterator end = services.end(); for(std::list<service*>::iterator i = services.begin(); i != end; ++i) if(!ACE_OS::strcmp((*i)->getName(), name)) - return 1; + return true; } service_list_mutex.unlock(); - return 0; + return false; } service::service(const char* name, SERVICE svc) diff --git a/core/services.h b/core/services.h index 15da2f3..61d111b 100644 --- a/core/services.h +++ b/core/services.h @@ -33,7 +33,7 @@ private: void CreateServiceFunction(const char* name, SERVICE svc); void* CallService(const char *,void*); -int ServiceExists(const char *); +bool ServiceExists(const char *); #endif // SERVICES_H_INCLUDED
diff --git a/core/utf8.cpp b/core/utf8.cpp index c5e83e1..2dac1ea 100644 --- a/core/utf8.cpp +++ b/core/utf8.cpp @@ -20,20 +20,18 @@ std::string toUTF8(std::wstring str) { std::string ustr; - std::wstring tmpstr; - utf8::replace_invalid(str.begin(), str.end(), back_inserter(tmpstr)); - utf8::utf16to8(tmpstr.begin(), tmpstr.end(), back_inserter(ustr)); + utf8::utf16to8(str.begin(), str.end(), back_inserter(ustr)); return ustr; } -std::string toUTF8(std::string str) +/*std::string toUTF8(std::string str) { std::string ustr; std::string tmpstr; utf8::replace_invalid(str.begin(), str.end(), back_inserter(tmpstr)); utf8::utf16to8(tmpstr.begin(), tmpstr.end(), back_inserter(ustr)); return ustr; -} +}*/ |