summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9387970)
-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_;
-};
-
-} // namespace anon
-
string const & Branch::getBranch() const
{
string const & Branch::getBranch() const
{
std::string separator_;
};
std::string separator_;
};
+
+class BranchNamesEqual : public std::unary_function<Branch, bool> {
+public:
+ BranchNamesEqual(std::string const & name)
+ : name_(name) {}
+ bool operator()(Branch const & branch) const
+ {
+ return branch.getBranch() == name_;
+ }
+private:
+ std::string name_;
+};
+
2004-01-05 Lars Gullik Bjonnes <larsbj@gullik.net>
2004-01-05 Lars Gullik Bjonnes <larsbj@gullik.net>
+ * BranchList.h: move the BranchNamesEqual functor here from...
+ * BranchList.C: ... to here
+
* BranchList.C: new BranchListEqual fuctor, use it. Remove
SameName and match.
(add): replace a finding loop with std::find_if.
* BranchList.C: new BranchListEqual fuctor, use it. Remove
SameName and match.
(add): replace a finding loop with std::find_if.
+2004-01-05 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * insetbranch.C (isBranchSelected): use the BranchNamesEqual
+ functor
+ get rid of the SameName functor
+
+ * insettabular.C: improve the functor.
+
2003-12-29 Angus Leeming <leeming@lyx.org>
* insetexternal.C (setParams): update defaultTemplateName.
2003-12-29 Angus Leeming <leeming@lyx.org>
* insetexternal.C (setParams): update defaultTemplateName.
# insetsection.h \
# insetsection.C \
# insettheorem.C \
# insetsection.h \
# insetsection.C \
# insettheorem.C \
#include "support/std_sstream.h"
#include "support/std_sstream.h"
using std::string;
using std::auto_ptr;
using std::istringstream;
using std::string;
using std::auto_ptr;
using std::istringstream;
return DispatchResult(true);
}
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
return DispatchResult(true);
}
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
default:
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
}
}
default:
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
}
}
-namespace {
-
-struct SameBranch {
- SameBranch(string const & branch_name) : bn(branch_name) {}
- bool operator()(Branch const & branch) const
- { return bn == branch.getBranch(); }
-private:
- string bn;
-};
-
-} // namespace anon
-
-
bool InsetBranch::isBranchSelected(BranchList const & branchlist) const
{
bool InsetBranch::isBranchSelected(BranchList const & branchlist) const
{
- BranchList::const_iterator it = branchlist.begin();
BranchList::const_iterator const end = branchlist.end();
BranchList::const_iterator const end = branchlist.end();
- it = std::find_if(it, end, SameBranch(params_.branch));
+ BranchList::const_iterator it =
+ std::find_if(branchlist.begin(), end,
+ BranchNamesEqual(params_.branch));
if (it == end)
return false;
return it->getSelected();
if (it == end)
return false;
return it->getSelected();
#include "frontends/Painter.h"
#include "support/std_sstream.h"
#include "frontends/Painter.h"
#include "support/std_sstream.h"
#include <iostream>
using lyx::graphics::PreviewLoader;
#include <iostream>
using lyx::graphics::PreviewLoader;
{ LyXTabular::LAST_ACTION, "" }
};
{ LyXTabular::LAST_ACTION, "" }
};
-struct FindFeature {
- ///
- FindFeature(LyXTabular::Feature feature)
- : feature_(feature)
- {}
- ///
- bool operator()(TabularFeature & tf)
- {
+
+class FeatureEqual : public std::unary_function<TabularFeature, bool> {
+public:
+ FeatureEqual(LyXTabular::Feature feature)
+ : feature_(feature) {}
+ bool operator()(TabularFeature const & tf) const {
return tf.action == feature_;
}
private:
return tf.action == feature_;
}
private:
LyXTabular::Feature feature_;
};
LyXTabular::Feature feature_;
};
string const featureAsString(LyXTabular::Feature feature)
{
string const featureAsString(LyXTabular::Feature feature)
{
- TabularFeature * it = tabularFeature;
- TabularFeature * end = it +
+ TabularFeature * end = tabularFeature +
sizeof(tabularFeature) / sizeof(TabularFeature);
sizeof(tabularFeature) / sizeof(TabularFeature);
- it = std::find_if(it, end, FindFeature(feature));
+ TabularFeature * it = std::find_if(tabularFeature, end,
+ FeatureEqual(feature));
return (it == end) ? string() : it->feature;
}
return (it == end) ? string() : it->feature;
}
continue;
if (first_visible_cell < 0)
first_visible_cell = cell;
continue;
if (first_visible_cell < 0)
first_visible_cell = cell;
drawCellSelection(pi.pain, nx, y, i, j, cell);
int const cx = nx + tabular.getBeginningOfTextInCell(cell);
drawCellSelection(pi.pain, nx, y, i, j, cell);
int const cx = nx + tabular.getBeginningOfTextInCell(cell);
case LFUN_MOUSE_RELEASE:
lfunMouseRelease(cmd);
return DispatchResult(true, true);
case LFUN_MOUSE_RELEASE:
lfunMouseRelease(cmd);
return DispatchResult(true, true);
default:
break;
}
int cell = bv->cursor().data_.back().idx_;
if (cell != -1) {
default:
break;
}
int cell = bv->cursor().data_.back().idx_;
if (cell != -1) {
- lyxerr << "## ERROR ## InsetTabular::priv_dispatch: actcell: "
+ lyxerr << "## ERROR ## InsetTabular::priv_dispatch: actcell: "
<< actcell << " and cell " << cell << " should be the same "
<< "here" << endl;
}
<< actcell << " and cell " << cell << " should be the same "
<< "here" << endl;
}