merge with master

This commit is contained in:
Dane Springmeyer
2014-11-03 10:32:27 -05:00
5 changed files with 64 additions and 51 deletions

26
configure vendored
View File

@@ -29,16 +29,18 @@ case ${MASON_PLATFORM} in
LIBUV_VERSION=0.11.29
ZLIB_VERSION=system
BOOST_VERSION=system
NUNICODE_VERSION=1.4
;;
*)
GLFW_VERSION=a21f2377
SQLITE_VERSION=system
LIBPNG_VERSION=1.6.13
LIBCURL_VERSION=system
LIBUV_VERSION=0.10.28
ZLIB_VERSION=system
BOOST_VERSION=system
;;
GLFW_VERSION=a21f2377
SQLITE_VERSION=system
LIBPNG_VERSION=1.6.13
LIBCURL_VERSION=system
LIBUV_VERSION=0.10.28
ZLIB_VERSION=system
BOOST_VERSION=system
NUNICODE_VERSION=1.4
;;
esac
function abort { >&2 echo -e "\033[1m\033[31m$1\033[0m"; exit 1; }
@@ -117,6 +119,14 @@ if [ ! -z ${ZLIB_VERSION} ]; then
CONFIG+=" 'zlib_ldflags': $(quote_flags $(mason ldflags zlib ${ZLIB_VERSION})),"$LN
fi
if [ ! -z ${NUNICODE_VERSION} ]; then
mason install nunicode ${NUNICODE_VERSION}
CONFIG+=" 'nu_static_libs': $(quote_flags $(mason static_libs nunicode ${NUNICODE_VERSION})),"$LN
CONFIG+=" 'nu_cflags': $(quote_flags $(mason cflags nunicode ${NUNICODE_VERSION})),"$LN
CONFIG+=" 'nu_ldflags': $(quote_flags $(mason ldflags nunicode ${NUNICODE_VERSION})),"$LN
fi
CONFIG+=" }
}
"

View File

@@ -10,14 +10,17 @@
'<@(png_cflags)',
'<@(uv_cflags)',
'<@(curl_cflags)',
'<@(nu_cflags)',
],
'cflags': [
'<@(uv_cflags)',
'<@(nu_cflags)',
],
'ldflags': [
'<@(png_ldflags)',
'<@(uv_ldflags)',
'<@(curl_ldflags)',
'<@(nu_ldflags)',
],
},
'sources': [

View File

@@ -3,25 +3,12 @@
#include <memory>
// g++/libstdc++ is missing c++11 codecvt support
#if 1//! defined(__clang__) || defined(__linux__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
//#include <boost/locale.hpp>
#include <boost/regex/pending/unicode_iterator.hpp>
#pragma GCC diagnostic pop
#else
// Assume that codecvt is present on clang on non-linux systems
#include <codecvt>
#include <locale>
#endif
namespace mbgl {
namespace util {
#if 1 //! defined(__clang__) || defined(__linux__)
class utf8_to_utf32 {
public:
explicit utf8_to_utf32() {}
@@ -33,21 +20,6 @@ class utf8_to_utf32 {
}
};
#else
class utf8_to_utf32 {
public:
explicit utf8_to_utf32()
: utf32conv_() {}
std::u32string convert(std::string const& utf8) {
return utf32conv_.from_bytes(utf8);
}
private:
std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> utf32conv_;
};
#endif
}}
#endif

View File

@@ -65,7 +65,7 @@ int main(int argc, char *argv[]) {
}
// Load style
const std::string style = std::string("file://") + uv::cwd() + std::string("/styles/styles/bright-v5.json");
const std::string style = std::string("file://") + uv::cwd() + std::string("/../../styles/styles/bright-v5.json");
map.setStyleURL(style);
int ret = view->run();

View File

@@ -1,24 +1,52 @@
#include <mbgl/platform/platform.hpp>
#include <locale>
#include <mbgl/util/utf.hpp>
#define NU_WITH_TOUPPER
#define NU_WITH_TOLOWER
#define NU_WITH_UTF8_WRITER
#include <libnu/libnu.h>
#include <cstring>
namespace mbgl {
namespace platform {
std::string uppercase(const std::string& string) {
// TODO: Use a proper Unicode Special Casing-aware algorithm.
const auto &convert = std::use_facet<std::ctype<char>>(std::locale());
std::string converted = string;
convert.toupper(&converted[0], &converted[0] + converted.size());
return converted;
std::string uppercase(const std::string& str)
{
boost::u8_to_u32_iterator<std::string::const_iterator> itr(str.begin());
boost::u8_to_u32_iterator<std::string::const_iterator> end(str.end());
std::string output;
char buf[5];
for (; itr!=end; ++itr)
{
char const* up = nu_toupper(*itr);
if (up != 0) output.append(up);
else
{
std::memset(buf, 0, 5);
nu_utf8_write(*itr, buf);
output.append(buf);
}
}
return output;
}
std::string lowercase(const std::string& string) {
// TODO: Use a proper Unicode Special Casing-aware algorithm.
const auto &convert = std::use_facet<std::ctype<char>>(std::locale());
std::string converted = string;
convert.tolower(&converted[0], &converted[0] + converted.size());
return converted;
std::string lowercase(const std::string& str)
{
boost::u8_to_u32_iterator<std::string::const_iterator> itr(str.begin());
boost::u8_to_u32_iterator<std::string::const_iterator> end(str.end());
std::string output;
char buf[5];
for (; itr!=end; ++itr)
{
char const* lo = nu_tolower(*itr);
if (lo != 0) output.append(lo);
else
{
std::memset(buf, 0, 5);
nu_utf8_write(*itr, buf);
output.append(buf);
}
}
return output;
}
}