From 4d63bd347b9535ee095b032d292838100106d49d Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Wed, 13 Aug 2008 13:46:19 +0000 Subject: [PATCH] constification without any code change. This is part of and effort to see whether BufferView::cursor() could be made const git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26141 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Cursor.cpp | 18 +++++++++--------- src/Cursor.h | 18 +++++++++--------- src/CutAndPaste.cpp | 10 +++++----- src/CutAndPaste.h | 6 +++--- src/Text.cpp | 4 ++-- src/Text.h | 4 ++-- src/Undo.cpp | 14 +++++++------- src/Undo.h | 10 +++++----- 8 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/Cursor.cpp b/src/Cursor.cpp index ad98883954..98d18fa125 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -1903,7 +1903,7 @@ docstring Cursor::selectionAsString(bool with_label) const } -docstring Cursor::currentState() +docstring Cursor::currentState() const { if (inMathed()) { odocstringstream os; @@ -1918,7 +1918,7 @@ docstring Cursor::currentState() } -docstring Cursor::getPossibleLabel() +docstring Cursor::getPossibleLabel() const { return inMathed() ? from_ascii("eq:") : text()->getPossibleLabel(*this); } @@ -2112,43 +2112,43 @@ bool Cursor::textRedo() } -void Cursor::finishUndo() +void Cursor::finishUndo() const { bv_->buffer().undo().finishUndo(); } -void Cursor::recordUndo(UndoKind kind, pit_type from, pit_type to) +void Cursor::recordUndo(UndoKind kind, pit_type from, pit_type to) const { bv_->buffer().undo().recordUndo(*this, kind, from, to); } -void Cursor::recordUndo(UndoKind kind, pit_type from) +void Cursor::recordUndo(UndoKind kind, pit_type from) const { bv_->buffer().undo().recordUndo(*this, kind, from); } -void Cursor::recordUndo(UndoKind kind) +void Cursor::recordUndo(UndoKind kind) const { bv_->buffer().undo().recordUndo(*this, kind); } -void Cursor::recordUndoInset(UndoKind kind) +void Cursor::recordUndoInset(UndoKind kind) const { bv_->buffer().undo().recordUndoInset(*this, kind); } -void Cursor::recordUndoFullDocument() +void Cursor::recordUndoFullDocument() const { bv_->buffer().undo().recordUndoFullDocument(*this); } -void Cursor::recordUndoSelection() +void Cursor::recordUndoSelection() const { if (inMathed()) { if (cap::multipleCellsSelected(*this)) diff --git a/src/Cursor.h b/src/Cursor.h index edb2f862cc..c5277927c8 100644 --- a/src/Cursor.h +++ b/src/Cursor.h @@ -100,7 +100,7 @@ public: /// docstring selectionAsString(bool label) const; /// - docstring currentState(); + docstring currentState() const; /// auto-correct mode bool autocorrect() const { return autocorrect_; } @@ -240,26 +240,26 @@ public: bool textRedo(); /// makes sure the next operation will be stored - void finishUndo(); + void finishUndo() const; /// The general case: prepare undo for an arbitrary range. - void recordUndo(UndoKind kind, pit_type from, pit_type to); + void recordUndo(UndoKind kind, pit_type from, pit_type to) const; /// Convenience: prepare undo for the range between 'from' and cursor. - void recordUndo(UndoKind kind, pit_type from); + void recordUndo(UndoKind kind, pit_type from) const; /// Convenience: prepare undo for the single paragraph or cell /// containing the cursor - void recordUndo(UndoKind kind = ATOMIC_UNDO); + void recordUndo(UndoKind kind = ATOMIC_UNDO) const; /// Convenience: prepare undo for the inset containing the cursor - void recordUndoInset(UndoKind kind = ATOMIC_UNDO); + void recordUndoInset(UndoKind kind = ATOMIC_UNDO) const; /// Convenience: prepare undo for the whole buffer - void recordUndoFullDocument(); + void recordUndoFullDocument() const; /// Convenience: prepare undo for the selected paragraphs or cells - void recordUndoSelection(); + void recordUndoSelection() const; /// void checkBufferStructure(); @@ -400,7 +400,7 @@ public: /// display an error message void errorMessage(docstring const & msg) const; /// - docstring getPossibleLabel(); + docstring getPossibleLabel() const; /// the name of the macro we are currently inputting docstring macroName(); diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index 2cadd1deeb..813d28a2e3 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -387,7 +387,7 @@ void putClipboard(ParagraphList const & paragraphs, } -void copySelectionHelper(Buffer const & buf, ParagraphList & pars, +void copySelectionHelper(Buffer const & buf, ParagraphList const & pars, pit_type startpit, pit_type endpit, int start, int end, DocumentClass const * const dc, CutStack & cutstack) { @@ -675,7 +675,7 @@ void cutSelection(Cursor & cur, bool doclear, bool realcut) } -void copySelection(Cursor & cur) +void copySelection(Cursor const & cur) { copySelection(cur, cur.selectionAsString(true)); } @@ -683,7 +683,7 @@ void copySelection(Cursor & cur) namespace { -void copySelectionToStack(Cursor & cur, CutStack & cutstack) +void copySelectionToStack(Cursor const & cur, CutStack & cutstack) { // this doesn't make sense, if there is no selection if (!cur.selection()) @@ -737,7 +737,7 @@ void copySelectionToStack() } -void copySelection(Cursor & cur, docstring const & plaintext) +void copySelection(Cursor const & cur, docstring const & plaintext) { // In tablemode, because copy and paste actually use special table stack // we do not attempt to get selected paragraphs under cursor. Instead, a @@ -760,7 +760,7 @@ void copySelection(Cursor & cur, docstring const & plaintext) } -void saveSelection(Cursor & cur) +void saveSelection(Cursor const & cur) { // This function is called, not when a selection is formed, but when // a selection is cleared. Therefore, multiple keyboard selection diff --git a/src/CutAndPaste.h b/src/CutAndPaste.h index 3d6e3808f6..fb6ba8f576 100644 --- a/src/CutAndPaste.h +++ b/src/CutAndPaste.h @@ -63,17 +63,17 @@ void replaceSelection(Cursor & cur); */ void cutSelection(Cursor & cur, bool doclear = true, bool realcut = true); /// Push the current selection to the cut buffer and the system clipboard. -void copySelection(Cursor & cur); +void copySelection(Cursor const & cur); /** * Push the current selection to the cut buffer and the system clipboard. * \param plaintext plain text version of the selection for the system * clipboard */ -void copySelection(Cursor & cur, docstring const & plaintext); +void copySelection(Cursor const & cur, docstring const & plaintext); /// Push the selection buffer to the cut buffer. void copySelectionToStack(); /// Store the current selection in the internal selection buffer -void saveSelection(Cursor & cur); +void saveSelection(Cursor const & cur); /// Is a selection available in our selection buffer? bool selection(); /// Clear our selection buffer diff --git a/src/Text.cpp b/src/Text.cpp index c149ad7973..77a668f901 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -1332,7 +1332,7 @@ bool Text::read(Buffer const & buf, Lexer & lex, } // Returns the current font and depth as a message. -docstring Text::currentState(Cursor & cur) +docstring Text::currentState(Cursor const & cur) const { LASSERT(this == cur.text(), /**/); Buffer & buf = cur.buffer(); @@ -1411,7 +1411,7 @@ docstring Text::currentState(Cursor & cur) } -docstring Text::getPossibleLabel(Cursor & cur) const +docstring Text::getPossibleLabel(Cursor const & cur) const { pit_type pit = cur.pit(); diff --git a/src/Text.h b/src/Text.h index 34977dab01..72f8b89902 100644 --- a/src/Text.h +++ b/src/Text.h @@ -128,7 +128,7 @@ public: Paragraph & getPar(pit_type pit) { return pars_[pit]; } // Returns the current font and depth as a message. /// FIXME: replace Cursor with DocIterator. - docstring currentState(Cursor & cur); + docstring currentState(Cursor const & cur) const; /** Find the word under \c from in the relative location * defined by \c word_location. @@ -254,7 +254,7 @@ public: double spacing(Buffer const & buffer, Paragraph const & par) const; /// make a suggestion for a label /// FIXME: replace Cursor with DocIterator. - docstring getPossibleLabel(Cursor & cur) const; + docstring getPossibleLabel(Cursor const & cur) const; /// is this paragraph right-to-left? bool isRTL(Buffer const &, Paragraph const & par) const; diff --git a/src/Undo.cpp b/src/Undo.cpp index 4e2ac02c88..1e4b199806 100644 --- a/src/Undo.cpp +++ b/src/Undo.cpp @@ -181,7 +181,7 @@ struct Undo::Private /// void recordUndo(UndoKind kind, - DocIterator & cur, + DocIterator const & cur, pit_type first_pit, pit_type last_pit); @@ -297,7 +297,7 @@ void Undo::Private::doRecordUndo(UndoKind kind, } -void Undo::Private::recordUndo(UndoKind kind, DocIterator & cur, +void Undo::Private::recordUndo(UndoKind kind, DocIterator const & cur, pit_type first_pit, pit_type last_pit) { LASSERT(first_pit <= cur.lastpit(), /**/); @@ -419,13 +419,13 @@ bool Undo::textRedo(DocIterator & cur) } -void Undo::recordUndo(DocIterator & cur, UndoKind kind) +void Undo::recordUndo(DocIterator const & cur, UndoKind kind) { d->recordUndo(kind, cur, cur.pit(), cur.pit()); } -void Undo::recordUndoInset(DocIterator & cur, UndoKind kind) +void Undo::recordUndoInset(DocIterator const & cur, UndoKind kind) { DocIterator c = cur; c.pop_back(); @@ -433,20 +433,20 @@ void Undo::recordUndoInset(DocIterator & cur, UndoKind kind) } -void Undo::recordUndo(DocIterator & cur, UndoKind kind, pit_type from) +void Undo::recordUndo(DocIterator const & cur, UndoKind kind, pit_type from) { d->recordUndo(kind, cur, cur.pit(), from); } -void Undo::recordUndo(DocIterator & cur, UndoKind kind, +void Undo::recordUndo(DocIterator const & cur, UndoKind kind, pit_type from, pit_type to) { d->recordUndo(kind, cur, from, to); } -void Undo::recordUndoFullDocument(DocIterator & cur) +void Undo::recordUndoFullDocument(DocIterator const & cur) { d->doRecordUndo( ATOMIC_UNDO, diff --git a/src/Undo.h b/src/Undo.h index 160f3ac40e..dbb7a17649 100644 --- a/src/Undo.h +++ b/src/Undo.h @@ -80,20 +80,20 @@ public: bool hasRedoStack() const; /// The general case: prepare undo for an arbitrary range. - void recordUndo(DocIterator & cur, UndoKind kind, + void recordUndo(DocIterator const & cur, UndoKind kind, pit_type from, pit_type to); /// Convenience: prepare undo for the range between 'from' and cursor. - void recordUndo(DocIterator & cur, UndoKind kind, pit_type from); + void recordUndo(DocIterator const & cur, UndoKind kind, pit_type from); /// Convenience: prepare undo for the single paragraph or cell /// containing the cursor - void recordUndo(DocIterator & cur, UndoKind kind = ATOMIC_UNDO); + void recordUndo(DocIterator const & cur, UndoKind kind = ATOMIC_UNDO); /// Convenience: prepare undo for the inset containing the cursor - void recordUndoInset(DocIterator & cur, UndoKind kind = ATOMIC_UNDO); + void recordUndoInset(DocIterator const & cur, UndoKind kind = ATOMIC_UNDO); /// Convenience: prepare undo for the whole buffer - void recordUndoFullDocument(DocIterator & cur); + void recordUndoFullDocument(DocIterator const & cur); private: struct Private; -- 2.39.5