From: Carl Hetherington Date: Sat, 23 Mar 2019 21:37:17 +0000 (+0000) Subject: Add string -> long long conversion for OS X. X-Git-Tag: v0.17.0~13 X-Git-Url: https://git.carlh.net/gitweb/?p=libcxml.git;a=commitdiff_plain;h=caa3f20cd224f88f7a785618b63000f44a06da3a Add string -> long long conversion for OS X. --- diff --git a/src/cxml.cc b/src/cxml.cc index f667584..3fa3d94 100644 --- a/src/cxml.cc +++ b/src/cxml.cc @@ -348,6 +348,19 @@ locale_convert (string x) return y; } +template<> +long long +locale_convert (string x) +{ + long long y = 0; +#ifdef LIBCXML_WINDOWS + __mingw_sscanf (x.c_str(), "%lld", &y); +#else + sscanf (x.c_str(), "%lld", &y); +#endif + return y; +} + template<> float locale_convert (string x) @@ -380,6 +393,13 @@ cxml::raw_convert (string v) return locale_convert (make_local(v)); } +template <> +long long +cxml::raw_convert (string v) +{ + return locale_convert (make_local(v)); +} + template <> unsigned int cxml::raw_convert (string v) diff --git a/src/cxml.h b/src/cxml.h index 20a948a..bd04af1 100644 --- a/src/cxml.h +++ b/src/cxml.h @@ -90,6 +90,10 @@ template <> long int raw_convert (std::string v); +template <> +long long +raw_convert (std::string v); + template <> float raw_convert (std::string v); diff --git a/wscript b/wscript index 959e1e0..b4f4747 100644 --- a/wscript +++ b/wscript @@ -57,8 +57,10 @@ def configure(conf): if conf.options.target_windows: boost_lib_suffix = '-mt' + conf.env.append_value('CXXFLAGS', '-DLIBCXML_WINDOWS') else: boost_lib_suffix = '' + conf.env.append_value('CXXFLAGS', '-DLIBCXML_POSIX') conf.check_cfg(package='libxml++-2.6', args='--cflags --libs', uselib_store='LIBXML++', mandatory=True)