Make some functors adaptable and related small stuff.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8324 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2004-01-07 17:57:47 +00:00
parent 5f96595b44
commit 2f33eaa286
11 changed files with 41 additions and 22 deletions

View File

@ -1,3 +1,9 @@
2004-01-07 Lars Gullik Bjonnes <larsbj@gullik.net>
* ShareContainer.h: make isEqual and isUnique adaptable
* CutAndPaste.C: make resetOwnerAndChanges adaptable
2004-01-07 Angus Leeming <leeming@lyx.org>
* LyXAction.C:

View File

@ -165,8 +165,8 @@ PitPosPair CutAndPaste::eraseSelection(BufferParams const & params,
namespace {
struct resetOwnerAndChanges {
void operator()(Paragraph & p) {
struct resetOwnerAndChanges : public std::unary_function<Paragraph, void> {
void operator()(Paragraph & p) const {
p.cleanChanges();
p.setInsetOwner(0);
}

View File

@ -62,7 +62,7 @@ public:
}
private:
/// A functor returning true if the elements are equal.
struct isEqual {
struct isEqual : public std::unary_function<value_type, bool> {
isEqual(Share const & s) : p_(s) {}
bool operator()(value_type const & p1) const {
return *p1.get() == p_;
@ -71,7 +71,7 @@ private:
Share const & p_;
};
/// A functor returning true if the element is unique.
struct isUnique {
struct isUnique : public std::unary_function<value_type, bool> {
bool operator()(value_type const & p) const {
return p.unique();
}

View File

@ -1,3 +1,10 @@
2004-01-07 Lars Gullik Bjonnes <larsbj@gullik.net>
* ControlSendto.C (allFormats): use the unique-erase idom and
simplify some code a bit.
* ControlMath.C: make CompareKey adaptable
2004-01-07 Angus Leeming <leeming@lyx.org>
* ControlSearch.C:
@ -55,7 +62,7 @@
(readBB): attempt to read the BoundingBox from the graphics file.
If that fails, try the Graphics Cache.
(all_origins, origin_gui_str): helpers for the frontends.
2003-12-01 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* ControlVSpace.C: enable the buttons for new insets.
@ -89,7 +96,7 @@
2003-11-04 Alfredo Braunstein <abraunst@libero.it>
* ControlSpellchecker.[Ch] (nextWord, check): rewrite of the text
* ControlSpellchecker.[Ch] (nextWord, check): rewrite of the text
handling parts
2003-10-27 Juergen Spitzmueller <j.spitzmueller@gmx.de>

View File

@ -288,10 +288,10 @@ bool operator<(XPMmap const & lhs, XPMmap const & rhs)
}
struct CompareKey {
struct CompareKey : public std::unary_function<XPMmap, bool> {
CompareKey(string const & name) : name_(name) {}
bool operator()(XPMmap const & other) {
return compare(other.key, name_.c_str()) == 0;
bool operator()(XPMmap const & other) const {
return other.key == name_;
}
private:
string const name_;

View File

@ -85,13 +85,7 @@ vector<Format const *> const ControlSendto::allFormats() const
// Remove repeated formats.
std::sort(to.begin(), to.end());
vector<Format const *>::iterator to_begin = to.begin();
vector<Format const *>::iterator to_end = to.end();
vector<Format const *>::iterator to_it =
std::unique(to_begin, to_end);
if (to_it != to_end)
to.erase(to_it, to_end);
to.erase(std::unique(to.begin(), to.end()), to.end());
return to;
}

View File

@ -1,3 +1,9 @@
2004-01-07 Lars Gullik Bjonnes <larsbj@gullik.net>
* FormForks.C: make FindPID adaptable and constify operator()
* FormFiledialog.C: make comp_direntry adaptable
2004-01-05 Angus Leeming <leeming@lyx.org>
* FormFiledialog.C (glob2regex, globMatch): removed.
@ -159,7 +165,7 @@
* forms/form_maths_panel.fd (label): replace label "Greek" by
"abg" for alpha beta gamma.
* forms/form_tabular.fd (label):
* forms/form_tabular.fd (label):
* FormDocument.C (build): remove use of latin1 in
some translatable strings. This confuses gettext.

View File

@ -172,7 +172,7 @@ UserCache lyxUserCache;
GroupCache lyxGroupCache;
// compares two LyXDirEntry objects content (used for sort)
class comp_direntry {
class comp_direntry : public std::binary_function<DirEntry, DirEntry, bool> {
public:
bool operator()(DirEntry const & r1, DirEntry const & r2) const
{
@ -241,7 +241,7 @@ void FileDialog::Private::Reread()
vector<string> const glob_matches =
lyx::support::expand_globs(mask_, directory_);
time_t curTime = time(0);
rewinddir(dir);
while (dirent * entry = readdir(dir)) {

View File

@ -250,10 +250,10 @@ ButtonPolicy::SMInput FormForks::input_browser_children()
namespace {
class FindPID {
class FindPID : public std::unary_function<string, bool> {
public:
FindPID(string const & pid) : pid_(pid) {}
bool operator()(string const & line)
bool operator()(string const & line) const
{
if (line.empty())
return false;

View File

@ -1,3 +1,7 @@
2004-01-07 Lars Gullik Bjonnes <larsbj@gullik.net>
* GraphicsTypes.C: include <string>
2003-11-20 Lars Gullik Bjonnes <larsbj@gullik.net>
* Previews.C: include paragraph.h

View File

@ -12,6 +12,8 @@
#include "graphics/GraphicsTypes.h"
#include <string>
using std::string;
@ -36,7 +38,7 @@ Translator<DisplayType, string> const initTranslator()
} // namespace anon
Translator<DisplayType, string> const & displayTranslator()
Translator<DisplayType, string> const & displayTranslator()
{
static Translator<DisplayType, string> const translator =
initTranslator();