Skip to content

Commit

Permalink
Merge pull request #2 from CristiFati/master
Browse files Browse the repository at this point in the history
Support for Win
  • Loading branch information
soldni authored Feb 22, 2018
2 parents 890b8bc + 66e99ac commit d60b340
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,18 @@
#endif/*USE_LIBICONV_GNU*/

#ifndef ICONV_CONST
#if defined (WIN32)
#define ICONV_CONST const
#else
#define ICONV_CONST
#endif
#endif/*ICONV_CONST*/

#if defined (WIN32)
#define __SIZEOF_WCHAR_T__ 2
#endif


template <class source_type, class destination_type>
bool iconv_convert(iconv_t cd, const source_type& src, destination_type& dst)
{
Expand Down Expand Up @@ -269,7 +278,7 @@ void retrieve_iconv(
iconv_close(bwd);
}

#ifdef __APPLE__
#if defined(__APPLE__) || defined(WIN32)
#include <cassert>
#endif

Expand All @@ -283,7 +292,7 @@ std::vector<std::string> reader::retrieve(const char *query)
retrieve_thru(dbr, query, this->measure, this->threshold, std::back_inserter(ret));
break;
case 2:
#ifdef __APPLE__
#if defined(__APPLE__) || defined(WIN32)
#if __SIZEOF_WCHAR_T__ == 2
retrieve_iconv<wchar_t>(dbr, query, UTF16, this->measure, this->threshold, std::back_inserter(ret));
#else
Expand All @@ -294,7 +303,7 @@ assert(0);
#endif
break;
case 4:
#ifdef __APPLE__
#if defined(__APPLE__) || defined(WIN32)
#if __SIZEOF_WCHAR_T__ == 4
retrieve_iconv<wchar_t>(dbr, query, UTF32, this->measure, this->threshold, std::back_inserter(ret));
#else
Expand All @@ -317,7 +326,7 @@ bool reader::check(const char *query)
std::string qstr = query;
return dbr.check(qstr, translate_measure(this->measure), this->threshold);
} else if (dbr.char_size() == 2) {
#ifdef __APPLE__
#if defined(__APPLE__) || defined(WIN32)
#if __SIZEOF_WCHAR_T__ == 2
std::basic_string<wchar_t> qstr;
#else
Expand All @@ -333,7 +342,7 @@ assert(0);
iconv_close(fwd);
return dbr.check(qstr, translate_measure(this->measure), this->threshold);
} else if (dbr.char_size() == 4) {
#ifdef __APPLE__
#if defined(__APPLE__) || defined(WIN32)
#if __SIZEOF_WCHAR_T__ == 4
std::basic_string<wchar_t> qstr;
#else
Expand Down

0 comments on commit d60b340

Please sign in to comment.