]> git.lyx.org Git - lyx.git/blobdiff - src/support/convert.cpp
Provide option to prevent unnecessary font loading.
[lyx.git] / src / support / convert.cpp
index f95aa4b9d46c69bbe4c39dbf1ce58b6094017eb3..af0ad62f2b577de8149edf2d57050d0983bed6de 100644 (file)
@@ -37,7 +37,7 @@ To lexical_cast(From const & value, To const & defaultResult = To())
        }
 }
 
-}
+} // namespace
 
 
 namespace lyx {
@@ -105,7 +105,7 @@ docstring convert<docstring>(unsigned long ul)
 }
 
 
-#ifdef LYX_USE_LONG_LONG
+#ifdef HAVE_LONG_LONG_INT
 template<>
 string convert<string>(unsigned long long ull)
 {
@@ -135,7 +135,7 @@ docstring convert<docstring>(long l)
 }
 
 
-#ifdef LYX_USE_LONG_LONG
+#ifdef HAVE_LONG_LONG_INT
 template<>
 string convert<string>(long long ll)
 {
@@ -179,49 +179,55 @@ docstring convert<docstring>(double d)
 template<>
 int convert<int>(string const s)
 {
-       return strtol(s.c_str(), 0, 10);
+       return int(strtol(s.c_str(), nullptr, 10));
+}
+
+
+int convert(std::string const & s, int base)
+{
+       return int(strtol(s.c_str(), nullptr, base));
 }
 
 
 template<>
 int convert<int>(docstring const s)
 {
-       return strtol(to_ascii(s).c_str(), 0, 10);
+       return int(strtol(to_ascii(s).c_str(), nullptr, 10));
 }
 
 
 template<>
 unsigned int convert<unsigned int>(string const s)
 {
-       return strtoul(s.c_str(), 0, 10);
+       return static_cast<unsigned int>(strtoul(s.c_str(), nullptr, 10));
 }
 
 
 template<>
 unsigned long convert<unsigned long>(string const s)
 {
-       return strtoul(s.c_str(), 0, 10);
+       return strtoul(s.c_str(), nullptr, 10);
 }
 
 
 template<>
 double convert<double>(string const s)
 {
-       return strtod(s.c_str(), 0);
+       return strtod(s.c_str(), nullptr);
 }
 
 
 template<>
 int convert<int>(char const * cptr)
 {
-       return strtol(cptr, 0, 10);
+       return int(strtol(cptr, nullptr, 10));
 }
 
 
 template<>
 double convert<double>(char const * cptr)
 {
-       return strtod(cptr, 0);
+       return strtod(cptr, nullptr);
 }