summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-03-23 21:37:17 +0000
committerCarl Hetherington <cth@carlh.net>2019-03-23 21:37:17 +0000
commitcaa3f20cd224f88f7a785618b63000f44a06da3a (patch)
treea7003375ace7992848d5b9eb9be20f44bd7cc90d
parent3c371e9aead80bfed91ae208e2ce782c7bf4901b (diff)
Add string -> long long conversion for OS X.
-rw-r--r--src/cxml.cc20
-rw-r--r--src/cxml.h4
-rw-r--r--wscript2
3 files changed, 26 insertions, 0 deletions
diff --git a/src/cxml.cc b/src/cxml.cc
index f667584..3fa3d94 100644
--- a/src/cxml.cc
+++ b/src/cxml.cc
@@ -349,6 +349,19 @@ locale_convert (string x)
}
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)
{
@@ -381,6 +394,13 @@ cxml::raw_convert (string v)
}
template <>
+long long
+cxml::raw_convert (string v)
+{
+ return locale_convert<long long> (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
@@ -91,6 +91,10 @@ 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)