]> git.lyx.org Git - features.git/commitdiff
Constify
authorYuriy Skalko <yuriy.skalko@gmail.com>
Wed, 25 Nov 2020 23:11:07 +0000 (01:11 +0200)
committerYuriy Skalko <yuriy.skalko@gmail.com>
Fri, 27 Nov 2020 10:16:45 +0000 (12:16 +0200)
src/Counters.cpp
src/Counters.h
src/Server.cpp
src/Server.h
src/graphics/PreviewImage.cpp
src/lyxfind.cpp
src/tex2lyx/Parser.cpp
src/tex2lyx/Parser.h

index 8477d5283ad90831ee366aa65835d3039d2d5350..139dc9bcd7bee3a14cca3f93b05144e2f6a8f35e 100644 (file)
@@ -413,7 +413,7 @@ bool Counters::remove(docstring const & cnt)
 }
 
 
-void Counters::copy(Counters const & from, Counters & to, docstring const & match)
+void Counters::copy(Counters const & from, Counters & to, docstring const & match) const
 {
        for (auto const & ctr : counterList_) {
                if (ctr.first.find(match) != string::npos || match == "") {
index 4708f5a331f8759f8f34cc41ba114247b4658033..e6554a284f37ae150e6fc709eab8c68a6567e98a 100644 (file)
@@ -163,7 +163,7 @@ public:
        /// Copy counters whose name matches match from the &from to
        /// the &to array of counters. Empty string matches all.
        void copy(Counters const & from, Counters & to,
-                 docstring const & match = docstring());
+                 docstring const & match = docstring()) const;
        /** returns the expanded string representation of counter \c
         *  c. The \c lang code is used to translate the string.
         */
index fe503926de2bcd1efed3c63f5745e29e9eaf49a5..79340492c6d62254beb78fcc8d03471b3ff5d3d2 100644 (file)
@@ -1003,7 +1003,7 @@ struct Sleep : QThread
 } // namespace
 
 
-bool LyXComm::loadFilesInOtherInstance()
+bool LyXComm::loadFilesInOtherInstance() const
 {
        int pipefd;
        FileName const pipe(inPipeName());
index 9257704b439beb11e2a01b6d69517a009c1a5b2f..b277284ace9b66b099750720903e437aa272972d 100644 (file)
@@ -120,7 +120,7 @@ private:
        void closeConnection();
 
        /// Load files in another running instance of LyX
-       bool loadFilesInOtherInstance();
+       bool loadFilesInOtherInstance() const;
 
 #ifndef _WIN32
        /// start a pipe
@@ -212,7 +212,7 @@ public:
        ///
        void notifyClient(std::string const &);
        ///
-       bool deferredLoadingToOtherInstance() { return pipes_.deferredLoading(); }
+       bool deferredLoadingToOtherInstance() const { return pipes_.deferredLoading(); }
 
        /// whilst crashing etc.
        void emergencyCleanup() { pipes_.emergencyCleanup(); }
index b80bf9415b5175bdabf77d1e50b2af144e733137..062dd6e7bccccf189f40f0c7aa31bffb6627e6d0 100644 (file)
@@ -35,7 +35,7 @@ public:
        ///
        ~Impl();
        ///
-       Image const * image();
+       Image const * image() const;
        ///
        void statusChanged();
 
@@ -125,7 +125,7 @@ PreviewImage::Impl::~Impl()
 }
 
 
-Image const * PreviewImage::Impl::image()
+Image const * PreviewImage::Impl::image() const
 {
        if (iloader_.status() == WaitingToLoad)
                iloader_.startLoading();
index c438052d2e1b209b62e11bbeb22d47705a2ac550..fc7b0b737a71522a0e006d0e7074afe62213e18f 100644 (file)
@@ -1101,20 +1101,20 @@ public:
   int depts[MAXOPENED];
   int closes[MAXOPENED];
   int actualdeptindex;
-  int previousNotIgnored(int);
-  int nextNotIgnored(int);
+  int previousNotIgnored(int) const;
+  int nextNotIgnored(int) const;
   void handleOpenP(int i);
   void handleCloseP(int i, bool closingAllowed);
   void resetOpenedP(int openPos);
   void addIntervall(int upper);
   void addIntervall(int low, int upper); /* if explicit */
   void removeAccents();
-  void setForDefaultLang(KeyInfo const & defLang);
+  void setForDefaultLang(KeyInfo const & defLang) const;
   int findclosing(int start, int end, char up, char down, int repeat);
   void handleParentheses(int lastpos, bool closingAllowed);
   bool hasTitle;
   int langcount;       // Number of disabled language specs up to current position in actual interval
-  int isOpeningPar(int pos);
+  int isOpeningPar(int pos) const;
   string titleValue;
   void output(ostringstream &os, int lastpos);
   // string show(int lastpos);
@@ -1122,7 +1122,7 @@ public:
 
 vector<Border> Intervall::borders = vector<Border>(30);
 
-int Intervall::isOpeningPar(int pos)
+int Intervall::isOpeningPar(int pos) const
 {
   if ((pos < 0) || (size_t(pos) >= par.size()))
     return 0;
@@ -1137,7 +1137,7 @@ int Intervall::isOpeningPar(int pos)
   return 1;
 }
 
-void Intervall::setForDefaultLang(KeyInfo const & defLang)
+void Intervall::setForDefaultLang(KeyInfo const & defLang) const
 {
   // Enable the use of first token again
   if (ignoreidx >= 0) {
@@ -1418,7 +1418,7 @@ void Intervall::resetOpenedP(int openPos)
   closes[1] = -1;
 }
 
-int Intervall::previousNotIgnored(int start)
+int Intervall::previousNotIgnored(int start) const
 {
     int idx = 0;                          /* int intervalls */
     for (idx = ignoreidx; idx >= 0; --idx) {
@@ -1430,7 +1430,7 @@ int Intervall::previousNotIgnored(int start)
     return start;
 }
 
-int Intervall::nextNotIgnored(int start)
+int Intervall::nextNotIgnored(int start) const
 {
     int idx = 0;                          /* int intervalls */
     for (idx = 0; idx <= ignoreidx; idx++) {
@@ -1504,7 +1504,7 @@ class LatexInfo {
     else
       return false;
   };
-  int find(int start, KeyInfo::KeyType keytype) {
+  int find(int start, KeyInfo::KeyType keytype) const {
     if (start < 0)
       return -1;
     int tmpIdx = start;
@@ -1526,7 +1526,7 @@ class LatexInfo {
     else
       return entries_[keyinfo];
   };
-  void setForDefaultLang(KeyInfo &defLang) {interval_.setForDefaultLang(defLang);};
+  void setForDefaultLang(KeyInfo const & defLang) {interval_.setForDefaultLang(defLang);};
   void addIntervall(int low, int up) { interval_.addIntervall(low, up); };
 };
 
@@ -1577,14 +1577,14 @@ class MathInfo {
     m.mathSize = end - start;
     entries_.push_back(m);
   }
-  bool empty() { return entries_.empty(); };
-  size_t getEndPos() {
+  bool empty() const { return entries_.empty(); };
+  size_t getEndPos() const {
     if (entries_.empty() || (actualIdx_ >= entries_.size())) {
       return 0;
     }
     return entries_[actualIdx_].mathEnd;
   }
-  size_t getStartPos() {
+  size_t getStartPos() const {
     if (entries_.empty() || (actualIdx_ >= entries_.size())) {
       return 100000;                    /*  definitely enough? */
     }
@@ -1594,7 +1594,7 @@ class MathInfo {
     actualIdx_ = 0;
     return getStartPos();
   }
-  size_t getSize() {
+  size_t getSize() const {
     if (entries_.empty() || (actualIdx_ >= entries_.size())) {
       return size_t(0);
     }
index ee25db246d9ac58c863e9c9ae1bc7134223afaa4..67e0323c961463a2ca76f6e313ede1a1c9b1c51d 100644 (file)
@@ -877,7 +877,7 @@ void Parser::dump() const
 }
 
 
-void Parser::error(string const & msg)
+void Parser::error(string const & msg) const
 {
        cerr << "Line ~" << lineno_ << ":  parse error: " << msg << endl;
        dump();
index 9f174c8a0bbeadf9a22e6afd98a68727dd83d815..d28036710e9e4503f2538f0b6cbe2b85afa20612 100644 (file)
@@ -310,7 +310,7 @@ public:
        ///
        std::string verbatimOption();
        ///
-       void error(std::string const & msg);
+       void error(std::string const & msg) const;
        /// The previous token.
        Token const prev_token() const;
        /// The current token.