summaryrefslogtreecommitdiff
path: root/src/libcrawler/win32/stringutils.cpp
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2012-09-06 22:18:23 +0200
committerAndreas Baumann <abaumann@yahoo.com>2012-09-06 22:18:23 +0200
commit13fc9a7da5111f4ddba942d3c6b6b8654ce395d6 (patch)
treee86210e3d939911e35f930a6dc73c3ebb591243b /src/libcrawler/win32/stringutils.cpp
parentf5c586f7231f7e033c5528bcefea357e4e64441c (diff)
downloadcrawler-13fc9a7da5111f4ddba942d3c6b6b8654ce395d6.tar.gz
crawler-13fc9a7da5111f4ddba942d3c6b6b8654ce395d6.tar.bz2
more splitting into libcrawl, crawl binary
moved more public header to 'include' changed approach for dynamic linking on Windows
Diffstat (limited to 'src/libcrawler/win32/stringutils.cpp')
-rwxr-xr-xsrc/libcrawler/win32/stringutils.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/libcrawler/win32/stringutils.cpp b/src/libcrawler/win32/stringutils.cpp
new file mode 100755
index 0000000..607735c
--- /dev/null
+++ b/src/libcrawler/win32/stringutils.cpp
@@ -0,0 +1,21 @@
+#include "win32/stringutils.hpp"
+
+using namespace std;
+
+#define WIN32_MEAN_AND_LEAN
+#include <windows.h>
+
+std::wstring s2ws( const std::string &s )
+{
+ // get size for buffer and allocate it
+ int len;
+ int slength = (int)s.length( )+1;
+ len = MultiByteToWideChar( CP_ACP, 0, s.c_str( ), slength, 0, 0 );
+ wchar_t *buf = new wchar_t[len];
+
+ // convert
+ MultiByteToWideChar( CP_ACP, 0, s.c_str( ), slength, buf, len );
+ std::wstring res( buf );
+ delete[] buf;
+ return res;
+}