projects
/
libcxml.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
092ed44
)
Add some new conversions.
author
cah
<cah@ableton.com>
Mon, 13 Jan 2020 13:24:04 +0000
(14:24 +0100)
committer
cah
<cah@ableton.com>
Mon, 13 Jan 2020 13:24:04 +0000
(14:24 +0100)
src/cxml.cc
patch
|
blob
|
history
src/cxml.h
patch
|
blob
|
history
diff --git
a/src/cxml.cc
b/src/cxml.cc
index a51b9a42762c50c588a0a8983204cf2892109c3c..667da5515851b6a8ea8fd109f92cee71457fbc15 100644
(file)
--- a/
src/cxml.cc
+++ b/
src/cxml.cc
@@
-349,6
+349,19
@@
locale_convert (string x)
return y;
}
return y;
}
+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)
template<>
long long
locale_convert (string x)
@@
-362,6
+375,19
@@
locale_convert (string x)
return y;
}
return y;
}
+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)
template<>
float
locale_convert (string x)
@@
-387,6
+413,13
@@
cxml::raw_convert (string v)
return locale_convert<int> (make_local(v));
}
return locale_convert<int> (make_local(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)
template <>
long int
cxml::raw_convert (string v)
@@
-394,6
+427,13
@@
cxml::raw_convert (string v)
return locale_convert<long int> (make_local(v));
}
return locale_convert<long int> (make_local(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)
template <>
long long
cxml::raw_convert (string v)
@@
-402,10
+442,10
@@
cxml::raw_convert (string v)
}
template <>
}
template <>
-unsigned int
+long long unsigned
cxml::raw_convert (string v)
{
cxml::raw_convert (string v)
{
- return locale_convert<
unsigned int
> (make_local(v));
+ return locale_convert<
long long unsigned
> (make_local(v));
}
template <>
}
template <>
diff --git
a/src/cxml.h
b/src/cxml.h
index bd04af1838ea8fb1d40aeca276e36df34d6bb13a..b6f2c635607fd744ffd078c367912f7aa16adfa2 100644
(file)
--- a/
src/cxml.h
+++ b/
src/cxml.h
@@
-90,10
+90,18
@@
template <>
long int
raw_convert (std::string v);
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
raw_convert (std::string v);
+template <>
+long long unsigned
+raw_convert (std::string v);
+
template <>
float
raw_convert (std::string v);
template <>
float
raw_convert (std::string v);