#include "BranchList.h"
-#include <boost/assert.hpp>
+using std::string;
-#include <functional>
+namespace {
+class BranchNamesEqual : public std::unary_function<Branch, bool> {
+public:
+ BranchNamesEqual(string const & name)
+ : name_(name) {}
+ bool operator()(Branch const & branch) const
+ {
+ return branch.getBranch() == name_;
+ }
+private:
+ string name_;
+};
-using std::string;
-using std::bind2nd;
-using std::binary_function;
+} // namespace anon
string const & Branch::getBranch() const
}
-namespace {
-
-struct SameName {
- SameName(string const & name) : name_(name) {}
- bool operator()(Branch const & branch) const
- { return branch.getBranch() == name_; }
-private:
- string name_;
-};
-
-}// namespace anon
-
-
Branch * BranchList::find(std::string const & name)
{
List::iterator it =
- std::find_if(list.begin(), list.end(), SameName(name));
+ std::find_if(list.begin(), list.end(), BranchNamesEqual(name));
return it == list.end() ? 0 : &*it;
}
-
+
Branch const * BranchList::find(std::string const & name) const
{
List::const_iterator it =
- std::find_if(list.begin(), list.end(), SameName(name));
+ std::find_if(list.begin(), list.end(), BranchNamesEqual(name));
return it == list.end() ? 0 : &*it;
}
-
+
bool BranchList::add(string const & s)
{
bool added = false;
else
name = s.substr(i, j - i);
// Is this name already in the list?
- List::const_iterator it = list.begin();
- List::const_iterator end = list.end();
- bool already = false;
- for (; it != end; ++it) {
- if (it->getBranch() == name) {
- already = true;
- break;
- }
- }
+ bool const already =
+ std::find_if(list.begin(), list.end(),
+ BranchNamesEqual(name)) != list.end();
if (!already) {
added = true;
Branch br;
}
-namespace {
-
-struct match : public binary_function<Branch, string, bool> {
- bool operator()(Branch const & br, string const & s) const {
- return (br.getBranch() == s);
- }
-};
-
-} // namespace anon.
-
-
bool BranchList::remove(string const & s)
{
List::size_type const size = list.size();
- list.remove_if(bind2nd(match(), s));
+ list.remove_if(BranchNamesEqual(s));
return size != list.size();
}
+2004-01-05 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * BranchList.C: new BranchListEqual fuctor, use it. Remove
+ SameName and match.
+ (add): replace a finding loop with std::find_if.
+
2003-12-31 Martin Vermeer <martin.vermeer@hut.fi>
- * output_docbook.C: moving LatexParam functionality into
+ * output_docbook.C: moving LatexParam functionality into
.layout files
2003-12-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
2003-12-14 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
- * factory.C:
+ * factory.C:
* lyxfunc.C: remove insetminipage. "minipage-insert"
now produces a frameless minipage box inset.
2003-12-12 Alfredo Braunstein <abraunst@lyx.org>
- * textcursor.[Ch] (selStart,selEnd): add new methods
+ * textcursor.[Ch] (selStart,selEnd): add new methods
remove selection::start, end, use LyXCursor::operator<
* lyxcursor.[Ch] (operator<): add
* BufferView_pimpl.[Ch]: add new struct xsel_cache_
2003-12-08 Alfredo Braunstein <abraunst@libero.it>
* lyxtext.h, text2.C (setLayout): don't use cursor to iterate,
- when a pit is enough. Standarize a couple of loops.
+ when a pit is enough. Standarize a couple of loops.
2003-12-05 Angus Leeming <leeming@lyx.org>
* lyxtext.h:
* paragraph_funcs.[Ch]: consolidate parts of Buffer::read() and
InsetText::read() as LyXText::read()
-
+
2003-12-02 Angus Leeming <leeming@lyx.org>
* lyxlex.[Ch] (operator void const *): add the 'const' to the return
* lyxfunc.C: move LFUN_INSET_TOGGLE handling to insets.
- * undo.C: fix cursor positioning
+ * undo.C: fix cursor positioning
2003-12-01 John Levon <levon@movementarian.org>
2003-11-27 Martin Vermeer <martin.vermeer@hut.fi>
- * buffer.C:
+ * buffer.C:
* lyxtextclass.[Ch]: parametrize SGML document header
2003-11-27 Martin Vermeer <martin.vermeer@hut.fi>
2003-11-27 Alfredo Braunstein <abraunst@lyx.org>
* text2.C (setFont): rework using PosIterator (no more recursive)
- (setCharFont): no more needed
+ (setCharFont): no more needed
(setLayout): no more selection cursors fiddling (done by redoCursor)
* text.C: cursorRight(bv)->cursorRight(true) (TODO: find and
destroy remaining ones)
* rowpainter.C: simplification
- * text2.C (updateCounters): remove call to redoParagraph on
+ * text2.C (updateCounters): remove call to redoParagraph on
changed labels as this is far too expensive.
2003-11-24 Alfredo Braunstein <abraunst@lyx.org>