From: Arvin Schnell Date: Mon, 23 Jul 2018 19:08:24 +0000 (+0200) Subject: - removed unused functions X-Git-Tag: v0.5.6^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=55a90a6dd5123ac30fb59bf22fa757b96105be25;p=thirdparty%2Fsnapper.git - removed unused functions --- diff --git a/snapper/SnapperTmpl.h b/snapper/SnapperTmpl.h index bbcd5be5..eab0e88a 100644 --- a/snapper/SnapperTmpl.h +++ b/snapper/SnapperTmpl.h @@ -23,7 +23,7 @@ #ifndef SNAPPER_SNAPPER_TMPL_H #define SNAPPER_SNAPPER_TMPL_H -#include + #include #include #include @@ -32,6 +32,7 @@ #include "snapper/AppUtil.h" + namespace snapper { using std::string; @@ -47,6 +48,7 @@ namespace snapper return num_str.str(); } + template string hexString(Num number) { static_assert(std::is_integral::value, "not integral"); @@ -57,6 +59,7 @@ namespace snapper return num_str.str(); } + template void operator>>(const string& d, Value& v) { std::istringstream Data(d); @@ -64,6 +67,7 @@ namespace snapper Data >> v; } + template std::ostream& operator<<( std::ostream& s, const std::list& l ) { s << "<"; @@ -77,12 +81,14 @@ namespace snapper return( s ); } + template std::ostream& operator<<( std::ostream& s, const std::pair& p ) { s << "[" << p.first << ":" << p.second << "]"; return( s ); } + template std::ostream& operator<<( std::ostream& s, const std::map& m ) { s << "<"; @@ -97,76 +103,6 @@ namespace snapper } - template - void logDiff(std::ostream& log, const char* text, const Type& lhs, const Type& rhs) - { - static_assert(!std::is_enum::value, "is enum"); - - if (lhs != rhs) - log << " " << text << ":" << lhs << "-->" << rhs; - } - - template - void logDiffHex(std::ostream& log, const char* text, const Type& lhs, const Type& rhs) - { - static_assert(std::is_integral::value, "not integral"); - - if (lhs != rhs) - log << " " << text << ":" << std::hex << lhs << "-->" << rhs << std::dec; - } - - template - void logDiffEnum(std::ostream& log, const char* text, const Type& lhs, const Type& rhs) - { - static_assert(std::is_enum::value, "not enum"); - - if (lhs != rhs) - log << " " << text << ":" << toString(lhs) << "-->" << toString(rhs); - } - - inline - void logDiff(std::ostream& log, const char* text, bool lhs, bool rhs) - { - if (lhs != rhs) - { - if (rhs) - log << " -->" << text; - else - log << " " << text << "-->"; - } - } - - - template - struct deref_less : public std::binary_function - { - bool operator()(const Type* x, const Type* y) const { return *x < *y; } - }; - - - template - struct deref_equal_to : public std::binary_function - { - bool operator()(const Type* x, const Type* y) const { return *x == *y; } - }; - - - template - void pointerIntoSortedList(list& l, Type* e) - { - l.insert(lower_bound(l.begin(), l.end(), e, deref_less()), e); - } - - - template - void clearPointerList(list& l) - { - for (typename list::iterator i = l.begin(); i != l.end(); ++i) - delete *i; - l.clear(); - } - - template bool contains(const ListType& l, const Type& value) { @@ -181,27 +117,6 @@ namespace snapper } - template - typename Map::iterator mapInsertOrReplace(Map& m, const Key& k, const Value& v) - { - typename Map::iterator pos = m.lower_bound(k); - if (pos != m.end() && !typename Map::key_compare()(k, pos->first)) - pos->second = v; - else - pos = m.insert(pos, typename Map::value_type(k, v)); - return pos; - } - - template - typename List::const_iterator addIfNotThere(List& l, const Value& v) - { - typename List::const_iterator pos = find( l.begin(), l.end(), v ); - if (pos == l.end() ) - pos = l.insert(l.end(), v); - return pos; - } - - template inline unsigned int lengthof(T (&)[sz]) { return sz; }