summaryrefslogtreecommitdiffstats
path: root/src/Core
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-08-18 15:58:17 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-08-18 15:58:17 +0200
commitdb5ad2e09a6b38e841463dbe7eb076492b62c948 (patch)
tree5907f6416e35cbd25432a5f1f6dc9664d36aa73c /src/Core
parent5da7b0847bac2a5abec95b9ac1701b74baae8964 (diff)
downloadmad-db5ad2e09a6b38e841463dbe7eb076492b62c948.tar
mad-db5ad2e09a6b38e841463dbe7eb076492b62c948.zip
Mad funktioniert jetzt unter Windows
Diffstat (limited to 'src/Core')
-rw-r--r--src/Core/Application.cpp16
-rw-r--r--src/Core/Application.h10
-rw-r--r--src/Core/CMakeLists.txt4
-rw-r--r--src/Core/ConfigEntry.h10
-rw-r--r--src/Core/ConfigManager.cpp6
-rw-r--r--src/Core/ConfigManager.h6
-rw-r--r--src/Core/Configurable.h2
-rw-r--r--src/Core/Exception.h4
-rw-r--r--src/Core/LogManager.cpp18
-rw-r--r--src/Core/LogManager.h20
-rw-r--r--src/Core/Logger.h6
-rw-r--r--src/Core/LoggerBase.h8
-rw-r--r--src/Core/RemoteLogger.h6
-rw-r--r--src/Core/Signals/Connection.h4
-rw-r--r--src/Core/Signals/GenericSignal.h4
-rw-r--r--src/Core/Signals/Signal0.h2
-rw-r--r--src/Core/Signals/Signal1.h2
-rw-r--r--src/Core/Signals/Signal2.h2
-rw-r--r--src/Core/Signals/SignalBase.h2
-rw-r--r--src/Core/ThreadManager.h4
-rw-r--r--src/Core/Tokenizer.h4
-rw-r--r--src/Core/export.h11
22 files changed, 102 insertions, 49 deletions
diff --git a/src/Core/Application.cpp b/src/Core/Application.cpp
index 5ef1bae..7083be5 100644
--- a/src/Core/Application.cpp
+++ b/src/Core/Application.cpp
@@ -24,6 +24,10 @@
#include <cstdlib>
+#ifndef va_copy
+# define va_copy(d, s) (d) = (s)
+#endif
+
namespace Mad {
namespace Core {
@@ -45,11 +49,11 @@ void Application::logfv(LoggerBase::MessageCategory category, LoggerBase::Messag
va_list ap2;
va_copy(ap2, ap);
- int n = std::vsnprintf(buf, size, format, ap2);
+ int n = vsnprintf(buf, size, format, ap2);
va_end(ap2);
if(n > -1 && n < size) {
- logManager->log(category, level, std::time(0), buf);
+ logManager->log(category, level, boost::posix_time::microsec_clock::universal_time(), buf);
std::free(buf);
return;
}
@@ -65,7 +69,7 @@ void Application::logfv(LoggerBase::MessageCategory category, LoggerBase::Messag
}
void Application::log(LoggerBase::MessageCategory category, LoggerBase::MessageLevel level, const std::string &message) {
- logManager->log(category, level, std::time(0), message);
+ logManager->log(category, level, boost::posix_time::microsec_clock::universal_time(), message);
}
void Application::logf(LoggerBase::MessageCategory category, LoggerBase::MessageLevel level, const char *format, ...) {
@@ -78,21 +82,21 @@ void Application::logf(LoggerBase::MessageCategory category, LoggerBase::Message
void Application::logf(LoggerBase::MessageCategory category, const char *format, ...) {
va_list ap;
va_start(ap, format);
- logfv(category, LoggerBase::DEFAULT, format, ap);
+ logfv(category, LoggerBase::LOG_DEFAULT, format, ap);
va_end(ap);
}
void Application::logf(LoggerBase::MessageLevel level, const char *format, ...) {
va_list ap;
va_start(ap, format);
- logfv(LoggerBase::GENERAL, level, format, ap);
+ logfv(LoggerBase::LOG_GENERAL, level, format, ap);
va_end(ap);
}
void Application::logf(const char *format, ...) {
va_list ap;
va_start(ap, format);
- logfv(LoggerBase::GENERAL, LoggerBase::DEFAULT, format, ap);
+ logfv(LoggerBase::LOG_GENERAL, LoggerBase::LOG_DEFAULT, format, ap);
va_end(ap);
}
diff --git a/src/Core/Application.h b/src/Core/Application.h
index fece1cf..3951b5c 100644
--- a/src/Core/Application.h
+++ b/src/Core/Application.h
@@ -20,6 +20,8 @@
#ifndef MAD_CORE_APPLICATION_H_
#define MAD_CORE_APPLICATION_H_
+#include "export.h"
+
#include "LoggerBase.h"
#include <cstdarg>
@@ -35,7 +37,7 @@ class ConfigManager;
class LogManager;
class ThreadManager;
-class Application : private boost::noncopyable {
+class MAD_CORE_EXPORT Application : private boost::noncopyable {
private:
boost::asio::io_service ioService;
@@ -70,15 +72,15 @@ class Application : private boost::noncopyable {
void log(LoggerBase::MessageCategory category, LoggerBase::MessageLevel level, const std::string &message);
void log(LoggerBase::MessageCategory category, const std::string &message) {
- log(category, LoggerBase::DEFAULT, message);
+ log(category, LoggerBase::LOG_DEFAULT, message);
}
void log(LoggerBase::MessageLevel level, const std::string &message) {
- log(LoggerBase::GENERAL, level, message);
+ log(LoggerBase::LOG_GENERAL, level, message);
}
void log(const std::string &message) {
- log(LoggerBase::GENERAL, LoggerBase::DEFAULT, message);
+ log(LoggerBase::LOG_GENERAL, LoggerBase::LOG_DEFAULT, message);
}
diff --git a/src/Core/CMakeLists.txt b/src/Core/CMakeLists.txt
index 3c0db7a..28c0dd5 100644
--- a/src/Core/CMakeLists.txt
+++ b/src/Core/CMakeLists.txt
@@ -1,7 +1,9 @@
include_directories(${INCLUDES})
link_directories(${Boost_LIBRARY_DIRS})
-add_library(Core STATIC
+mad_library(Core
+ export.h
+
Signals/Connection.h
Signals/GenericSignal.h
Signals/Signal0.h
diff --git a/src/Core/ConfigEntry.h b/src/Core/ConfigEntry.h
index c3bcd1d..fcd8dd4 100644
--- a/src/Core/ConfigEntry.h
+++ b/src/Core/ConfigEntry.h
@@ -20,15 +20,19 @@
#ifndef MAD_CORE_CONFIGENTRY_H_
#define MAD_CORE_CONFIGENTRY_H_
+#include "export.h"
+
#include <stdexcept>
#include <string>
#include <string.h>
#include <vector>
+#include <boost/algorithm/string/case_conv.hpp>
+
namespace Mad {
namespace Core {
-class ConfigEntry {
+class MAD_CORE_EXPORT ConfigEntry {
public:
class String : public std::string {
public:
@@ -36,11 +40,11 @@ class ConfigEntry {
String(const std::string &str) : std::string(str) {}
bool matches(const std::string &str) const {
- return (strcasecmp(c_str(), str.c_str()) == 0);
+ return (boost::algorithm::to_lower_copy(static_cast<const std::string&>(*this)) == boost::algorithm::to_lower_copy(str));
}
};
- class Entry {
+ class MAD_CORE_EXPORT Entry {
private:
String key;
std::vector<String> value;
diff --git a/src/Core/ConfigManager.cpp b/src/Core/ConfigManager.cpp
index eb9b846..83e92db 100644
--- a/src/Core/ConfigManager.cpp
+++ b/src/Core/ConfigManager.cpp
@@ -40,13 +40,13 @@ bool ConfigManager::Compare::operator() (const Configurable *c1, const Configura
void ConfigManager::handleConfigEntry(const ConfigEntry &entry) {
bool handled = false;
- for(std::set<Configurable*>::iterator c = configurables.begin(); c != configurables.end(); ++c) {
+ for(std::set<Configurable*, Compare>::iterator c = configurables.begin(); c != configurables.end(); ++c) {
if((*c)->handleConfigEntry(entry, handled))
handled = true;
}
if(!handled)
- application->logf(LoggerBase::WARNING, "Invalid config option '%s'.", entry[entry.getSize()-1].getKey().c_str());
+ application->logf(LoggerBase::LOG_WARNING, "Invalid config option '%s'.", entry[entry.getSize()-1].getKey().c_str());
}
bool ConfigManager::loadFile(const std::string &filename) {
@@ -119,7 +119,7 @@ void ConfigManager::finish() {
if(finished)
return;
- for(std::set<Configurable*>::iterator c = configurables.begin(); c != configurables.end(); ++c)
+ for(std::set<Configurable*, Compare>::iterator c = configurables.begin(); c != configurables.end(); ++c)
(*c)->configFinished();
finished = true;
diff --git a/src/Core/ConfigManager.h b/src/Core/ConfigManager.h
index f0e25d3..10b378d 100644
--- a/src/Core/ConfigManager.h
+++ b/src/Core/ConfigManager.h
@@ -20,6 +20,8 @@
#ifndef MAD_CORE_CONFIGMANAGER_H_
#define MAD_CORE_CONFIGMANAGER_H_
+#include "export.h"
+
#include <memory>
#include <set>
#include <string>
@@ -31,9 +33,9 @@ class Application;
class ConfigEntry;
class Configurable;
-class ConfigManager {
+class MAD_CORE_EXPORT ConfigManager {
private:
- struct Compare {
+ struct MAD_CORE_EXPORT Compare {
bool operator() (const Configurable *c1, const Configurable *c2);
};
diff --git a/src/Core/Configurable.h b/src/Core/Configurable.h
index c526379..f385e10 100644
--- a/src/Core/Configurable.h
+++ b/src/Core/Configurable.h
@@ -20,6 +20,8 @@
#ifndef MAD_CORE_CONFIGURABLE_H_
#define MAD_CORE_CONFIGURABLE_H_
+#include "export.h"
+
namespace Mad {
namespace Core {
diff --git a/src/Core/Exception.h b/src/Core/Exception.h
index 1824ff6..15ff749 100644
--- a/src/Core/Exception.h
+++ b/src/Core/Exception.h
@@ -20,12 +20,14 @@
#ifndef MAD_CORE_EXCEPTION_H_
#define MAD_CORE_EXCEPTION_H_
+#include "export.h"
+
#include <string>
namespace Mad {
namespace Core {
-class Exception {
+class MAD_CORE_EXPORT Exception {
public:
enum ErrorCode {
SUCCESS = 0x0000, UNEXPECTED_PACKET = 0x0001, INVALID_ACTION = 0x0002, NOT_AVAILABLE = 0x0003, NOT_FINISHED = 0x0004, NOT_IMPLEMENTED = 0x0005,
diff --git a/src/Core/LogManager.cpp b/src/Core/LogManager.cpp
index d5928f9..b255c04 100644
--- a/src/Core/LogManager.cpp
+++ b/src/Core/LogManager.cpp
@@ -27,21 +27,21 @@
namespace Mad {
namespace Core {
-void LogManager::ConsoleLogger::logMessage(MessageCategory /*category*/, MessageLevel level, time_t /*timestamp*/, const std::string &message) {
- if(level != CRITICAL) {// Critical messages are printed to cerr directly, so don't print them a second time
+void LogManager::ConsoleLogger::logMessage(MessageCategory /*category*/, MessageLevel level, boost::posix_time::ptime /*timestamp*/, const std::string &message) {
+ if(level != LOG_CRITICAL) {// Critical messages are printed to cerr directly, so don't print them a second time
cerrLock.lock();
std::cerr << message << std::endl;
cerrLock.unlock();
}
}
-void LogManager::ConsoleLogger::logMessage(MessageCategory /*category*/, MessageLevel /*level*/, time_t /*timestamp*/, const std::string &message, const std::string &messageSource) {
+void LogManager::ConsoleLogger::logMessage(MessageCategory /*category*/, MessageLevel /*level*/, boost::posix_time::ptime /*timestamp*/, const std::string &message, const std::string &messageSource) {
cerrLock.lock();
std::cerr << message << " from " << messageSource << std::endl;
cerrLock.unlock();
}
-void LogManager::ConsoleLogger::logMessageDirect(MessageCategory /*category*/, MessageLevel /*level*/, time_t /*timestamp*/, const std::string &message) {
+void LogManager::ConsoleLogger::logMessageDirect(MessageCategory /*category*/, MessageLevel /*level*/, boost::posix_time::ptime /*timestamp*/, const std::string &message) {
cerrLock.lock();
std::cerr << message << std::endl;
cerrLock.unlock();
@@ -69,7 +69,7 @@ bool LogManager::handleConfigEntry(const ConfigEntry &entry, bool handled) {
}
}
else if(entry[1].empty()) {
- application->logf(Logger::WARNING, "Unknown logger '%s'.", entry[0][0].c_str());
+ application->logf(Logger::LOG_WARNING, "Unknown logger '%s'.", entry[0][0].c_str());
return true;
}
}
@@ -82,7 +82,7 @@ void LogManager::configFinished() {
registerLogger(boost::static_pointer_cast<Logger>(consoleLogger));
// TODO Debug
- consoleLogger->Logger::setLevel(LoggerBase::VERBOSE);
+ consoleLogger->Logger::setLevel(LoggerBase::LOG_VERBOSE);
queueLock.lock();
configured = true;
@@ -90,8 +90,8 @@ void LogManager::configFinished() {
queueCond.notify_one();
}
-void LogManager::log(MessageCategory category, MessageLevel level, time_t timestamp, const std::string &message) {
- if(level == LoggerBase::CRITICAL)
+void LogManager::log(MessageCategory category, MessageLevel level, boost::posix_time::ptime timestamp, const std::string &message) {
+ if(level == LoggerBase::LOG_CRITICAL)
consoleLogger->logMessageDirect(category, level, timestamp, message);
queueLock.lock();
@@ -101,7 +101,7 @@ void LogManager::log(MessageCategory category, MessageLevel level, time_t timest
queueCond.notify_one();
}
-void LogManager::log(MessageCategory category, MessageLevel level, time_t timestamp, const std::string &message, const std::string &source) {
+void LogManager::log(MessageCategory category, MessageLevel level, boost::posix_time::ptime timestamp, const std::string &message, const std::string &source) {
queueLock.lock();
RemoteMessage m = {category, level, timestamp, message, source};
remoteMessageQueue.push(m);
diff --git a/src/Core/LogManager.h b/src/Core/LogManager.h
index d3233f0..3aab49e 100644
--- a/src/Core/LogManager.h
+++ b/src/Core/LogManager.h
@@ -20,6 +20,8 @@
#ifndef MAD_CORE_LOGMANAGER_H_
#define MAD_CORE_LOGMANAGER_H_
+#include "export.h"
+
#include "Configurable.h"
#include "Logger.h"
#include "RemoteLogger.h"
@@ -36,7 +38,7 @@ namespace Core {
class Application;
class ThreadManager;
-class LogManager : public Configurable {
+class MAD_CORE_EXPORT LogManager : public Configurable {
private:
friend class Application;
friend class ThreadManager;
@@ -47,14 +49,14 @@ class LogManager : public Configurable {
struct Message {
MessageCategory category;
MessageLevel level;
- time_t timestamp;
+ boost::posix_time::ptime timestamp;
std::string message;
};
struct RemoteMessage {
MessageCategory category;
MessageLevel level;
- time_t timestamp;
+ boost::posix_time::ptime timestamp;
std::string message;
std::string source;
};
@@ -62,17 +64,17 @@ class LogManager : public Configurable {
class ConsoleLogger : public Logger, public RemoteLogger {
private:
// For long messages, writing to cerr is not atomic
- // -> lock cerr to prevent mixing messages up
+ // -> lock cerr to prevent messages mixing up
boost::mutex cerrLock;
protected:
- virtual void logMessage(MessageCategory category, MessageLevel level, time_t timestamp, const std::string &message);
- virtual void logMessage(MessageCategory category, MessageLevel, time_t timestamp, const std::string &message, const std::string &messageSource);
+ virtual void logMessage(MessageCategory category, MessageLevel level, boost::posix_time::ptime timestamp, const std::string &message);
+ virtual void logMessage(MessageCategory category, MessageLevel, boost::posix_time::ptime timestamp, const std::string &message, const std::string &messageSource);
public:
ConsoleLogger() {}
- void logMessageDirect(MessageCategory category, MessageLevel level, time_t timestamp, const std::string &message);
+ void logMessageDirect(MessageCategory category, MessageLevel level, boost::posix_time::ptime timestamp, const std::string &message);
};
@@ -109,8 +111,8 @@ class LogManager : public Configurable {
virtual void configFinished();
public:
- void log(MessageCategory category, MessageLevel level, time_t timestamp, const std::string &message);
- void log(MessageCategory category, MessageLevel level, time_t timestamp, const std::string &message, const std::string &source);
+ void log(MessageCategory category, MessageLevel level, boost::posix_time::ptime timestamp, const std::string &message);
+ void log(MessageCategory category, MessageLevel level, boost::posix_time::ptime timestamp, const std::string &message, const std::string &source);
void registerLogger(boost::shared_ptr<Logger> logger) {
loggerLock.lock();
diff --git a/src/Core/Logger.h b/src/Core/Logger.h
index b5a6b43..53ec665 100644
--- a/src/Core/Logger.h
+++ b/src/Core/Logger.h
@@ -20,10 +20,12 @@
#ifndef MAD_CORE_LOGGER_H_
#define MAD_CORE_LOGGER_H_
+#include "export.h"
+
#include "LoggerBase.h"
-#include <ctime>
#include <string>
+#include <boost/date_time/posix_time/ptime.hpp>
namespace Mad {
namespace Core {
@@ -34,7 +36,7 @@ class Logger : public LoggerBase {
protected:
friend class LogManager;
- virtual void logMessage(MessageCategory category, MessageLevel level, time_t timestamp, const std::string &message) = 0;
+ virtual void logMessage(MessageCategory category, MessageLevel level, boost::posix_time::ptime timestamp, const std::string &message) = 0;
};
diff --git a/src/Core/LoggerBase.h b/src/Core/LoggerBase.h
index 50f08b3..a2df969 100644
--- a/src/Core/LoggerBase.h
+++ b/src/Core/LoggerBase.h
@@ -20,6 +20,8 @@
#ifndef MAD_CORE_LOGGERBASE_H_
#define MAD_CORE_LOGGERBASE_H_
+#include "export.h"
+
#include <bitset>
#include <list>
@@ -29,18 +31,18 @@ namespace Core {
class LoggerBase {
public:
enum MessageLevel {
- CRITICAL, ERROR, WARNING, DEFAULT, VERBOSE, DEBUG
+ LOG_CRITICAL, LOG_ERROR, LOG_WARNING, LOG_DEFAULT, LOG_VERBOSE, LOG_DEBUG
};
enum MessageCategory {
- SYSTEM, NETWORK, DAEMON, USER, DISK, PROGRAM, GENERAL
+ LOG_SYSTEM, LOG_NETWORK, LOG_DAEMON, LOG_USER, LOG_DISK, LOG_PROGRAM, LOG_GENERAL
};
protected:
std::bitset<16> categories;
MessageLevel level;
- LoggerBase() : level(DEFAULT) {setAllCategories();}
+ LoggerBase() : level(LOG_DEFAULT) {setAllCategories();}
virtual ~LoggerBase() {}
public:
diff --git a/src/Core/RemoteLogger.h b/src/Core/RemoteLogger.h
index 0507567..8dedb7a 100644
--- a/src/Core/RemoteLogger.h
+++ b/src/Core/RemoteLogger.h
@@ -20,10 +20,12 @@
#ifndef MAD_CORE_REMOTELOGGER_H_
#define MAD_CORE_REMOTELOGGER_H_
+#include "export.h"
+
#include "LoggerBase.h"
-#include <ctime>
#include <string>
+#include <boost/date_time/posix_time/ptime.hpp>
namespace Mad {
namespace Core {
@@ -34,7 +36,7 @@ class RemoteLogger : public LoggerBase {
protected:
friend class LogManager;
- virtual void logMessage(MessageCategory category, MessageLevel level, time_t messageTimestamp, const std::string &message, const std::string &messageSource) = 0;
+ virtual void logMessage(MessageCategory category, MessageLevel level, boost::posix_time::ptime messageTimestamp, const std::string &message, const std::string &messageSource) = 0;
};
}
diff --git a/src/Core/Signals/Connection.h b/src/Core/Signals/Connection.h
index 8a99058..fde959d 100644
--- a/src/Core/Signals/Connection.h
+++ b/src/Core/Signals/Connection.h
@@ -20,13 +20,15 @@
#ifndef MAD_CORE_SIGNALS_CONNECTION_H_
#define MAD_CORE_SIGNALS_CONNECTION_H_
+#include "../export.h"
+
namespace Mad {
namespace Core {
namespace Signals {
class SignalBase;
-class Connection {
+class MAD_CORE_EXPORT Connection {
private:
friend class SignalBase;
diff --git a/src/Core/Signals/GenericSignal.h b/src/Core/Signals/GenericSignal.h
index 2203181..4f783e3 100644
--- a/src/Core/Signals/GenericSignal.h
+++ b/src/Core/Signals/GenericSignal.h
@@ -20,6 +20,8 @@
#ifndef MAD_CORE_SIGNALS_GENERICSIGNAL_H_
#define MAD_CORE_SIGNALS_GENERICSIGNAL_H_
+#include "../export.h"
+
#include "SignalBase.h"
#include <map>
@@ -30,7 +32,7 @@ namespace Core {
namespace Signals {
template <typename FunctionType>
-class GenericSignal : protected SignalBase {
+class MAD_CORE_EXPORT GenericSignal : protected SignalBase {
public:
typedef FunctionType slot_type;
diff --git a/src/Core/Signals/Signal0.h b/src/Core/Signals/Signal0.h
index d751df2..ca1ceed 100644
--- a/src/Core/Signals/Signal0.h
+++ b/src/Core/Signals/Signal0.h
@@ -20,6 +20,8 @@
#ifndef MAD_CORE_SIGNALS_SIGNAL0_H_
#define MAD_CORE_SIGNALS_SIGNAL0_H_
+#include "../export.h"
+
#include "GenericSignal.h"
#include "../Application.h"
#include "../ThreadManager.h"
diff --git a/src/Core/Signals/Signal1.h b/src/Core/Signals/Signal1.h
index 69d7685..2d8acb7 100644
--- a/src/Core/Signals/Signal1.h
+++ b/src/Core/Signals/Signal1.h
@@ -20,6 +20,8 @@
#ifndef MAD_CORE_SIGNALS_SIGNAL1_H_
#define MAD_CORE_SIGNALS_SIGNAL1_H_
+#include "../export.h"
+
#include "GenericSignal.h"
#include "../Application.h"
#include "../ThreadManager.h"
diff --git a/src/Core/Signals/Signal2.h b/src/Core/Signals/Signal2.h
index bab7f5c..e9ed010 100644
--- a/src/Core/Signals/Signal2.h
+++ b/src/Core/Signals/Signal2.h
@@ -20,6 +20,8 @@
#ifndef MAD_CORE_SIGNALS_SIGNAL2_H_
#define MAD_CORE_SIGNALS_SIGNAL2_H_
+#include "../export.h"
+
#include "GenericSignal.h"
#include "../Application.h"
#include "../ThreadManager.h"
diff --git a/src/Core/Signals/SignalBase.h b/src/Core/Signals/SignalBase.h
index 6599285..cf38053 100644
--- a/src/Core/Signals/SignalBase.h
+++ b/src/Core/Signals/SignalBase.h
@@ -20,6 +20,8 @@
#ifndef MAD_CORE_SIGNALS_SIGNALBASE_H_
#define MAD_CORE_SIGNALS_SIGNALBASE_H_
+#include "../export.h"
+
#include "Connection.h"
#include <set>
diff --git a/src/Core/ThreadManager.h b/src/Core/ThreadManager.h
index ab5113c..9cae13c 100644
--- a/src/Core/ThreadManager.h
+++ b/src/Core/ThreadManager.h
@@ -20,6 +20,8 @@
#ifndef MAD_CORE_THREADMANAGER_H_
#define MAD_CORE_THREADMANAGER_H_
+#include "export.h"
+
#include <queue>
#include <map>
@@ -34,7 +36,7 @@ namespace Core {
class Application;
-class ThreadManager : private boost::noncopyable {
+class MAD_CORE_EXPORT ThreadManager : private boost::noncopyable {
private:
friend class Application;
diff --git a/src/Core/Tokenizer.h b/src/Core/Tokenizer.h
index fef04db..637aa05 100644
--- a/src/Core/Tokenizer.h
+++ b/src/Core/Tokenizer.h
@@ -20,13 +20,15 @@
#ifndef MAD_CORE_TOKENIZER_H_
#define MAD_CORE_TOKENIZER_H_
+#include "export.h"
+
#include <string>
#include <vector>
namespace Mad {
namespace Core {
-class Tokenizer {
+class MAD_CORE_EXPORT Tokenizer {
private:
static const std::string delimiters;
diff --git a/src/Core/export.h b/src/Core/export.h
new file mode 100644
index 0000000..2ccd147
--- /dev/null
+++ b/src/Core/export.h
@@ -0,0 +1,11 @@
+#ifndef MAD_CORE_EXPORT
+# ifdef _WIN32
+# ifdef MAD_CORE_EXPORTS
+# define MAD_CORE_EXPORT _declspec(dllexport)
+# else
+# define MAD_CORE_EXPORT _declspec(dllimport)
+# endif
+# else
+# define MAD_CORE_EXPORT
+# endif
+#endif