summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-07-14 08:13:57 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-07-14 13:08:36 (GMT)
commit003381f417caaae9918cd81fa53bcc0547caa4c9 (patch)
treec0571987e87a115e5a7ad03eca55db972f6686c6 /Swiften/Base
parent075c1f08245055e0060df2695e75bba54e697d36 (diff)
downloadswift-003381f417caaae9918cd81fa53bcc0547caa4c9.zip
swift-003381f417caaae9918cd81fa53bcc0547caa4c9.tar.bz2
Initial DLL support for Swiften.
All applications succesfully link against Swiften.dll.
Diffstat (limited to 'Swiften/Base')
-rw-r--r--Swiften/Base/API.h23
-rw-r--r--Swiften/Base/ByteArray.h10
-rw-r--r--Swiften/Base/Error.h4
-rw-r--r--Swiften/Base/IDGenerator.h4
-rw-r--r--Swiften/Base/Log.h4
-rw-r--r--Swiften/Base/Paths.h4
-rw-r--r--Swiften/Base/SafeByteArray.h3
-rw-r--r--Swiften/Base/String.h12
-rw-r--r--Swiften/Base/sleep.h4
9 files changed, 53 insertions, 15 deletions
diff --git a/Swiften/Base/API.h b/Swiften/Base/API.h
new file mode 100644
index 0000000..8f19446
--- /dev/null
+++ b/Swiften/Base/API.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2012 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Base/Platform.h>
+
+#ifdef SWIFTEN_STATIC
+# define SWIFTEN_API
+#else
+# ifdef SWIFTEN_PLATFORM_WINDOWS
+# ifdef SWIFTEN_BUILDING
+# define SWIFTEN_API __declspec(dllexport)
+# else
+# define SWIFTEN_API __declspec(dllimport)
+# endif
+# else
+# define SWIFTEN_API
+# endif
+#endif
diff --git a/Swiften/Base/ByteArray.h b/Swiften/Base/ByteArray.h
index 01cd5d0..34b89d3 100644
--- a/Swiften/Base/ByteArray.h
+++ b/Swiften/Base/ByteArray.h
@@ -9,11 +9,13 @@
#include <vector>
#include <string>
+#include <Swiften/Base/API.h>
+
namespace Swift {
typedef std::vector<unsigned char> ByteArray;
- ByteArray createByteArray(const std::string& s);
- ByteArray createByteArray(const char* c);
+ SWIFTEN_API ByteArray createByteArray(const std::string& s);
+ SWIFTEN_API ByteArray createByteArray(const char* c);
inline ByteArray createByteArray(const unsigned char* c, size_t n) {
return ByteArray(c, c + n);
@@ -37,8 +39,8 @@ namespace Swift {
return v.empty() ? NULL : &v[0];
}
- std::string byteArrayToString(const ByteArray& b);
+ SWIFTEN_API std::string byteArrayToString(const ByteArray& b);
- void readByteArrayFromFile(ByteArray&, const std::string& file);
+ SWIFTEN_API void readByteArrayFromFile(ByteArray&, const std::string& file);
}
diff --git a/Swiften/Base/Error.h b/Swiften/Base/Error.h
index e99f175..906c1d9 100644
--- a/Swiften/Base/Error.h
+++ b/Swiften/Base/Error.h
@@ -6,8 +6,10 @@
#pragma once
+#include <Swiften/Base/API.h>
+
namespace Swift {
- class Error {
+ class SWIFTEN_API Error {
public:
virtual ~Error();
};
diff --git a/Swiften/Base/IDGenerator.h b/Swiften/Base/IDGenerator.h
index 44eeb76..14ecfdc 100644
--- a/Swiften/Base/IDGenerator.h
+++ b/Swiften/Base/IDGenerator.h
@@ -8,8 +8,10 @@
#include <string>
+#include <Swiften/Base/API.h>
+
namespace Swift {
- class IDGenerator {
+ class SWIFTEN_API IDGenerator {
public:
IDGenerator();
diff --git a/Swiften/Base/Log.h b/Swiften/Base/Log.h
index 06f5b55..6d76dc6 100644
--- a/Swiften/Base/Log.h
+++ b/Swiften/Base/Log.h
@@ -8,8 +8,10 @@
#include <iostream>
+#include <Swiften/Base/API.h>
+
namespace Swift {
- extern bool logging;
+ extern SWIFTEN_API bool logging;
namespace LogDetail {
// Only here to be able to statically check the correctness of the severity levers
namespace Severity {
diff --git a/Swiften/Base/Paths.h b/Swiften/Base/Paths.h
index 8ac4640..94e62d1 100644
--- a/Swiften/Base/Paths.h
+++ b/Swiften/Base/Paths.h
@@ -8,8 +8,10 @@
#include <boost/filesystem/path.hpp>
+#include <Swiften/Base/API.h>
+
namespace Swift {
- class Paths {
+ class SWIFTEN_API Paths {
public:
static boost::filesystem::path getExecutablePath();
};
diff --git a/Swiften/Base/SafeByteArray.h b/Swiften/Base/SafeByteArray.h
index 1ef1d84..dda51fe 100644
--- a/Swiften/Base/SafeByteArray.h
+++ b/Swiften/Base/SafeByteArray.h
@@ -8,6 +8,7 @@
#include <vector>
+#include <Swiften/Base/API.h>
#include <Swiften/Base/SafeAllocator.h>
#include <Swiften/Base/ByteArray.h>
#include <boost/smart_ptr/make_shared.hpp>
@@ -19,7 +20,7 @@ namespace Swift {
return SafeByteArray(a.begin(), a.end());
}
- SafeByteArray createSafeByteArray(const char* c);
+ SWIFTEN_API SafeByteArray createSafeByteArray(const char* c);
inline SafeByteArray createSafeByteArray(const std::string& s) {
return SafeByteArray(s.begin(), s.end());
diff --git a/Swiften/Base/String.h b/Swiften/Base/String.h
index db6c28b..26cc3f4 100644
--- a/Swiften/Base/String.h
+++ b/Swiften/Base/String.h
@@ -10,15 +10,17 @@
#include <vector>
#include <sstream>
+#include <Swiften/Base/API.h>
+
#define SWIFTEN_STRING_TO_CFSTRING(a) \
CFStringCreateWithBytes(NULL, reinterpret_cast<const UInt8*>(a.c_str()), a.size(), kCFStringEncodingUTF8, false)
namespace Swift {
namespace String {
- std::vector<unsigned int> getUnicodeCodePoints(const std::string&);
- std::pair<std::string, std::string> getSplittedAtFirst(const std::string&, char c);
- std::vector<std::string> split(const std::string&, char c);
- void replaceAll(std::string&, char c, const std::string& s);
+ SWIFTEN_API std::vector<unsigned int> getUnicodeCodePoints(const std::string&);
+ SWIFTEN_API std::pair<std::string, std::string> getSplittedAtFirst(const std::string&, char c);
+ SWIFTEN_API std::vector<std::string> split(const std::string&, char c);
+ SWIFTEN_API void replaceAll(std::string&, char c, const std::string& s);
inline bool beginsWith(const std::string& s, char c) {
return s.size() > 0 && s[0] == c;
@@ -29,7 +31,7 @@ namespace Swift {
}
};
- class makeString {
+ class SWIFTEN_API makeString {
public:
template <typename T> makeString& operator<<(T const& v) {
stream << v;
diff --git a/Swiften/Base/sleep.h b/Swiften/Base/sleep.h
index a95e907..afcf6c7 100644
--- a/Swiften/Base/sleep.h
+++ b/Swiften/Base/sleep.h
@@ -6,6 +6,8 @@
#pragma once
+#include <Swiften/Base/API.h>
+
namespace Swift {
- void sleep(unsigned int msecs);
+ SWIFTEN_API void sleep(unsigned int msecs);
}