mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
use std::advance and std::distance instead of home-grown versions
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8372 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1eaa3eb913
commit
7ea6f6e883
@ -1,3 +1,7 @@
|
||||
2004-01-26 Lars Gullik Bjonnes <larsbj@gullik.net>
|
||||
|
||||
* libs/regex/src/Makefile.am: remove trailing backslash
|
||||
|
||||
2004-01-08 Lars Gullik Bjonnes <larsbj@gullik.net>
|
||||
|
||||
* add boost::filesystem.
|
||||
|
@ -19,4 +19,4 @@ libboostregex_la_SOURCES = \
|
||||
# posix_api.cpp \
|
||||
# wide_posix_api.cpp \
|
||||
# regex_debug.cpp
|
||||
# winstances.cpp \
|
||||
# winstances.cpp
|
||||
|
@ -27,9 +27,7 @@ src/frontends/controllers/ControlLog.C
|
||||
src/frontends/controllers/ControlPreamble.C
|
||||
src/frontends/controllers/ControlPrefs.C
|
||||
src/frontends/controllers/ControlPrint.C
|
||||
src/frontends/controllers/ControlSearch.C
|
||||
src/frontends/controllers/ControlSpellchecker.C
|
||||
src/frontends/controllers/ControlThesaurus.C
|
||||
src/frontends/controllers/biblio.C
|
||||
src/frontends/controllers/character.C
|
||||
src/frontends/controllers/frnt_lang.C
|
||||
@ -141,7 +139,7 @@ src/frontends/xforms/xformsBC.h
|
||||
src/frontends/xforms/xforms_helpers.C
|
||||
src/gettext.h
|
||||
src/importer.C
|
||||
src/insets/inset.C
|
||||
src/insets/insetbase.C
|
||||
src/insets/insetbibtex.C
|
||||
src/insets/insetbox.C
|
||||
src/insets/insetbranch.C
|
||||
@ -185,6 +183,7 @@ src/mathed/formulabase.C
|
||||
src/mathed/formulamacro.C
|
||||
src/mathed/math_hullinset.C
|
||||
src/mathed/math_macrotemplate.C
|
||||
src/mathed/math_nestinset.C
|
||||
src/mathed/math_parboxinset.C
|
||||
src/mathed/ref_inset.C
|
||||
src/output.C
|
||||
@ -194,6 +193,9 @@ src/output_plaintext.C
|
||||
src/paragraph.C
|
||||
src/paragraph_funcs.C
|
||||
src/rowpainter.C
|
||||
src/support/globbing.C
|
||||
src/support/path_defines.C
|
||||
src/tex2lyx/lengthcommon.C
|
||||
src/text.C
|
||||
src/text2.C
|
||||
src/text3.C
|
||||
|
@ -1,4 +1,11 @@
|
||||
2004-01-26 Lars Gullik Bjonnes <larsbj@gullik.net>
|
||||
|
||||
* lyxfind.C (replaceAll): use std::advance
|
||||
|
||||
* iterators.h: inherit from std::iterator.
|
||||
|
||||
* PosIterator.C (advance, distance): remove
|
||||
* PosIterator.h: interit from std::iterator.
|
||||
|
||||
2004-01-26 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
|
@ -151,21 +151,3 @@ InsetBase * PosIterator::inset() const
|
||||
PosIteratorItem const & pi = stack_[stack_.size() - 2];
|
||||
return pi.pit->getInset(pi.pos);
|
||||
}
|
||||
|
||||
|
||||
int distance(PosIterator const & cur, PosIterator const & end)
|
||||
{
|
||||
int count = 0;
|
||||
for (PosIterator p = cur; p != end; ++p, ++count)
|
||||
;
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
void advance(PosIterator & cur, int howmuch)
|
||||
{
|
||||
for (int i = 0; i < howmuch; ++i)
|
||||
++cur;
|
||||
for (int i = 0; i > howmuch; --i)
|
||||
--cur;
|
||||
}
|
||||
|
@ -35,7 +35,9 @@ struct PosIteratorItem {
|
||||
};
|
||||
|
||||
|
||||
class PosIterator {
|
||||
class PosIterator : public std::iterator<
|
||||
std::bidirectional_iterator_tag,
|
||||
ParagraphList::value_type> {
|
||||
public:
|
||||
PosIterator(BufferView & bv);
|
||||
PosIterator(ParIterator & par, lyx::pos_type pos);
|
||||
@ -63,8 +65,4 @@ private:
|
||||
bool operator!=(PosIterator const &, PosIterator const &);
|
||||
bool operator==(PosIterator const &, PosIterator const &);
|
||||
|
||||
int distance(PosIterator const &, PosIterator const &);
|
||||
void advance(PosIterator &, int);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2004-01-26 Lars Gullik Bjonnes <larsbj@gullik.net>
|
||||
|
||||
* ControlSpellchecker.C (check): use std::distance and
|
||||
std::advance
|
||||
|
||||
2004-01-25 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ControlSearch.[Ch]: derive from Dialog::Controller rather than
|
||||
|
@ -195,8 +195,8 @@ void ControlSpellchecker::check()
|
||||
PosIterator const beg = buffer()->pos_iterator_begin();
|
||||
PosIterator const end = buffer()->pos_iterator_end();
|
||||
|
||||
int start = distance(beg, cur);
|
||||
int const total = start + distance(cur, end);
|
||||
int start = std::distance(beg, cur);
|
||||
int const total = start + std::distance(cur, end);
|
||||
|
||||
if (cur != buffer()->pos_iterator_begin())
|
||||
for (; cur != end && isLetter(cur); ++cur, ++start);
|
||||
@ -235,9 +235,9 @@ void ControlSpellchecker::check()
|
||||
|
||||
if (!word_.word().empty()) {
|
||||
int const size = word_.word().size();
|
||||
advance(cur, -size);
|
||||
std::advance(cur, -size);
|
||||
bufferview()->putSelectionAt(cur, size, false);
|
||||
advance(cur, size);
|
||||
std::advance(cur, size);
|
||||
} else {
|
||||
showSummary();
|
||||
endSession();
|
||||
|
@ -25,7 +25,9 @@ class BufferView;
|
||||
class PosIterator;
|
||||
|
||||
|
||||
class ParIterator {
|
||||
class ParIterator : public std::iterator<
|
||||
std::forward_iterator_tag,
|
||||
ParagraphList::value_type> {
|
||||
public:
|
||||
///
|
||||
ParIterator(ParagraphList::iterator pit, ParagraphList const & pl);
|
||||
@ -77,7 +79,9 @@ bool operator==(ParIterator const & iter1, ParIterator const & iter2);
|
||||
bool operator!=(ParIterator const & iter1, ParIterator const & iter2);
|
||||
|
||||
|
||||
class ParConstIterator {
|
||||
class ParConstIterator : public std::iterator<
|
||||
std::forward_iterator_tag,
|
||||
ParagraphList::value_type> {
|
||||
public:
|
||||
///
|
||||
ParConstIterator(ParagraphList::iterator pit, ParagraphList const & pl);
|
||||
|
@ -78,7 +78,7 @@ namespace lyx {
|
||||
namespace find {
|
||||
|
||||
string const find2string(string const & search,
|
||||
bool casesensitive, bool matchword, bool forward)
|
||||
bool casesensitive, bool matchword, bool forward)
|
||||
{
|
||||
ostringstream ss;
|
||||
ss << search << '\n'
|
||||
@ -345,7 +345,7 @@ int replaceAll(BufferView * bv,
|
||||
= cur.pit()->getFontSettings(buf.params(), pos);
|
||||
int striked = ssize - cur.pit()->erase(pos, pos + ssize);
|
||||
cur.pit()->insert(pos, replacestr, font);
|
||||
advance(cur, rsize + striked);
|
||||
std::advance(cur, rsize + striked);
|
||||
++num;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user