]> git.lyx.org Git - features.git/commitdiff
* translator.h: use bind, equal_to instead of equal_1st_in_pair
authorLars Gullik Bjønnes <larsbj@gullik.org>
Sat, 6 Nov 2004 16:42:30 +0000 (16:42 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Sat, 6 Nov 2004 16:42:30 +0000 (16:42 +0000)
and equal_2nd_in_pair
* Makefile.am (libsupport_la_SOURCES): remove lyxfunctional.h
* lyxfunctional.h: delete file
* RadioButtonGroup.C (set): use bind, equal_to instead of
equal_2nd_in_pair

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9184 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/xforms/ChangeLog
src/frontends/xforms/RadioButtonGroup.C
src/support/ChangeLog
src/support/Makefile.am
src/support/lyxfunctional.h [deleted file]
src/support/translator.h

index 60d867f59bc3c3b907adef514b9b3d66229e5869..bf90f9985ecea8cf64fda59c8c89db5763849878 100644 (file)
@@ -1,5 +1,8 @@
 2004-11-06  Lars Gullik Bjonnes  <larsbj@gullik.net>
 
+       * RadioButtonGroup.C (set): use bind, equal_to instead of
+       equal_2nd_in_pair 
+
        * xformsImage.C (loadableFormats): use bind, equal_to instead of
        compare_memfun
 
index 08e3884cbb90048cd6a8adcba0515e0c5b8bf666..e292c2ae7b08403039de3db835d91147e10e1b9b 100644 (file)
 
 #include "debug.h"
 
-#include "support/lyxfunctional.h"
-
 #include "lyx_forms.h"
 
 #include <boost/assert.hpp>
+#include <boost/bind.hpp>
+
+using boost::bind;
 
 using std::endl;
+using std::equal_to;
 
 namespace lyx {
 namespace frontend {
@@ -43,7 +45,9 @@ void RadioButtonGroup::set(size_type value) const
 {
        ButtonValueMap::const_iterator it =
                find_if(map.begin(), map.end(),
-                       lyx::equal_2nd_in_pair<ButtonValuePair>(value));
+                       bind(equal_to<size_type>(),
+                            bind(&ButtonValuePair::second, _1),
+                            value));
 
        if (it != map.end()) {
                fl_set_button(it->first, 1);
index e12c5d7fe72a34e22db93eea046ae2f74f5a96db..d61036b6fdd310f5c235787cb84a0b055723e1bd 100644 (file)
@@ -1,9 +1,15 @@
 2004-11-06  Lars Gullik Bjonnes  <larsbj@gullik.net>
 
+       * translator.h: use bind, equal_to instead of equal_1st_in_pair
+       and equal_2nd_in_pair
+
+       * Makefile.am (libsupport_la_SOURCES): remove lyxfunctional.h
+       * lyxfunctional.h: delete file
+
        * lyxfunctional.h: delete compare_memfun and helper classes
 
        * forkedcontr.C (find_pid): use bind, equal_to instead of
-       compare_memfun 
+       compare_memfun
 
        * lyxfunctional.h: delete back_inserter_fun functions and helper
        classes.
index a21958e61afa810385f271d1305b88992fd99df6..8dd8cbc26a9056ad9d0895ca9d3be3d405e50850 100644 (file)
@@ -46,7 +46,6 @@ libsupport_la_SOURCES = \
        lstrings.C \
        lstrings.h \
        lyxalgo.h \
-       lyxfunctional.h \
        lyxlib.h \
        lyxmanip.h \
        lyxtime.C \
diff --git a/src/support/lyxfunctional.h b/src/support/lyxfunctional.h
deleted file mode 100644 (file)
index 9a1c615..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-// -*- C++ -*-
-/**
- * \file lyxfunctional.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Lars Gullik Bjønnes
- *
- * Full author contact details are available in file CREDITS.
- *
- * \brief Convenient function objects for use with LyX
- *
- * This is currently a small collection of small function objects for use
- * together with std::algorithms.
- */
-
-
-#ifndef LYX_FUNCTIONAL_H
-#define LYX_FUNCTIONAL_H
-
-#include <iterator>
-
-namespace lyx {
-
-// Functors used in the template.
-
-///
-template<typename T>
-class equal_1st_in_pair {
-public:
-       ///
-       typedef typename T::first_type first_type;
-       ///
-       typedef T pair_type;
-       ///
-       equal_1st_in_pair(first_type const & value) : value_(value) {}
-       ///
-       bool operator() (pair_type const & p) const {
-               return p.first == value_;
-       }
-private:
-       ///
-       first_type const & value_;
-};
-
-
-///
-template<typename T>
-class equal_2nd_in_pair {
-public:
-       ///
-       typedef typename T::second_type second_type;
-       ///
-       typedef T pair_type;
-       ///
-       equal_2nd_in_pair(second_type const & value) : value_(value) {}
-       ///
-       bool operator() (pair_type const & p) const {
-               return p.second == value_;
-       }
-private:
-       ///
-       second_type const & value_;
-};
-
-}  // end of namespace lyx
-#endif
index 4d4020dafa8c4a1977d1ec9ee6d275fcfafda374..d58e741b126a814d1cc04338898161aaf48cfeb7 100644 (file)
 #define TRANSLATOR_H
 
 #include <boost/assert.hpp>
+#include <boost/bind.hpp>
 
 #include <vector>
 #include <utility>
 #include <algorithm>
 #include <functional>
 
-#include "support/lyxfunctional.h"
 /**
  * This class template is used to translate between two elements, specifically
  * it was worked out to translate between an enum and strings when reading
@@ -62,7 +62,9 @@ public:
                // For explanation see the next find() function.
                typename Map::const_iterator it =
                        std::find_if(map.begin(), map.end(),
-                                    lyx::equal_1st_in_pair<MapPair>(first)
+                                    boost::bind(std::equal_to<T1>(),
+                                                boost::bind(&MapPair::first, _1),
+                                                first)
                                );
 
                if (it != map.end()) {
@@ -89,7 +91,9 @@ public:
                // equal_to(select2nd(pair) , second)
                typename Map::const_iterator it =
                        std::find_if(map.begin(), map.end(),
-                                    lyx::equal_2nd_in_pair<MapPair>(second)
+                                    boost::bind(std::equal_to<T2>(),
+                                                boost::bind(&MapPair::second, _1),
+                                                second)
                                );
 
                if (it != map.end())