diff --git a/src/Box.cpp b/src/Box.cpp index a3461ef3ea..28d2caa01c 100644 --- a/src/Box.cpp +++ b/src/Box.cpp @@ -31,7 +31,7 @@ Box::Box(int x1_, int x2_, int y1_, int y2_) {} -bool Box::contains(int x, int y) +bool Box::contains(int x, int y) const { return (x1 < x && x2 > x && y1 < y && y2 > y); } diff --git a/src/Box.h b/src/Box.h index c362fa6a38..9522ad0a79 100644 --- a/src/Box.h +++ b/src/Box.h @@ -42,7 +42,7 @@ public: * the box. Check is exclusive (point on a border * returns false). */ - bool contains(int x, int y); + bool contains(int x, int y) const; }; diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 9ba2373ea4..d25aa03fb8 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -1610,7 +1610,7 @@ bool Buffer::writeFile(FileName const & fname) const } -docstring Buffer::emergencyWrite() +docstring Buffer::emergencyWrite() const { // No need to save if the buffer has not changed. if (isClean()) diff --git a/src/Buffer.h b/src/Buffer.h index f65d31d654..a917c6e9f7 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -259,7 +259,7 @@ public: bool autoSave() const; /// save emergency file /// \return a status message towards the user. - docstring emergencyWrite(); + docstring emergencyWrite() const; //FIXME:The following function should be private //private: diff --git a/src/Compare.cpp b/src/Compare.cpp index 49bdac1bfa..51a28f16ec 100644 --- a/src/Compare.cpp +++ b/src/Compare.cpp @@ -107,7 +107,7 @@ public: : o(o_), n(n_) {} - bool operator!=(DocPair const & rhs) + bool operator!=(DocPair const & rhs) const { // this might not be intuitive but correct for our purpose return o != rhs.o && n != rhs.n; diff --git a/src/Converter.cpp b/src/Converter.cpp index ada329e5d9..747dd88ada 100644 --- a/src/Converter.cpp +++ b/src/Converter.cpp @@ -259,7 +259,7 @@ void Converters::updateLast(Formats const & formats) OutputParams::FLAVOR Converters::getFlavor(Graph::EdgePath const & path, - Buffer const * buffer) + Buffer const * buffer) const { for (auto const & edge : path) { Converter const & conv = converterlist_[edge]; @@ -283,7 +283,7 @@ OutputParams::FLAVOR Converters::getFlavor(Graph::EdgePath const & path, } -string Converters::getHyperrefDriver(Graph::EdgePath const & path) +string Converters::getHyperrefDriver(Graph::EdgePath const & path) const { for (auto const & edge : path) { Converter const & conv = converterlist_[edge]; @@ -818,7 +818,7 @@ bool Converters::move(string const & fmt, } -bool Converters::formatIsUsed(string const & format) +bool Converters::formatIsUsed(string const & format) const { for (auto const & cvt : converterlist_) { if (cvt.from() == format || cvt.to() == format) diff --git a/src/Converter.h b/src/Converter.h index e9efa00f4f..b9ee3292bb 100644 --- a/src/Converter.h +++ b/src/Converter.h @@ -176,9 +176,9 @@ public: Graph::EdgePath getPath(std::string const & from, std::string const & to); /// OutputParams::FLAVOR getFlavor(Graph::EdgePath const & path, - Buffer const * buffer = nullptr); + Buffer const * buffer = nullptr) const; /// - std::string getHyperrefDriver(Graph::EdgePath const & path); + std::string getHyperrefDriver(Graph::EdgePath const & path) const; /// Flags for converting files enum ConversionFlags { /// No special flags @@ -199,7 +199,7 @@ public: /// void updateLast(Formats const & formats); /// - bool formatIsUsed(std::string const & format); + bool formatIsUsed(std::string const & format) const; /// const_iterator begin() const { return converterlist_.begin(); } /// diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 7197b91cf2..9e7867c8d3 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -502,7 +502,7 @@ void CursorData::clearSelection() } -int CursorData::countInsetsInSelection(InsetCode const & inset_code) +int CursorData::countInsetsInSelection(InsetCode const & inset_code) const { if (!selection_) return 0; @@ -528,7 +528,7 @@ int CursorData::countInsetsInSelection(InsetCode const & inset_code) } -bool CursorData::insetInSelection(InsetCode const & inset_code) +bool CursorData::insetInSelection(InsetCode const & inset_code) const { if (!selection_) return false; @@ -669,7 +669,7 @@ void CursorData::recordUndoSelection() const } -int CursorData::currentMode() +int CursorData::currentMode() const { LASSERT(!empty(), return Inset::UNDECIDED_MODE); for (int i = depth() - 1; i >= 0; --i) { diff --git a/src/Cursor.h b/src/Cursor.h index fc4daeb93b..951a0cc4db 100644 --- a/src/Cursor.h +++ b/src/Cursor.h @@ -118,7 +118,7 @@ public: /// void setWordSelection(bool set) { word_selection_ = set; } /// - bool wordSelection() { return word_selection_; } + bool wordSelection() const { return word_selection_; } /// did we place the anchor? bool mark() const { return mark_; } /// did we place the anchor? @@ -131,10 +131,10 @@ public: void clearSelection(); /// check whether selection contains specific type of inset /// returns 0 if no selection was made - bool insetInSelection(InsetCode const & inset); + bool insetInSelection(InsetCode const & inset) const; /// count occurences of specific inset type in the selection /// returns 0 if no selection was made - int countInsetsInSelection(InsetCode const & inset); + int countInsetsInSelection(InsetCode const & inset) const; /// access to normalized selection anchor CursorSlice normalAnchor() const; @@ -207,7 +207,7 @@ public: DocIterator newWord() const { return new_word_; } /// are we in math mode (2), text mode (1) or unsure (0)? - int currentMode(); + int currentMode() const; /// Return true if the next or previous inset has confirmDeletion depending /// on the boolean before. If there is a selection, return true if at least diff --git a/src/DispatchResult.h b/src/DispatchResult.h index d8689898d8..ac1eb6c821 100644 --- a/src/DispatchResult.h +++ b/src/DispatchResult.h @@ -48,7 +48,7 @@ public: /// void setError(bool e) { error_ = e; } /// - docstring message() { return message_; } + docstring message() const { return message_; } /// void setMessage(docstring const & m) { message_ = m; } /// diff --git a/src/FuncRequest.h b/src/FuncRequest.h index 42829ae8de..19f571a091 100644 --- a/src/FuncRequest.h +++ b/src/FuncRequest.h @@ -86,7 +86,7 @@ public: /// mouse_button::state button() const { return button_; } /// - KeyModifier modifier() { return modifier_; } + KeyModifier modifier() const { return modifier_; } /// argument parsing, extract argument i as std::string std::string getArg(unsigned int i) const; diff --git a/src/LaTeX.h b/src/LaTeX.h index c57b03b830..994fbe07ff 100644 --- a/src/LaTeX.h +++ b/src/LaTeX.h @@ -185,7 +185,7 @@ public: int run(TeXErrors &); /// - int getNumErrors() { return num_errors;} + int getNumErrors() const { return num_errors;} /// int scanLogFile(TeXErrors &); diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 6578e2a19c..4ade252e72 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -359,19 +359,19 @@ public: char_type const c, otexstream & os, pos_type i, - unsigned int & column); + unsigned int & column) const; /// bool latexSpecialTU( char_type const c, otexstream & os, pos_type i, - unsigned int & column); + unsigned int & column) const; /// bool latexSpecialT3( char_type const c, otexstream & os, pos_type i, - unsigned int & column); + unsigned int & column) const; /// void validate(LaTeXFeatures & features) const; @@ -1316,7 +1316,7 @@ void Paragraph::Private::latexSpecialChar(otexstream & os, bool Paragraph::Private::latexSpecialT1(char_type const c, otexstream & os, - pos_type i, unsigned int & column) + pos_type i, unsigned int & column) const { switch (c) { case '>': @@ -1344,7 +1344,7 @@ bool Paragraph::Private::latexSpecialT1(char_type const c, otexstream & os, bool Paragraph::Private::latexSpecialTU(char_type const c, otexstream & os, - pos_type i, unsigned int & column) + pos_type i, unsigned int & column) const { // TU encoding is currently on par with T1. return latexSpecialT1(c, os, i, column); @@ -1352,7 +1352,7 @@ bool Paragraph::Private::latexSpecialTU(char_type const c, otexstream & os, bool Paragraph::Private::latexSpecialT3(char_type const c, otexstream & os, - pos_type /*i*/, unsigned int & column) + pos_type /*i*/, unsigned int & column) const { switch (c) { case '*': diff --git a/src/Server.h b/src/Server.h index 40021daa41..e20406a6d4 100644 --- a/src/Server.h +++ b/src/Server.h @@ -104,7 +104,7 @@ public: #endif /// Tell whether we asked another instance of LyX to open the files - bool deferredLoading() { return deferred_loading_; } + bool deferredLoading() const { return deferred_loading_; } private: /// the filename of the in pipe diff --git a/src/TocBackend.cpp b/src/TocBackend.cpp index 500d5e3ce0..d9ed95767a 100644 --- a/src/TocBackend.cpp +++ b/src/TocBackend.cpp @@ -153,7 +153,7 @@ TocBuilder & TocBackend::builder(string const & type) // TocItem creation and update should be made in a dedicated function and // updateItem should be rewritten to uniformly update the matching items from // all TOCs. -bool TocBackend::updateItem(DocIterator const & dit_in) +bool TocBackend::updateItem(DocIterator const & dit_in) const { // we need a text DocIterator dit = dit_in.getInnerText(); diff --git a/src/TocBackend.h b/src/TocBackend.h index 026f4f879b..b67ee60da3 100644 --- a/src/TocBackend.h +++ b/src/TocBackend.h @@ -116,7 +116,7 @@ public: /// void reset(); /// \return true if the item was updated. - bool updateItem(DocIterator const & pit); + bool updateItem(DocIterator const & pit) const; /// TocList const & tocs() const { return tocs_; } /// never null diff --git a/src/frontends/WorkAreaManager.cpp b/src/frontends/WorkAreaManager.cpp index c79f08bef7..0d1d189cf2 100644 --- a/src/frontends/WorkAreaManager.cpp +++ b/src/frontends/WorkAreaManager.cpp @@ -47,7 +47,7 @@ void WorkAreaManager::closeAll() } -bool WorkAreaManager::unhide(Buffer * buf) +bool WorkAreaManager::unhide(Buffer * buf) const { if (!work_areas_.empty()) return true; diff --git a/src/frontends/WorkAreaManager.h b/src/frontends/WorkAreaManager.h index 0434074ab4..cd716fc087 100644 --- a/src/frontends/WorkAreaManager.h +++ b/src/frontends/WorkAreaManager.h @@ -46,7 +46,7 @@ public: void updateTitles(); /// If there is no work area, create a new one in the current view using the /// buffer buf. Returns false if not possible. - bool unhide(Buffer * buf); + bool unhide(Buffer * buf) const; private: typedef std::list::iterator iterator; diff --git a/src/mathed/MacroTable.h b/src/mathed/MacroTable.h index e83be84b75..b588ee2cf9 100644 --- a/src/mathed/MacroTable.h +++ b/src/mathed/MacroTable.h @@ -73,7 +73,7 @@ public: /// void setSymbol(latexkeys const * sym) { sym_ = sym; } /// - DocIterator const & pos() { return pos_; } + DocIterator const & pos() const { return pos_; } /// lock while being drawn to avoid recursions int lock() const { return ++lockCount_; } diff --git a/src/tex2lyx/Parser.cpp b/src/tex2lyx/Parser.cpp index 62cab06fba..57253650f7 100644 --- a/src/tex2lyx/Parser.cpp +++ b/src/tex2lyx/Parser.cpp @@ -443,7 +443,7 @@ void Parser::dropPosition() } -bool Parser::good() +bool Parser::good() const { if (pos_ < tokens_.size()) return true; diff --git a/src/tex2lyx/Parser.h b/src/tex2lyx/Parser.h index ada6b5f72a..41384599c2 100644 --- a/src/tex2lyx/Parser.h +++ b/src/tex2lyx/Parser.h @@ -334,7 +334,7 @@ public: /// Is any further input pending()? This is not like /// std::istream::good(), which returns true if all available input /// was read, and the next attempt to read would return EOF. - bool good(); + bool good() const; /// resets the parser to initial state void reset();