X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fcompose.hpp;h=2c44f148bdf05e9bb5c48e7902c15d6e7a3bf7d9;hb=ebce2111f20e6b9cbd00ce8ec7e72c68cf176c29;hp=6206eb61170d7ba4823be190d219182403d4b3f1;hpb=b1dc9c3a2f7e55c9afc5bf2d5b465371b048e14f;p=dcpomatic.git diff --git a/src/lib/compose.hpp b/src/lib/compose.hpp index 6206eb611..2c44f148b 100644 --- a/src/lib/compose.hpp +++ b/src/lib/compose.hpp @@ -34,11 +34,13 @@ #ifndef STRING_COMPOSE_H #define STRING_COMPOSE_H +#include #include #include #include #include #include +#include namespace StringPrivate { @@ -112,96 +114,11 @@ namespace StringPrivate } } - template - inline void write(std::string& s, const T& obj) - { - /* Assume anything not specialized has a to_string() method */ - s += to_string (obj); - } - - template <> - inline void write(std::string& s, const int64_t& obj) - { - char buffer[64]; - snprintf(buffer, 64, "%" PRId64, obj); - s += buffer; - } - - template <> - inline void write(std::string& s, const int& obj) - { - char buffer[64]; - snprintf(buffer, 64, "%d", obj); - s += buffer; - } - - template <> - inline void write(std::string& s, const unsigned int& obj) - { - char buffer[64]; - snprintf(buffer, 64, "%ud", obj); - s += buffer; - } - - template <> - inline void write(std::string& s, const long unsigned int& obj) - { - char buffer[64]; - snprintf(buffer, 64, "%lu", obj); - s += buffer; - } - - template <> - inline void write(std::string& s, const float& obj) - { - char buffer[64]; - snprintf(buffer, 64, "%f", obj); - s += buffer; - } - - template <> - inline void write(std::string& s, const char& obj) - { - s += obj; - } - - template <> - inline void write(std::string& s, const double& obj) - { - char buffer[64]; - snprintf(buffer, 64, "%f", obj); - s += buffer; - } - - template <> - inline void write(std::string& s, char const * const & obj) - { - s += obj; - } - - template <> - inline void write(std::string& s, char* const & obj) - { - s += obj; - } - - template <> - inline void write(std::string& s, const std::string& obj) - { - s += obj; - } - - template <> - inline void write(std::string& s, const boost::filesystem::path & obj) - { - s += obj.string(); - } - // implementation of class Composition template inline Composition &Composition::arg(const T &obj) { - write(os, obj); + os += dcp::locale_convert(obj); if (!os.empty()) { // manipulators don't produce output for (specification_map::const_iterator i = specs.lower_bound(arg_no), end = specs.upper_bound(arg_no); i != end; ++i) {