]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- removed unused functions
authorArvin Schnell <aschnell@suse.de>
Mon, 23 Jul 2018 19:08:24 +0000 (21:08 +0200)
committerArvin Schnell <aschnell@suse.de>
Mon, 23 Jul 2018 19:08:24 +0000 (21:08 +0200)
snapper/SnapperTmpl.h

index bbcd5be5c8331e896a8d606786ab8c15dcb87d5e..eab0e88aa048a245133f7620a62052af52772ae1 100644 (file)
@@ -23,7 +23,7 @@
 #ifndef SNAPPER_SNAPPER_TMPL_H
 #define SNAPPER_SNAPPER_TMPL_H
 
-#include <functional>
+
 #include <ostream>
 #include <fstream>
 #include <sstream>
@@ -32,6 +32,7 @@
 
 #include "snapper/AppUtil.h"
 
+
 namespace snapper
 {
     using std::string;
@@ -47,6 +48,7 @@ namespace snapper
        return num_str.str();
     }
 
+
     template<class Num> string hexString(Num number)
     {
        static_assert(std::is_integral<Num>::value, "not integral");
@@ -57,6 +59,7 @@ namespace snapper
        return num_str.str();
     }
 
+
     template<class Value> void operator>>(const string& d, Value& v)
     {
        std::istringstream Data(d);
@@ -64,6 +67,7 @@ namespace snapper
        Data >> v;
     }
 
+
     template<class Value> std::ostream& operator<<( std::ostream& s, const std::list<Value>& l )
     {
        s << "<";
@@ -77,12 +81,14 @@ namespace snapper
        return( s );
     }
 
+
     template<class F, class S> std::ostream& operator<<( std::ostream& s, const std::pair<F,S>& p )
     {
        s << "[" << p.first << ":" << p.second << "]";
        return( s );
     }
 
+
     template<class Key, class Value> std::ostream& operator<<( std::ostream& s, const std::map<Key,Value>& m )
     {
        s << "<";
@@ -97,76 +103,6 @@ namespace snapper
     }
 
 
-    template <typename Type>
-    void logDiff(std::ostream& log, const char* text, const Type& lhs, const Type& rhs)
-    {
-       static_assert(!std::is_enum<Type>::value, "is enum");
-
-       if (lhs != rhs)
-           log << " " << text << ":" << lhs << "-->" << rhs;
-    }
-
-    template <typename Type>
-    void logDiffHex(std::ostream& log, const char* text, const Type& lhs, const Type& rhs)
-    {
-       static_assert(std::is_integral<Type>::value, "not integral");
-
-       if (lhs != rhs)
-           log << " " << text << ":" << std::hex << lhs << "-->" << rhs << std::dec;
-    }
-
-    template <typename Type>
-    void logDiffEnum(std::ostream& log, const char* text, const Type& lhs, const Type& rhs)
-    {
-       static_assert(std::is_enum<Type>::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<class Type>
-    struct deref_less : public std::binary_function<const Type*, const Type*, bool>
-    {
-       bool operator()(const Type* x, const Type* y) const { return *x < *y; }
-    };
-
-
-    template<class Type>
-    struct deref_equal_to : public std::binary_function<const Type*, const Type*, bool>
-    {
-       bool operator()(const Type* x, const Type* y) const { return *x == *y; }
-    };
-
-
-    template <class Type>
-    void pointerIntoSortedList(list<Type*>& l, Type* e)
-    {
-       l.insert(lower_bound(l.begin(), l.end(), e, deref_less<Type>()), e);
-    }
-
-
-    template <class Type>
-    void clearPointerList(list<Type*>& l)
-    {
-       for (typename list<Type*>::iterator i = l.begin(); i != l.end(); ++i)
-           delete *i;
-       l.clear();
-    }
-
-
     template <typename ListType, typename Type>
     bool contains(const ListType& l, const Type& value)
     {
@@ -181,27 +117,6 @@ namespace snapper
     }
 
 
-    template<typename Map, typename Key, typename Value>
-    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, typename Value>
-    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 <class T, unsigned int sz>
     inline unsigned int lengthof(T (&)[sz]) { return sz; }