summaryrefslogtreecommitdiff
path: root/src/locale_convert.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-01-24 04:15:26 +0100
committerCarl Hetherington <cth@carlh.net>2021-01-24 04:15:26 +0100
commitceaf7bc52712cb60708ed5eb5c62c5e463dd8e89 (patch)
treec55e4b85ee30138ce83263045d77d01631378b2e /src/locale_convert.cc
parent6c37cc1979b2a01205a888c4c98f3334685ee8dd (diff)
Tidying.
Diffstat (limited to 'src/locale_convert.cc')
-rw-r--r--src/locale_convert.cc35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/locale_convert.cc b/src/locale_convert.cc
index 915cac82..2c7c74ef 100644
--- a/src/locale_convert.cc
+++ b/src/locale_convert.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
@@ -31,13 +31,21 @@
files in the program, then also delete it here.
*/
+
+/** @file src/locale_convert.cc
+ * @brief Methods to convert to/from string using the current locale
+ */
+
+
#include "locale_convert.h"
#include <string>
#include <inttypes.h>
+
using std::string;
using std::wstring;
+
template<>
string
dcp::locale_convert (unsigned char x, int, bool)
@@ -47,6 +55,7 @@ dcp::locale_convert (unsigned char x, int, bool)
return buffer;
}
+
template<>
string
dcp::locale_convert (unsigned short int x, int, bool)
@@ -56,6 +65,7 @@ dcp::locale_convert (unsigned short int x, int, bool)
return buffer;
}
+
template<>
string
dcp::locale_convert (int x, int, bool)
@@ -65,6 +75,7 @@ dcp::locale_convert (int x, int, bool)
return buffer;
}
+
template<>
string
dcp::locale_convert (unsigned int x, int, bool)
@@ -74,6 +85,7 @@ dcp::locale_convert (unsigned int x, int, bool)
return buffer;
}
+
template<>
string
dcp::locale_convert (long int x, int, bool)
@@ -87,6 +99,7 @@ dcp::locale_convert (long int x, int, bool)
return buffer;
}
+
template<>
string
dcp::locale_convert (unsigned long int x, int, bool)
@@ -96,6 +109,7 @@ dcp::locale_convert (unsigned long int x, int, bool)
return buffer;
}
+
template<>
string
dcp::locale_convert (long long int x, int, bool)
@@ -109,6 +123,7 @@ dcp::locale_convert (long long int x, int, bool)
return buffer;
}
+
template<>
string
dcp::locale_convert (unsigned long long int x, int, bool)
@@ -122,6 +137,7 @@ dcp::locale_convert (unsigned long long int x, int, bool)
return buffer;
}
+
template<>
string
dcp::locale_convert (float x, int precision, bool fixed)
@@ -137,6 +153,7 @@ dcp::locale_convert (float x, int precision, bool fixed)
return buffer;
}
+
template<>
string
dcp::locale_convert (double x, int precision, bool fixed)
@@ -152,6 +169,7 @@ dcp::locale_convert (double x, int precision, bool fixed)
return buffer;
}
+
template<>
string
dcp::locale_convert (string x, int, bool)
@@ -159,6 +177,7 @@ dcp::locale_convert (string x, int, bool)
return x;
}
+
template<>
string
dcp::locale_convert (char* x, int, bool)
@@ -166,6 +185,7 @@ dcp::locale_convert (char* x, int, bool)
return x;
}
+
template<>
string
dcp::locale_convert (char const * x, int, bool)
@@ -173,6 +193,7 @@ dcp::locale_convert (char const * x, int, bool)
return x;
}
+
template<>
string
dcp::locale_convert (wchar_t const * x, int, bool)
@@ -181,6 +202,7 @@ dcp::locale_convert (wchar_t const * x, int, bool)
return string (s.begin(), s.end());
}
+
template<>
string
dcp::locale_convert (char x, int, bool)
@@ -190,6 +212,7 @@ dcp::locale_convert (char x, int, bool)
return s;
}
+
template<>
string
dcp::locale_convert (boost::filesystem::path x, int, bool)
@@ -197,6 +220,7 @@ dcp::locale_convert (boost::filesystem::path x, int, bool)
return x.string();
}
+
template<>
unsigned char
dcp::locale_convert (string x, int, bool)
@@ -206,6 +230,7 @@ dcp::locale_convert (string x, int, bool)
return y;
}
+
template<>
unsigned short int
dcp::locale_convert (string x, int, bool)
@@ -215,6 +240,7 @@ dcp::locale_convert (string x, int, bool)
return y;
}
+
template<>
unsigned int
dcp::locale_convert (string x, int, bool)
@@ -224,6 +250,7 @@ dcp::locale_convert (string x, int, bool)
return y;
}
+
template<>
int
dcp::locale_convert (string x, int, bool)
@@ -233,6 +260,7 @@ dcp::locale_convert (string x, int, bool)
return y;
}
+
template<>
long
dcp::locale_convert (string x, int, bool)
@@ -242,6 +270,7 @@ dcp::locale_convert (string x, int, bool)
return y;
}
+
template<>
unsigned long
dcp::locale_convert (string x, int, bool)
@@ -255,6 +284,7 @@ dcp::locale_convert (string x, int, bool)
return y;
}
+
template<>
long long
dcp::locale_convert (string x, int, bool)
@@ -268,6 +298,7 @@ dcp::locale_convert (string x, int, bool)
return y;
}
+
template<>
unsigned long long
dcp::locale_convert (string x, int, bool)
@@ -281,6 +312,7 @@ dcp::locale_convert (string x, int, bool)
return y;
}
+
template<>
float
dcp::locale_convert (string x, int, bool)
@@ -290,6 +322,7 @@ dcp::locale_convert (string x, int, bool)
return y;
}
+
template<>
double
dcp::locale_convert (string x, int, bool)