From 36bbe548135901132ab7528d88a4f4b2cd69afd7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Sat, 6 Nov 2004 16:42:30 +0000 Subject: [PATCH] * 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 * 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 | 3 ++ src/frontends/xforms/RadioButtonGroup.C | 10 ++-- src/support/ChangeLog | 8 ++- src/support/Makefile.am | 1 - src/support/lyxfunctional.h | 67 ------------------------- src/support/translator.h | 10 ++-- 6 files changed, 24 insertions(+), 75 deletions(-) delete mode 100644 src/support/lyxfunctional.h diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 60d867f59b..bf90f9985e 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,5 +1,8 @@ 2004-11-06 Lars Gullik Bjonnes + * RadioButtonGroup.C (set): use bind, equal_to instead of + equal_2nd_in_pair + * xformsImage.C (loadableFormats): use bind, equal_to instead of compare_memfun diff --git a/src/frontends/xforms/RadioButtonGroup.C b/src/frontends/xforms/RadioButtonGroup.C index 08e3884cbb..e292c2ae7b 100644 --- a/src/frontends/xforms/RadioButtonGroup.C +++ b/src/frontends/xforms/RadioButtonGroup.C @@ -17,13 +17,15 @@ #include "debug.h" -#include "support/lyxfunctional.h" - #include "lyx_forms.h" #include +#include + +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(value)); + bind(equal_to(), + bind(&ButtonValuePair::second, _1), + value)); if (it != map.end()) { fl_set_button(it->first, 1); diff --git a/src/support/ChangeLog b/src/support/ChangeLog index e12c5d7fe7..d61036b6fd 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,9 +1,15 @@ 2004-11-06 Lars Gullik Bjonnes + * 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. diff --git a/src/support/Makefile.am b/src/support/Makefile.am index a21958e61a..8dd8cbc26a 100644 --- a/src/support/Makefile.am +++ b/src/support/Makefile.am @@ -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 index 9a1c6153f7..0000000000 --- a/src/support/lyxfunctional.h +++ /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 - -namespace lyx { - -// Functors used in the template. - -/// -template -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 -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 diff --git a/src/support/translator.h b/src/support/translator.h index 4d4020dafa..d58e741b12 100644 --- a/src/support/translator.h +++ b/src/support/translator.h @@ -13,13 +13,13 @@ #define TRANSLATOR_H #include +#include #include #include #include #include -#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(first) + boost::bind(std::equal_to(), + 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(second) + boost::bind(std::equal_to(), + boost::bind(&MapPair::second, _1), + second) ); if (it != map.end()) -- 2.39.2