Removed I2_ prefix for header guard #defines.

This commit is contained in:
Gunnar Beutner 2012-04-02 08:56:30 +02:00
parent 0b570cc304
commit 191ded487b
34 changed files with 110 additions and 104 deletions

View File

@ -1,5 +1,5 @@
#ifndef I2_APPLICATION_H #ifndef APPLICATION_H
#define I2_APPLICATION_H #define APPLICATION_H
#include <map> #include <map>
@ -42,7 +42,7 @@ public:
}; };
template<class T> template<class T>
int i2_main(int argc, char **argv) int application_main(int argc, char **argv)
{ {
int result; int result;
@ -64,9 +64,9 @@ int i2_main(int argc, char **argv)
#define SET_START_CLASS(klass) \ #define SET_START_CLASS(klass) \
int main(int argc, char **argv) { \ int main(int argc, char **argv) { \
return i2_main<klass>(argc, argv); \ return application_main<klass>(argc, argv); \
} }
} }
#endif /* I2_APPLICATION_H */ #endif /* APPLICATION_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_COMPONENT_H #ifndef COMPONENT_H
#define I2_COMPONENT_H #define COMPONENT_H
namespace icinga namespace icinga
{ {
@ -33,4 +33,4 @@ public:
} }
#endif /* I2_COMPONENT_H */ #endif /* COMPONENT_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_CONDVAR_H #ifndef CONDVAR_H
#define I2_CONDVAR_H #define CONDVAR_H
namespace icinga namespace icinga
{ {
@ -30,4 +30,4 @@ public:
} }
#endif /* I2_CONDVAR_H */ #endif /* CONDVAR_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_CONFIGHIVE_H #ifndef CONFIGHIVE_H
#define I2_CONFIGHIVE_H #define CONFIGHIVE_H
#include <map> #include <map>
@ -39,4 +39,4 @@ public:
} }
#endif /* I2_CONFIGHIVE_H */ #endif /* CONFIGHIVE_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_CONFIGOBJECT_H #ifndef CONFIGOBJECT_H
#define I2_CONFIGOBJECT_H #define CONFIGOBJECT_H
#include <map> #include <map>
@ -46,4 +46,4 @@ public:
} }
#endif /* I2_CONFIGOBJECT_H */ #endif /* CONFIGOBJECT_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_DELEGATE_H #ifndef DELEGATE_H
#define I2_DELEGATE_H #define DELEGATE_H
#include <list> #include <list>
@ -42,4 +42,4 @@ function<int (TArgs)> bind_weak(int (TObject::*function)(TArgs), shared_ptr<Obje
} }
#endif /* I2_DELEGATE_H */ #endif /* DELEGATE_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_EVENT_H #ifndef EVENT_H
#define I2_EVENT_H #define EVENT_H
namespace icinga namespace icinga
{ {
@ -52,4 +52,4 @@ public:
} }
#endif /* I2_EVENT_H */ #endif /* EVENT_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_FIFO_H #ifndef FIFO_H
#define I2_FIFO_H #define FIFO_H
namespace icinga namespace icinga
{ {
@ -35,4 +35,4 @@ public:
} }
#endif /* I2_FIFO_H */ #endif /* FIFO_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_BASE_H #ifndef I2BASE_H
#define I2_BASE_H #define I2BASE_H
#include <cstdlib> #include <cstdlib>
#include <cstdarg> #include <cstdarg>
@ -53,4 +53,4 @@
#include "application.h" #include "application.h"
#include "component.h" #include "component.h"
#endif /* I2_BASE_H */ #endif /* I2BASE_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_MEMORY_H #ifndef MEMORY_H
#define I2_MEMORY_H #define MEMORY_H
namespace icinga namespace icinga
{ {
@ -21,4 +21,4 @@ public:
} }
#endif /* I2_MEMORY_H */ #endif /* MEMORY_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_MUTEX_H #ifndef MUTEX_H
#define I2_MUTEX_H #define MUTEX_H
namespace icinga namespace icinga
{ {
@ -30,4 +30,4 @@ public:
} }
#endif /* I2_MUTEX_H */ #endif /* MUTEX_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_OBJECT_H #ifndef OBJECT_H
#define I2_OBJECT_H #define OBJECT_H
namespace icinga namespace icinga
{ {
@ -60,4 +60,4 @@ Object::RefType factory(void)
} }
#endif /* I2_OBJECT_H */ #endif /* OBJECT_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_SOCKET_H #ifndef SOCKET_H
#define I2_SOCKET_H #define SOCKET_H
namespace icinga { namespace icinga {
@ -43,4 +43,4 @@ public:
} }
#endif /* I2_SOCKET_H */ #endif /* SOCKET_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_TCPCLIENT_H #ifndef TCPCLIENT_H
#define I2_TCPCLIENT_H #define TCPCLIENT_H
namespace icinga namespace icinga
{ {
@ -34,4 +34,4 @@ public:
} }
#endif /* I2_TCPCLIENT_H */ #endif /* TCPCLIENT_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_TCPSERVER_H #ifndef TCPSERVER_H
#define I2_TCPSERVER_H #define TCPSERVER_H
namespace icinga namespace icinga
{ {
@ -39,4 +39,4 @@ public:
} }
#endif /* I2_TCPSERVER_H */ #endif /* TCPSERVER_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_TCPSOCKET_H #ifndef TCPSOCKET_H
#define I2_TCPSOCKET_H #define TCPSOCKET_H
namespace icinga namespace icinga
{ {
@ -18,4 +18,4 @@ public:
} }
#endif /* I2_TCPSOCKET_H */ #endif /* TCPSOCKET_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_THREAD_H #ifndef THREAD_H
#define I2_THREAD_H #define THREAD_H
namespace icinga namespace icinga
{ {
@ -24,4 +24,4 @@ public:
} }
#endif /* I2_THREAD_H */ #endif /* THREAD_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_TIMER_H #ifndef TIMER_H
#define I2_TIMER_H #define TIMER_H
#include <time.h> #include <time.h>
@ -54,4 +54,4 @@ public:
} }
#endif /* I2_TIMER_H */ #endif /* TIMER_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_UNIX_H #ifndef UNIX_H
#define I2_UNIX_H #define UNIX_H
#include <ltdl.h> #include <ltdl.h>
#include <execinfo.h> #include <execinfo.h>
@ -62,4 +62,4 @@ inline void *GetProcAddress(HMODULE module, const char *function)
return lt_dlsym(module, function); return lt_dlsym(module, function);
} }
#endif /* I2_UNIX_H */ #endif /* UNIX_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_WIN32_H #ifndef WIN32_H
#define I2_WIN32_H #define WIN32_H
#define NOGDI #define NOGDI
#include <windows.h> #include <windows.h>
@ -10,4 +10,4 @@ typedef int socklen_t;
#define I2_EXPORT __declspec(dllexport) #define I2_EXPORT __declspec(dllexport)
#define I2_IMPORT __declspec(dllimport) #define I2_IMPORT __declspec(dllimport)
#endif /* I2_WIN32_H */ #endif /* WIN32_H */

View File

@ -17,8 +17,8 @@ void ConfigFileComponent::Start(void)
FIFO::RefType fifo = new_object<FIFO>(); FIFO::RefType fifo = new_object<FIFO>();
string filename; string filename;
if (!GetConfig()->GetProperty("filename", &filename)) if (!GetConfig()->GetProperty("configFilename", &filename))
throw exception(/*"Missing filename property"*/); throw exception(/*"Missing configFilename property"*/);
fp.open(filename.c_str(), ifstream::in); fp.open(filename.c_str(), ifstream::in);
if (fp.fail()) if (fp.fail())

View File

@ -1,5 +1,5 @@
#ifndef I2_CONFIGFILECOMPONENT_H #ifndef CONFIGFILECOMPONENT_H
#define I2_CONFIGFILECOMPONENT_H #define CONFIGFILECOMPONENT_H
namespace icinga namespace icinga
{ {
@ -17,4 +17,4 @@ public:
} }
#endif /* I2_CONFIGFILECOMPONENT_H */ #endif /* CONFIGFILECOMPONENT_H */

View File

@ -1,8 +1,8 @@
#ifndef I2_I2CONFIGFILECOMPONENT_H #ifndef I2CONFIGFILECOMPONENT_H
#define I2_I2CONFIGFILECOMPONENT_H #define I2CONFIGFILECOMPONENT_H
#include <i2-base.h> #include <i2-base.h>
#include "configfilecomponent.h" #include "configfilecomponent.h"
#endif /* I2_I2CONFIGFILECOMPONENT_H */ #endif /* I2CONFIGFILECOMPONENT_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_CONFIGRPCCOMPONENT_H #ifndef CONFIGRPCCOMPONENT_H
#define I2_CONFIGRPCCOMPONENT_H #define CONFIGRPCCOMPONENT_H
namespace icinga namespace icinga
{ {
@ -29,4 +29,4 @@ public:
} }
#endif /* I2_CONFIGRPCCOMPONENT_H */ #endif /* CONFIGRPCCOMPONENT_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_I2CONFIGCOMPONENT_H #ifndef I2CONFIGCOMPONENT_H
#define I2_I2CONFIGCOMPONENT_H #define I2CONFIGCOMPONENT_H
#include <i2-base.h> #include <i2-base.h>
#include <i2-jsonrpc.h> #include <i2-jsonrpc.h>
@ -7,4 +7,4 @@
#include "configrpccomponent.h" #include "configrpccomponent.h"
#endif /* I2_I2CONFIGCOMPONENT_H */ #endif /* I2CONFIGCOMPONENT_H */

View File

@ -1,9 +1,9 @@
#ifndef I2_ICINGA_H #ifndef I2ICINGA_H
#define I2_ICINGA_H #define I2ICINGA_H
#include <i2-base.h> #include <i2-base.h>
#include <i2-jsonrpc.h> #include <i2-jsonrpc.h>
#include "icingaapplication.h" #include "icingaapplication.h"
#endif /* I2_ICINGA_H */ #endif /* I2ICINGA_H */

View File

@ -31,8 +31,7 @@ int IcingaApplication::Main(const vector<string>& args)
ConfigObject::RefType fileComponentConfig = new_object<ConfigObject>(); ConfigObject::RefType fileComponentConfig = new_object<ConfigObject>();
fileComponentConfig->SetName("configfilecomponent"); fileComponentConfig->SetName("configfilecomponent");
fileComponentConfig->SetType("component"); fileComponentConfig->SetType("component");
fileComponentConfig->SetProperty("path", "libconfigfilecomponent.la"); fileComponentConfig->SetProperty("configFilename", "icinga.conf");
fileComponentConfig->SetProperty("filename", "icinga.conf");
GetConfigHive()->AddObject(fileComponentConfig); GetConfigHive()->AddObject(fileComponentConfig);
RunEventLoop(); RunEventLoop();
@ -50,8 +49,15 @@ int IcingaApplication::ConfigObjectCreatedHandler(ConfigHiveEventArgs::RefType e
if (ea->Object->GetType() == "component") { if (ea->Object->GetType() == "component") {
string path; string path;
if (!ea->Object->GetProperty("path", &path)) if (!ea->Object->GetProperty("path", &path)) {
throw exception(/*"Missing path property"*/); #ifdef _WIN32
path = ea->Object->GetName() + ".dll";
#else /* _WIN32 */
path = "lib" + ea->Object->GetName() + ".la";
#endif /* _WIN32 */
// TODO: try to figure out where the component is located */
}
LoadComponent(path, ea->Object); LoadComponent(path, ea->Object);
} }

View File

@ -1,5 +1,5 @@
#ifndef I2_ICINGAAPPLICATION_H #ifndef ICINGAAPPLICATION_H
#define I2_ICINGAAPPLICATION_H #define ICINGAAPPLICATION_H
namespace icinga namespace icinga
{ {
@ -25,4 +25,4 @@ public:
} }
#endif /* I2_ICINGAAPPLICATION_H */ #endif /* ICINGAAPPLICATION_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_CONNECTIONMANAGER_H #ifndef CONNECTIONMANAGER_H
#define I2_CONNECTIONMANAGER_H #define CONNECTIONMANAGER_H
namespace icinga namespace icinga
{ {
@ -34,4 +34,4 @@ public:
} }
#endif /* I2_CONNECTIONMANAGER_H */ #endif /* CONNECTIONMANAGER_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_JSONRPC_H #ifndef I2JSONRPC_H
#define I2_JSONRPC_H #define I2JSONRPC_H
#include <map> #include <map>
#include <i2-base.h> #include <i2-base.h>
@ -11,4 +11,4 @@
#include "jsonrpcserver.h" #include "jsonrpcserver.h"
#include "connectionmanager.h" #include "connectionmanager.h"
#endif /* I2_JSONRPC_H */ #endif /* I2JSONRPC_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_JSONRPCCLIENT_H #ifndef JSONRPCCLIENT_H
#define I2_JSONRPCCLIENT_H #define JSONRPCCLIENT_H
namespace icinga namespace icinga
{ {
@ -30,4 +30,4 @@ public:
} }
#endif /* I2_JSONRPCCLIENT_H */ #endif /* JSONRPCCLIENT_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_JSONRPCMESSAGE_H #ifndef JSONRPCMESSAGE_H
#define I2_JSONRPCMESSAGE_H #define JSONRPCMESSAGE_H
namespace icinga namespace icinga
{ {
@ -53,4 +53,4 @@ public:
} }
#endif /* I2_JSONRPCMESSAGE_H */ #endif /* JSONRPCMESSAGE_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_JSONRPCSERVER_H #ifndef JSONRPCSERVER_H
#define I2_JSONRPCSERVER_H #define JSONRPCSERVER_H
namespace icinga namespace icinga
{ {
@ -15,4 +15,4 @@ public:
} }
#endif /* I2_JSONRPCSERVER_H */ #endif /* JSONRPCSERVER_H */

View File

@ -1,5 +1,5 @@
#ifndef I2_NETSTRING_H #ifndef NETSTRING_H
#define I2_NETSTRING_H #define NETSTRING_H
namespace icinga namespace icinga
{ {
@ -20,4 +20,4 @@ public:
} }
#endif /* I2_NETSTRING_H */ #endif /* NETSTRING_H */