]> git.lyx.org Git - features.git/commitdiff
Make some functors adaptable and related small stuff.
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 7 Jan 2004 17:57:47 +0000 (17:57 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 7 Jan 2004 17:57:47 +0000 (17:57 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8324 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/CutAndPaste.C
src/ShareContainer.h
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlMath.C
src/frontends/controllers/ControlSendto.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormFiledialog.C
src/frontends/xforms/FormForks.C
src/graphics/ChangeLog
src/graphics/GraphicsTypes.C

index f4a2d8453cb5c679835186325dc74162ac14e565..dcbafa8f0a39ff9d9a4d184db578407ffee92236 100644 (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:
index 23d0765ae55298102842f85482571ce057d1b233..522b7d31ef9b44e601bd8fb7fd4e5d5a82abae82 100644 (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);
        }
index d37dc3580d02c3009faca336fd4c08e3a33ce7ee..fc44c3bfb5a752de1629ffaa79c4fa18f7b540ca 100644 (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();
                }
index 80a4f0024976af9c3d55665fe77417a30d8873d5..fc68a40df05d5819b2060e88c249f4999bc24794 100644 (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>
index dccfdce253f310fd39db6ce86c7c25acc240fa6f..fa848a34f8ef95987df5d0eb63481a5f71f2ed04 100644 (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_;
index b9ea5f9ee2b846866faf84053867861bb4f581cc..7f53533d2eeeecc19eabb46ca235e9adda36ffad 100644 (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;
 }
index 39c431c1a37596e4120d04e596c5cbecda6ff704..150ca6c2da5a1e42c8f615af94046ba45d7bd228 100644 (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.
        * 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.
 
index 4c7b744a588ad41f1db73ece17729d95997b9f37..7ae6fc843b00225d70e1dea71720eda4538cf47a 100644 (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)) {
index b0a23bf87f972e046936a0caf29870b555661c24..83d3392defea8d937e8a8be215d13a7360ed9073 100644 (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;
index af2688935415e8d9a15b08adc570ca6d36469780..773d00f63f3f5ab413f5559f069c257b3e0657ad 100644 (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
index 82ff4cd7f7fed103c8bfc87aee7de262bc7b3185..f33da586ea921c2626a8f00a01f9bb8dbdf3367a 100644 (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();