summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-12-23 15:36:07 +0100
committerCarl Hetherington <cth@carlh.net>2024-12-23 17:34:59 +0100
commita6ccc587277b848b4a60c07456b11eb1b076d181 (patch)
treeb01c2d32cf97e25f34fc9b4bee9a3bc02d0a1de8
parente92e5e5da28e89cb6b0b8762bff7b5b068723efe (diff)
Remove now-unused raw_converts.
-rw-r--r--src/raw_convert.cc137
-rw-r--r--src/raw_convert.h60
-rw-r--r--test/raw_convert_test.cc79
-rw-r--r--test/wscript1
4 files changed, 0 insertions, 277 deletions
diff --git a/src/raw_convert.cc b/src/raw_convert.cc
index c806b45e..720be6f3 100644
--- a/src/raw_convert.cc
+++ b/src/raw_convert.cc
@@ -38,22 +38,6 @@
using std::string;
-using std::wstring;
-
-
-/** @param v Numeric value as an ASCII string */
-static
-string
-make_raw (string v)
-{
- struct lconv* lc = localeconv ();
- /* thousands_sep may be . so remove them before changing decimal points */
- boost::algorithm::replace_all (v, lc->thousands_sep, "");
- boost::algorithm::replace_all (v, lc->decimal_point, ".");
- return v;
-}
-
-
static
string
make_local (string v)
@@ -65,127 +49,6 @@ make_local (string v)
}
-template <>
-string
-dcp::raw_convert (unsigned char v, int precision, bool fixed)
-{
- return make_raw (locale_convert<string> (v, precision, fixed));
-}
-
-
-template <>
-string
-dcp::raw_convert (unsigned short int v, int precision, bool fixed)
-{
- return make_raw (locale_convert<string> (v, precision, fixed));
-}
-
-
-template <>
-string
-dcp::raw_convert (int v, int precision, bool fixed)
-{
- return make_raw (locale_convert<string> (v, precision, fixed));
-}
-
-
-template <>
-string
-dcp::raw_convert (unsigned int v, int precision, bool fixed)
-{
- return make_raw (locale_convert<string> (v, precision, fixed));
-}
-
-
-template <>
-string
-dcp::raw_convert (long v, int precision, bool fixed)
-{
- return make_raw (locale_convert<string> (v, precision, fixed));
-}
-
-
-template <>
-string
-dcp::raw_convert (unsigned long v, int precision, bool fixed)
-{
- return make_raw (locale_convert<string> (v, precision, fixed));
-}
-
-
-template <>
-string
-dcp::raw_convert (long long v, int precision, bool fixed)
-{
- return make_raw (locale_convert<string> (v, precision, fixed));
-}
-
-
-template <>
-string
-dcp::raw_convert (unsigned long long v, int precision, bool fixed)
-{
- return make_raw (locale_convert<string> (v, precision, fixed));
-}
-
-
-template <>
-string
-dcp::raw_convert (float v, int precision, bool fixed)
-{
- return make_raw (locale_convert<string> (v, precision, fixed));
-}
-
-
-template <>
-string
-dcp::raw_convert (double v, int precision, bool fixed)
-{
- return make_raw (locale_convert<string> (v, precision, fixed));
-}
-
-
-template <>
-string
-dcp::raw_convert (char const * v, int, bool)
-{
- return v;
-}
-
-
-template <>
-string
-dcp::raw_convert (char* v, int, bool)
-{
- return v;
-}
-
-
-template <>
-string
-dcp::raw_convert (string v, int, bool)
-{
- return v;
-}
-
-
-template <>
-string
-dcp::raw_convert (char v, int, bool)
-{
- string s;
- s += v;
- return s;
-}
-
-
-template <>
-string
-dcp::raw_convert (wchar_t const * v, int, bool)
-{
- wstring w (v);
- return string (w.begin(), w.end());
-}
template <>
diff --git a/src/raw_convert.h b/src/raw_convert.h
index 51f5fbb6..8dde240d 100644
--- a/src/raw_convert.h
+++ b/src/raw_convert.h
@@ -65,66 +65,6 @@ raw_convert (Q, int precision = 16, bool fixed = false)
}
template <>
-std::string
-raw_convert (unsigned char v, int, bool);
-
-template <>
-std::string
-raw_convert (unsigned short int v, int, bool);
-
-template <>
-std::string
-raw_convert (int v, int, bool);
-
-template <>
-std::string
-raw_convert (unsigned int v, int, bool);
-
-template <>
-std::string
-raw_convert (long v, int, bool);
-
-template <>
-std::string
-raw_convert (unsigned long v, int, bool);
-
-template <>
-std::string
-raw_convert (long long v, int, bool);
-
-template <>
-std::string
-raw_convert (unsigned long long v, int, bool);
-
-template <>
-std::string
-raw_convert (float v, int, bool);
-
-template <>
-std::string
-raw_convert (double v, int, bool);
-
-template <>
-std::string
-raw_convert (char const * v, int, bool);
-
-template <>
-std::string
-raw_convert (char* v, int, bool);
-
-template <>
-std::string
-raw_convert (std::string v, int, bool);
-
-template <>
-std::string
-raw_convert (wchar_t const * v, int, bool);
-
-template <>
-std::string
-raw_convert (char v, int, bool);
-
-template <>
unsigned char
raw_convert (std::string v, int, bool);
diff --git a/test/raw_convert_test.cc b/test/raw_convert_test.cc
deleted file mode 100644
index c48ccb0c..00000000
--- a/test/raw_convert_test.cc
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
-
- This file is part of libdcp.
-
- libdcp is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- libdcp is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with libdcp. If not, see <http://www.gnu.org/licenses/>.
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of portions of this program with the
- OpenSSL library under certain conditions as described in each
- individual source file, and distribute linked combinations
- including the two.
-
- You must obey the GNU General Public License in all respects
- for all of the code used other than OpenSSL. If you modify
- file(s) with this exception, you may extend this exception to your
- version of the file(s), but you are not obligated to do so. If you
- do not wish to do so, delete this exception statement from your
- version. If you delete this exception statement from all source
- files in the program, then also delete it here.
-*/
-
-#include "raw_convert.h"
-#include "locale_convert.h"
-#include <boost/test/unit_test.hpp>
-#include <iostream>
-
-using std::string;
-
-BOOST_AUTO_TEST_CASE (raw_convert_test)
-{
- BOOST_CHECK_EQUAL (dcp::raw_convert<string> (1), "1");
- BOOST_CHECK_EQUAL (dcp::raw_convert<string> (12), "12");
- BOOST_CHECK_EQUAL (dcp::raw_convert<string> (12.3), "12.3");
- BOOST_CHECK_EQUAL (dcp::raw_convert<string> (12.34), "12.34");
- BOOST_CHECK_EQUAL (dcp::raw_convert<string> (.34), "0.34");
- BOOST_CHECK_EQUAL (dcp::raw_convert<string> (-.34), "-0.34");
- BOOST_CHECK_EQUAL (dcp::raw_convert<string> (0.157123125), "0.157123125");
- BOOST_CHECK_EQUAL (dcp::raw_convert<string> (0.157123125, 4), "0.1571");
- BOOST_CHECK_EQUAL (dcp::raw_convert<string> (1e50), "1e+50");
- BOOST_CHECK_EQUAL (dcp::raw_convert<string> (1e-50), "1e-50");
- BOOST_CHECK_EQUAL (dcp::raw_convert<string> (1.5e12), "1500000000000");
- BOOST_CHECK_EQUAL (dcp::raw_convert<string> (0.0086), "0.0086");
- BOOST_CHECK_EQUAL (dcp::raw_convert<string> (0.00086), "0.00086");
- BOOST_CHECK_EQUAL (dcp::raw_convert<string> (0.000086), "8.6e-05");
- BOOST_CHECK_EQUAL (dcp::raw_convert<string> (0.000086, 10, true), "0.0000860000");
-
- BOOST_CHECK_EQUAL (dcp::raw_convert<int> ("42"), 42);
- BOOST_CHECK_EQUAL (dcp::raw_convert<int> ("42.3"), 42);
- BOOST_CHECK_EQUAL (dcp::raw_convert<int> ("42.7"), 42);
-
- BOOST_CHECK_EQUAL (dcp::raw_convert<double> ("42"), 42);
- BOOST_CHECK_EQUAL (dcp::raw_convert<double> ("42.3"), 42.3);
- BOOST_CHECK_EQUAL (dcp::raw_convert<double> ("42.7"), 42.7);
- BOOST_CHECK_EQUAL (dcp::raw_convert<double> ("4e8"), 4e8);
- BOOST_CHECK_EQUAL (dcp::raw_convert<double> ("9.1e9"), 9.1e9);
- BOOST_CHECK_EQUAL (dcp::raw_convert<double> ("0.005"), 0.005);
-
- BOOST_CHECK_CLOSE (dcp::raw_convert<float> ("42"), 42, 0.001);
- BOOST_CHECK_CLOSE (dcp::raw_convert<float> ("42.3"), 42.3, 0.001);
- BOOST_CHECK_CLOSE (dcp::raw_convert<float> ("42.7"), 42.7, 0.001);
- BOOST_CHECK_CLOSE (dcp::raw_convert<float> ("4e8"), 4e8, 0.001);
- BOOST_CHECK_CLOSE (dcp::raw_convert<float> ("9.1e9"), 9.1e9, 0.001);
- BOOST_CHECK_CLOSE (dcp::raw_convert<float> ("0.005"), 0.005, 0.001);
-
- BOOST_CHECK_EQUAL (dcp::raw_convert<string> ("foo"), "foo");
- BOOST_CHECK_EQUAL (dcp::raw_convert<string> ("foo bar"), "foo bar");
-}
diff --git a/test/wscript b/test/wscript
index 9105a791..2b970f43 100644
--- a/test/wscript
+++ b/test/wscript
@@ -99,7 +99,6 @@ def build(bld):
kdm_test.cc
key_test.cc
language_tag_test.cc
- raw_convert_test.cc
read_dcp_test.cc
read_change_write_test.cc
reel_asset_test.cc