Simplify things just a little bit.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24967 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-05-27 18:57:16 +00:00
parent 891cfdda68
commit 32f1dce79a
3 changed files with 17 additions and 17 deletions

View File

@ -21,6 +21,20 @@ using namespace std;
namespace lyx {
namespace {
class BranchNamesEqual : public std::unary_function<Branch, bool> {
public:
BranchNamesEqual(docstring const & name)
: name_(name) {}
bool operator()(Branch const & branch) const
{
return branch.getBranch() == name_;
}
private:
docstring name_;
};
}
Branch::Branch() : selected_(false)
{

View File

@ -115,17 +115,6 @@ private:
};
class BranchNamesEqual : public std::unary_function<Branch, bool> {
public:
BranchNamesEqual(docstring const & name)
: name_(name) {}
bool operator()(Branch const & branch) const
{
return branch.getBranch() == name_;
}
private:
docstring name_;
};
} // namespace lyx

View File

@ -195,13 +195,10 @@ bool InsetBranch::isBranchSelected() const
{
Buffer const & realbuffer = *buffer().masterBuffer();
BranchList const & branchlist = realbuffer.params().branchlist();
BranchList::const_iterator const end = branchlist.end();
BranchList::const_iterator it =
find_if(branchlist.begin(), end,
BranchNamesEqual(params_.branch));
if (it == end)
Branch const * ourBranch = branchlist.find(params_.branch);
if (!ourBranch)
return false;
return it->getSelected();
return ourBranch->getSelected();
}