diff options
| author | cah <cah@ableton.com> | 2020-01-13 14:24:04 +0100 |
|---|---|---|
| committer | cah <cah@ableton.com> | 2020-01-13 14:24:04 +0100 |
| commit | c9a79405c38ef596a821a4db9955a33f4437b9d3 (patch) | |
| tree | f9b7ea8d7515a59da70cec9512478ce44019cb09 /src | |
| parent | 092ed446333ce12814d5883f924ab16ad096ab05 (diff) | |
Add some new conversions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/cxml.cc | 44 | ||||
| -rw-r--r-- | src/cxml.h | 8 |
2 files changed, 50 insertions, 2 deletions
diff --git a/src/cxml.cc b/src/cxml.cc index a51b9a4..667da55 100644 --- a/src/cxml.cc +++ b/src/cxml.cc @@ -350,6 +350,19 @@ locale_convert (string x) } template<> +long unsigned int +locale_convert (string x) +{ + long unsigned int y = 0; +#ifdef LIBCXML_WINDOWS + __mingw_sscanf (x.c_str(), "%lud", &y); +#else + sscanf (x.c_str(), "%lud", &y); +#endif + return y; +} + +template<> long long locale_convert (string x) { @@ -363,6 +376,19 @@ locale_convert (string x) } template<> +long long unsigned +locale_convert (string x) +{ + long long unsigned y = 0; +#ifdef LIBCXML_WINDOWS + __mingw_sscanf (x.c_str(), "%llud", &y); +#else + sscanf (x.c_str(), "%llud", &y); +#endif + return y; +} + +template<> float locale_convert (string x) { @@ -388,6 +414,13 @@ cxml::raw_convert (string v) } template <> +unsigned int +cxml::raw_convert (string v) +{ + return locale_convert<unsigned int> (make_local(v)); +} + +template <> long int cxml::raw_convert (string v) { @@ -395,6 +428,13 @@ cxml::raw_convert (string v) } template <> +long unsigned int +cxml::raw_convert (string v) +{ + return locale_convert<long unsigned int> (make_local(v)); +} + +template <> long long cxml::raw_convert (string v) { @@ -402,10 +442,10 @@ cxml::raw_convert (string v) } template <> -unsigned int +long long unsigned cxml::raw_convert (string v) { - return locale_convert<unsigned int> (make_local(v)); + return locale_convert<long long unsigned> (make_local(v)); } template <> @@ -91,10 +91,18 @@ long int raw_convert (std::string v); template <> +long unsigned int +raw_convert (std::string v); + +template <> long long raw_convert (std::string v); template <> +long long unsigned +raw_convert (std::string v); + +template <> float raw_convert (std::string v); |
