commit b0254f08890a36c417058aa0af1e1ee1b9846597
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Sun Jun 22 19:43:30 2025 +0200

    Return const references when it makes sense
    
    The trivstring member variables are kept as they are, although currently
    there is no trivstring implementation.
    
    Spotted by cppcheck.
---
 src/Author.h                           |  6 +--
 src/BiblioInfo.h                       |  4 +-
 src/BranchList.h                       |  2 +-
 src/Buffer.cpp                         |  2 +-
 src/Buffer.h                           |  2 +-
 src/BufferView.h                       |  2 +-
 src/Citation.h                         |  4 +-
 src/Cursor.h                           |  2 +-
 src/Floating.cpp                       | 13 ------
 src/Floating.h                         |  5 ++-
 src/Format.h                           | 12 +++---
 src/LaTeXColors.h                      |  2 +-
 src/Layout.h                           | 10 ++---
 src/ModuleList.h                       |  2 +-
 src/Session.h                          |  4 +-
 src/Text.cpp                           |  6 ---
 src/Text.h                             |  2 +-
 src/TextClass.h                        |  2 +-
 src/TocBackend.h                       |  2 +-
 src/frontends/KeySymbol.h              |  2 +-
 src/frontends/qt/CustomizedWidgets.cpp | 12 ------
 src/frontends/qt/CustomizedWidgets.h   |  4 +-
 src/insets/InsetArgument.h             |  2 +-
 src/insets/InsetCommandParams.h        |  2 +-
 src/insets/InsetGraphics.h             |  2 +-
 src/insets/InsetInfo.h                 |  2 +-
 src/insets/InsetLayout.cpp             | 10 ++---
 src/insets/InsetLayout.h               | 72 +++++++++++++++++-----------------
 src/insets/InsetSpace.cpp              | 12 ------
 src/insets/InsetSpace.h                |  6 +--
 src/mathed/InsetMathMacro.cpp          |  2 +-
 src/mathed/InsetMathMacro.h            |  2 +-
 src/mathed/InsetMathNumber.h           |  2 +-
 src/mathed/InsetMathString.h           |  2 +-
 src/mathed/MathStream.h                |  2 +-
 src/tex2lyx/Parser.h                   |  2 +-
 src/tex2lyx/Preamble.h                 | 24 ++++++------
 37 files changed, 101 insertions(+), 145 deletions(-)

diff --git a/src/Author.h b/src/Author.h
index 798cfd8043..75b0ae59e9 100644
--- a/src/Author.h
+++ b/src/Author.h
@@ -29,11 +29,11 @@ public:
        /// For when the \author line is missing (#9854)
        Author(int buffer_id);
        ///
-       docstring name() const { return name_; }
+       docstring const & name() const { return name_; }
        ///
-       docstring email() const { return email_; }
+       docstring const & email() const { return email_; }
        ///
-       docstring initials() const { return initials_; }
+       docstring const & initials() const { return initials_; }
        ///
        docstring nameAndEmail() const;
        ///
diff --git a/src/BiblioInfo.h b/src/BiblioInfo.h
index e5088d0b4c..ad73c7d45a 100644
--- a/src/BiblioInfo.h
+++ b/src/BiblioInfo.h
@@ -118,7 +118,7 @@ public:
        docstring const & key() const { return bib_key_; }
        /// numerical key for citing this entry. currently used only
        /// by XHTML output routines.
-       docstring citeNumber() const { return cite_number_; }
+       docstring const & citeNumber() const { return cite_number_; }
        ///
        void setCiteNumber(docstring const & num) { cite_number_ = num; }
        /// a,b,c, etc, for author-year. currently used only by XHTML
@@ -127,7 +127,7 @@ public:
        ///
        void setModifier(char c) { modifier_ = c; }
        ///
-       docstring entryType() const { return entry_type_; }
+       docstring const & entryType() const { return entry_type_; }
        ///
        bool isBibTeX() const { return is_bibtex_; }
 private:
diff --git a/src/BranchList.h b/src/BranchList.h
index bd32c4db4a..0678563cb7 100644
--- a/src/BranchList.h
+++ b/src/BranchList.h
@@ -106,7 +106,7 @@ public:
        BranchList();
 
        ///
-       docstring separator() const { return separator_; }
+       docstring const & separator() const { return separator_; }
 
        ///
        int id() const { return id_; }
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 97c99f3de7..4bc4763698 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -3561,7 +3561,7 @@ vector<pair<docstring, string>> const 
Buffer::prepareBibFilePaths(OutputParams c
 
 
 
-string Buffer::layoutPos() const
+string const & Buffer::layoutPos() const
 {
        return d->layout_position;
 }
diff --git a/src/Buffer.h b/src/Buffer.h
index 0e0e02c871..f2390ba6d8 100644
--- a/src/Buffer.h
+++ b/src/Buffer.h
@@ -434,7 +434,7 @@ public:
         *  An empty string is returned for standard system and user layouts.
         *  If possible, it is always relative to the buffer path.
         */
-       std::string layoutPos() const;
+       std::string const & layoutPos() const;
 
        /** Set the path to a local layout file.
         *  This must be an absolute path but, if possible, it is always
diff --git a/src/BufferView.h b/src/BufferView.h
index 8652c5a6ed..000869edee 100644
--- a/src/BufferView.h
+++ b/src/BufferView.h
@@ -413,7 +413,7 @@ public:
        bool stats_update_trigger();
 
        /// Inserted label from ref dialog
-       std::string insertedLabel() const { return inserted_label_; }
+       std::string const & insertedLabel() const { return inserted_label_; }
 
 private:
        /// noncopyable
diff --git a/src/Citation.h b/src/Citation.h
index 4be8c3f09a..4fdd95ef47 100644
--- a/src/Citation.h
+++ b/src/Citation.h
@@ -94,11 +94,11 @@ public:
        /// Qualified lists's pre texts
        QualifiedList pretexts;
        ///
-       QualifiedList getPretexts() const { return pretexts; }
+       QualifiedList const & getPretexts() const { return pretexts; }
        /// Qualified lists's post texts
        QualifiedList posttexts;
        ///
-       QualifiedList getPosttexts() const { return posttexts; }
+       QualifiedList const & getPosttexts() const { return posttexts; }
        /// the maximum display size as a label
        size_t max_size;
        /// the maximum size of the processed keys
diff --git a/src/Cursor.h b/src/Cursor.h
index 094a540f24..7e86ee1b26 100644
--- a/src/Cursor.h
+++ b/src/Cursor.h
@@ -205,7 +205,7 @@ public:
        /// As the user is entering a word without leaving it
        /// the result is not empty. When not in text mode
        /// and after leaving the word the result is empty.
-       DocIterator newWord() const { return new_word_; }
+       DocIterator const & newWord() const { return new_word_; }
 
        /// are we in math mode (2), text mode (1) or unsure (0)?
        int currentMode() const;
diff --git a/src/Floating.cpp b/src/Floating.cpp
index df48a2b74d..9dc0c46526 100644
--- a/src/Floating.cpp
+++ b/src/Floating.cpp
@@ -131,19 +131,6 @@ string Floating::defaultCSSClass() const
 }
 
 
-std::string Floating::docbookFloatType() const
-{
-       // All the work is done in the constructor.
-       return docbook_float_type_;
-}
-
-
-string Floating::docbookAttr() const
-{
-       return docbook_attr_;
-}
-
-
 string Floating::docbookTag(bool hasTitle) const
 {
        // If there is a preconfigured tag, use it.
diff --git a/src/Floating.h b/src/Floating.h
index 6fabe729ce..fe0d84218b 100644
--- a/src/Floating.h
+++ b/src/Floating.h
@@ -42,7 +42,7 @@ public:
        ///
        std::string const & floattype() const { return floattype_; }
        ///
-       std::string docbookFloatType() const;
+       std::string docbookFloatType() const { return docbook_float_type_; }
        ///
        std::string const & placement() const { return placement_; }
        ///
@@ -83,7 +83,8 @@ public:
        ///
        std::string docbookTag(bool hasTitle = false) const;
        ///
-       std::string docbookAttr() const;
+       std::string docbookAttr() const { return docbook_attr_; }
+
        ///
        std::string const & docbookTagType() const;
        ///
diff --git a/src/Format.h b/src/Format.h
index 9895b0193b..0347ee9d84 100644
--- a/src/Format.h
+++ b/src/Format.h
@@ -56,7 +56,7 @@ public:
        /// Name fo the parent format
        std::string const parentFormat() const;
        ///
-       std::string const name() const { return name_; }
+       std::string const & name() const { return name_; }
        ///
        void setName(std::string const & v) { name_ = v; }
        ///
@@ -69,23 +69,23 @@ public:
        ///
        void setExtensions(std::string const & v);
        ///
-       docstring const prettyname() const { return prettyname_; }
+       docstring const & prettyname() const { return prettyname_; }
        ///
        void setPrettyname(docstring const & v) { prettyname_ = v; }
        ///
-       std::string const shortcut() const { return shortcut_; }
+       std::string const & shortcut() const { return shortcut_; }
        ///
        void setShortcut(std::string const & v) { shortcut_ = v; }
        ///
-       std::string const viewer() const { return viewer_; }
+       std::string const & viewer() const { return viewer_; }
        ///
        void setViewer(std::string const & v) { viewer_ = v; }
        ///
-       std::string const editor() const { return editor_; }
+       std::string const & editor() const { return editor_; }
        ///
        void setEditor(std::string const & v) { editor_ = v; }
        ///
-       std::string const mime() const { return mime_; }
+       std::string const & mime() const { return mime_; }
        ///
        void setMime(std::string const & m) { mime_ = m; }
        ///
diff --git a/src/LaTeXColors.h b/src/LaTeXColors.h
index 980c74c64a..2a44269b38 100644
--- a/src/LaTeXColors.h
+++ b/src/LaTeXColors.h
@@ -42,7 +42,7 @@ public:
        /// CMYK value
        std::string const & cmyk() const { return cmyk_; }
        /// Required packages
-       std::vector<std::string> req() const { return requires_; }
+       std::vector<std::string> const & req() const { return requires_; }
        /// Is this a dvipsfont name that clashes with SVG name?
        bool svgclash() const { return svgclash_; }
        ///
diff --git a/src/Layout.h b/src/Layout.h
index 40e5b74d8d..69c9eed3f2 100644
--- a/src/Layout.h
+++ b/src/Layout.h
@@ -160,10 +160,10 @@ public:
        docstring const & preamble() const { return preamble_; }
        /// Get language dependent macro definitions needed for this layout
        /// for language \p lang
-       docstring const langpreamble() const { return langpreamble_; }
+       docstring const & langpreamble() const { return langpreamble_; }
        /// Get language and babel dependent macro definitions needed for
        /// this layout for language \p lang
-       docstring const babelpreamble() const { return babelpreamble_; }
+       docstring const & babelpreamble() const { return babelpreamble_; }
        ///
        std::set<std::string> const & required() const { return required_; }
        ///
@@ -173,9 +173,9 @@ public:
        ///
        std::string const & latexparam() const { return latexparam_; }
        ///
-       docstring leftdelim() const { return leftdelim_; }
+       docstring leftdelim() const & { return leftdelim_; }
        ///
-       docstring rightdelim() const { return rightdelim_; }
+       docstring rightdelim() const & { return rightdelim_; }
        ///
        std::string const & innertag() const { return innertag_; }
        ///
@@ -320,7 +320,7 @@ public:
        ///
        bool addToToc() const { return add_to_toc_; }
        ///
-       std::string tocType() const { return toc_type_; }
+       std::string const & tocType() const { return toc_type_; }
        ///
        bool isTocCaption() const { return is_toc_caption_; }
 
diff --git a/src/ModuleList.h b/src/ModuleList.h
index b3327f7528..6274783b93 100644
--- a/src/ModuleList.h
+++ b/src/ModuleList.h
@@ -77,7 +77,7 @@ public:
        std::vector<std::string> const & getExcludedModules() const
                { return excluded_modules_; }
        ///
-       std::string category() const { return category_; }
+       std::string const & category() const { return category_; }
        /// Is this a local module (from the user directory)?
        bool isLocal() const { return local_; }
        /// \return true if the module is compatible with this one, i.e.,
diff --git a/src/Session.h b/src/Session.h
index dde76cad79..aa756ddcef 100644
--- a/src/Session.h
+++ b/src/Session.h
@@ -71,7 +71,7 @@ public:
        void write(std::ostream & os) const override;
 
        /// Return lastfiles container (vector)
-       LastFiles const lastFiles() const { return lastfiles; }
+       LastFiles const & lastFiles() const { return lastfiles; }
 
        /** Insert #file# into the lastfile vector.
            This funtion inserts #file# into the last files list. If the file
@@ -126,7 +126,7 @@ public:
        void write(std::ostream & os) const override;
 
        /// Return lastopened container (vector)
-       LastOpened const getfiles() const { return lastopened; }
+       LastOpened const & getfiles() const { return lastopened; }
 
        /** add file to lastopened file list
            @param file filename to add
diff --git a/src/Text.cpp b/src/Text.cpp
index 0addf55fc2..e528024bab 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -2424,12 +2424,6 @@ void Text::charsTranspose(Cursor & cur)
 }
 
 
-DocIterator Text::macrocontextPosition() const
-{
-       return macrocontext_position_;
-}
-
-
 void Text::setMacrocontextPosition(DocIterator const & pos)
 {
        macrocontext_position_ = pos;
diff --git a/src/Text.h b/src/Text.h
index 9ef9c96260..834e478b57 100644
--- a/src/Text.h
+++ b/src/Text.h
@@ -325,7 +325,7 @@ public:
        /// Every macro definition is stored with its DocIterator
        /// as well. Only those macros with a smaller iterator become
        /// visible in a paragraph.
-       DocIterator macrocontextPosition() const;
+       DocIterator const & macrocontextPosition() const { return 
macrocontext_position_; }
        ///
        void setMacrocontextPosition(DocIterator const & pos);
 
diff --git a/src/TextClass.h b/src/TextClass.h
index c7c6214f79..ad2f4ee0ea 100644
--- a/src/TextClass.h
+++ b/src/TextClass.h
@@ -205,7 +205,7 @@ public:
        /// Can be LaTeX, DocBook, etc.
        OutputType outputType() const { return outputType_; }
        /// Can be latex, docbook ... (the name of a format)
-       std::string outputFormat() const { return outputFormat_; }
+       std::string const & outputFormat() const { return outputFormat_; }
        /// Does this class redefine the output format?
        bool hasOutputFormat() const { return has_output_format_; }
        /// Return the non-localised names for the toc types.
diff --git a/src/TocBackend.h b/src/TocBackend.h
index 5fa41364cd..ac4eeec42b 100644
--- a/src/TocBackend.h
+++ b/src/TocBackend.h
@@ -80,7 +80,7 @@ public:
        void setAction(FuncRequest const & a) { action_ = a; }
        /// return comma-separated list of all par IDs (including nested insets)
        /// this is used by captioned elements
-       docstring const parIDs() const { return par_ids_; }
+       docstring const & parIDs() const { return par_ids_; }
        ///
        void setParIDs(docstring const & ids) { par_ids_ = ids; }
 
diff --git a/src/frontends/KeySymbol.h b/src/frontends/KeySymbol.h
index 9f4faafe06..b4990b3aa3 100644
--- a/src/frontends/KeySymbol.h
+++ b/src/frontends/KeySymbol.h
@@ -66,7 +66,7 @@ public:
        ///
        void setKey(int key) { key_ = key; }
        ///
-       docstring text() const { return text_; }
+       docstring const & text() const { return text_; }
        ///
        void setText(docstring const & text) { text_ = text; }
 private:
diff --git a/src/frontends/qt/CustomizedWidgets.cpp 
b/src/frontends/qt/CustomizedWidgets.cpp
index 1e5db20671..f892700f39 100644
--- a/src/frontends/qt/CustomizedWidgets.cpp
+++ b/src/frontends/qt/CustomizedWidgets.cpp
@@ -57,18 +57,6 @@ void ShortcutWidget::reset()
 }
 
 
-KeySequence const ShortcutWidget::getKeySequence() const
-{
-       return keysequence_;
-}
-
-
-void ShortcutWidget::setKeySequence(lyx::KeySequence const & s)
-{
-       keysequence_ = s;
-}
-
-
 void ShortcutWidget::keyPressEvent(QKeyEvent * e)
 {
        int const keyQt = e->key();
diff --git a/src/frontends/qt/CustomizedWidgets.h 
b/src/frontends/qt/CustomizedWidgets.h
index ca68ca99cf..223913650a 100644
--- a/src/frontends/qt/CustomizedWidgets.h
+++ b/src/frontends/qt/CustomizedWidgets.h
@@ -31,8 +31,8 @@ class ShortcutWidget : public QLabel {
 public:
        ShortcutWidget(QWidget * parent);
        void reset();
-       KeySequence const getKeySequence() const;
-       void setKeySequence(lyx::KeySequence const & s);
+       KeySequence const getKeySequence() const { return keysequence_; }
+       void setKeySequence(lyx::KeySequence const & s)  { keysequence_ = s; }
        void removeFromSequence();
 protected Q_SLOTS:
        bool event(QEvent* e) override;
diff --git a/src/insets/InsetArgument.h b/src/insets/InsetArgument.h
index 1e6b4a43c9..829ffce87b 100644
--- a/src/insets/InsetArgument.h
+++ b/src/insets/InsetArgument.h
@@ -37,7 +37,7 @@ public:
                           docstring const & ldelim, docstring const & rdelim,
                           docstring const & presetarg) const;
 
-       std::string name() const { return name_; }
+       std::string const & name() const { return name_; }
 
        bool docbookargumentbeforemaintag() const { return 
docbookargumentbeforemaintag_; }
 
diff --git a/src/insets/InsetCommandParams.h b/src/insets/InsetCommandParams.h
index bfb8b04cf6..0aeed66dd3 100644
--- a/src/insets/InsetCommandParams.h
+++ b/src/insets/InsetCommandParams.h
@@ -56,7 +56,7 @@ public:
                          bool ignore = false,
                          docstring const & default_value = docstring());
                ///
-               std::string name() const { return name_; }
+               std::string const & name() const { return name_; }
                ///
                ParamType type() const { return type_; }
                ///
diff --git a/src/insets/InsetGraphics.h b/src/insets/InsetGraphics.h
index 73b5625b11..3fd986bf7b 100644
--- a/src/insets/InsetGraphics.h
+++ b/src/insets/InsetGraphics.h
@@ -51,7 +51,7 @@ public:
        */
        bool setParams(InsetGraphicsParams const & params);
 
-       InsetGraphicsParams getParams() const { return params_;}
+       InsetGraphicsParams const & getParams() const { return params_;}
        ///
        bool clickable(BufferView const &, int, int) const override { return 
true; }
        ///
diff --git a/src/insets/InsetInfo.h b/src/insets/InsetInfo.h
index e0cf7585b3..5cfb7e51e0 100644
--- a/src/insets/InsetInfo.h
+++ b/src/insets/InsetInfo.h
@@ -214,7 +214,7 @@ public:
        ///
        void validate(LaTeXFeatures & features) const override;
        ///
-       InsetInfoParams params() const { return params_; }
+       InsetInfoParams const & params() const { return params_; }
        /// Outputs the inset as DocBook, taking advantage of the metadata 
available in InsetInfoParams.
        void docbook(XMLStream &, OutputParams const &) const override;
        /// Outputs the inset as XHTML, taking advantage of the metadata 
available in InsetInfoParams.
diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp
index 8249da89c3..f376dbcc20 100644
--- a/src/insets/InsetLayout.cpp
+++ b/src/insets/InsetLayout.cpp
@@ -818,7 +818,7 @@ std::string const & InsetLayout::docbookininfo() const
 }
 
 
-std::string InsetLayout::docbooktagtype() const
+std::string const & InsetLayout::docbooktagtype() const
 {
        if (docbooktagtype_ != "block" && docbooktagtype_ != "paragraph" && 
docbooktagtype_ != "inline")
                docbooktagtype_ = "block";
@@ -826,7 +826,7 @@ std::string InsetLayout::docbooktagtype() const
 }
 
 
-std::string InsetLayout::docbookinnertagtype() const
+std::string const & InsetLayout::docbookinnertagtype() const
 {
        if (docbookinnertagtype_ != "block" && docbookinnertagtype_ != 
"paragraph" && docbookinnertagtype_ != "inline")
                docbookinnertagtype_ = "block";
@@ -834,7 +834,7 @@ std::string InsetLayout::docbookinnertagtype() const
 }
 
 
-std::string InsetLayout::docbookwrappertagtype() const
+std::string const & InsetLayout::docbookwrappertagtype() const
 {
        if (docbookwrappertagtype_ != "block" && docbookwrappertagtype_ != 
"paragraph" && docbookwrappertagtype_ != "inline")
                docbookwrappertagtype_ = "block";
@@ -842,7 +842,7 @@ std::string InsetLayout::docbookwrappertagtype() const
 }
 
 
-std::string InsetLayout::docbookitemtagtype() const
+std::string const & InsetLayout::docbookitemtagtype() const
 {
        if (docbookitemtagtype_ != "block" && docbookitemtagtype_ != 
"paragraph" && docbookitemtagtype_ != "inline")
                docbookitemtagtype_ = "block";
@@ -850,7 +850,7 @@ std::string InsetLayout::docbookitemtagtype() const
 }
 
 
-std::string InsetLayout::docbookitemwrappertagtype() const
+std::string const & InsetLayout::docbookitemwrappertagtype() const
 {
        if (docbookitemwrappertagtype_ != "block" && docbookitemwrappertagtype_ 
!= "paragraph" && docbookitemwrappertagtype_ != "inline")
                docbookitemwrappertagtype_ = "block";
diff --git a/src/insets/InsetLayout.h b/src/insets/InsetLayout.h
index 9038e56baf..19e432ef23 100644
--- a/src/insets/InsetLayout.h
+++ b/src/insets/InsetLayout.h
@@ -62,15 +62,15 @@ public:
        bool read(support::Lexer & lexrc, TextClass const & tclass,
                        bool validating = false);
        ///
-       docstring name() const { return name_; }
+       docstring const & name() const { return name_; }
        ///
        void setName(docstring const & n) { name_ = n; }
        ///
        InsetLyXType lyxtype() const { return lyxtype_; }
        ///
-       docstring labelstring() const { return labelstring_; }
+       docstring const & labelstring() const { return labelstring_; }
        ///
-       docstring menustring() const { return menustring_; }
+       docstring const & menustring() const { return menustring_; }
        ///
        bool contentaslabel() const { return contentaslabel_; }
        ///
@@ -78,19 +78,19 @@ public:
        ///
        InsetLaTeXType latextype() const { return latextype_; }
        ///
-       std::string latexname() const { return latexname_; }
+       std::string const & latexname() const { return latexname_; }
        ///
-       std::string latexparam() const { return latexparam_; }
+       std::string const & latexparam() const { return latexparam_; }
        ///
-       docstring leftdelim() const { return leftdelim_; }
+       docstring const & leftdelim() const { return leftdelim_; }
        ///
-       docstring rightdelim() const { return rightdelim_; }
+       docstring const & rightdelim() const { return rightdelim_; }
        ///
        bool inheritFont() const { return inheritfont_; }
        ///
-       FontInfo font() const { return font_; }
+       FontInfo const & font() const { return font_; }
        ///
-       FontInfo labelfont() const { return labelfont_; }
+       FontInfo const & labelfont() const { return labelfont_; }
        ///
        ColorCode bgcolor() const { return bgcolor_; }
        ///
@@ -109,18 +109,18 @@ public:
        ///
        int requiredArgs() const;
        ///
-       docstring preamble() const { return preamble_; }
+       docstring const & preamble() const { return preamble_; }
        /// Get language dependent macro definitions needed for this inset
-       docstring const langpreamble() const { return langpreamble_; }
+       docstring const & langpreamble() const { return langpreamble_; }
        /// Get language and babel dependent macro definitions needed for
        /// this inset
-       docstring const babelpreamble() const { return babelpreamble_; }
+       docstring const & babelpreamble() const { return babelpreamble_; }
        ///
        bool fixedwidthpreambleencoding() const { return 
fixedwidthpreambleencoding_; }
        ///
-       docstring counter() const { return counter_; }
+       docstring const & counter() const { return counter_; }
        ///
-       docstring refprefix() const { return refprefix_; }
+       docstring const & refprefix() const { return refprefix_; }
        /// The tag enclosing all the material in this inset. Default is "span".
        std::string const & htmltag() const;
        /// Additional attributes for inclusion with the start tag. Default (if
@@ -149,7 +149,7 @@ public:
        /// CSS associated with this inset.
        docstring htmlstyle() const;
        /// Additional material for the header.
-       docstring htmlpreamble() const { return htmlpreamble_; }
+       docstring const & htmlpreamble() const { return htmlpreamble_; }
        /// Whether this inset represents a "block" of material, i.e., a set
        /// of paragraphs of its own (true), or should be run into the previous
        /// paragraph (false). Examples:
@@ -158,17 +158,17 @@ public:
        /// Defaults to true.
        bool htmlisblock() const { return htmlisblock_; }
        ///
-       std::string docbooktag() const { return docbooktag_; }
+       std::string const & docbooktag() const { return docbooktag_; }
        ///
-       std::string docbooktagtype() const;
+       std::string const & docbooktagtype() const;
        ///
-       std::string docbookattr() const { return docbookattr_; }
+       std::string const & docbookattr() const { return docbookattr_; }
        ///
-       std::string docbookinnertag() const { return docbookinnertag_; }
+       std::string const & docbookinnertag() const { return docbookinnertag_; }
        ///
-       std::string docbookinnertagtype() const;
+       std::string const & docbookinnertagtype() const;
        ///
-       std::string docbookinnerattr() const { return docbookinnerattr_; }
+       std::string const & docbookinnerattr() const { return 
docbookinnerattr_; }
        ///
        std::string const & docbookininfo() const;
        ///
@@ -180,27 +180,27 @@ public:
        ///
        bool docbookargumentaftermaintag() const { return 
docbookargumentaftermaintag_; }
        ///
-       std::string docbookwrappertag() const { return docbookwrappertag_; }
+       std::string const & docbookwrappertag() const { return 
docbookwrappertag_; }
        ///
-       std::string docbookwrappertagtype() const;
+       std::string const & docbookwrappertagtype() const;
        ///
-       std::string docbookwrapperattr() const { return docbookwrapperattr_; }
+       std::string const & docbookwrapperattr() const { return 
docbookwrapperattr_; }
        ///
-       std::string docbookitemwrappertag() const { return 
docbookitemwrappertag_; }
+       std::string const & docbookitemwrappertag() const { return 
docbookitemwrappertag_; }
        ///
-       std::string docbookitemwrappertagtype() const;
+       std::string const & docbookitemwrappertagtype() const;
        ///
-       std::string docbookitemwrapperattr() const { return 
docbookitemwrapperattr_; }
+       std::string const & docbookitemwrapperattr() const { return 
docbookitemwrapperattr_; }
        ///
-       std::string docbookitemtag() const { return docbookitemtag_; }
+       std::string const & docbookitemtag() const { return docbookitemtag_; }
        ///
-       std::string docbookitemtagtype() const;
+       std::string const & docbookitemtagtype() const;
        ///
-       std::string docbookitemattr() const { return docbookitemattr_; }
+       std::string const & docbookitemattr() const { return docbookitemattr_; }
        ///
-       bool docbooknofontinside() const { return docbooknofontinside_; }
+       bool const & docbooknofontinside() const { return docbooknofontinside_; 
}
        ///
-       bool docbookrenderasimage() const { return docbookrenderasimage_; }
+       bool const & docbookrenderasimage() const { return 
docbookrenderasimage_; }
        ///
        std::set<std::string> const & required() const { return required_; }
        ///
@@ -212,15 +212,15 @@ public:
        ///
        bool allowParagraphCustomization() const { return custompars_; }
        ///
-       docstring escapeChars() const { return escape_chars_; }
+       docstring const & escapeChars() const { return escape_chars_; }
        ///
        bool isPassThru() const { return passthru_; }
        ///
-       docstring passThruChars() const { return passthru_chars_; }
+       docstring const & passThruChars() const { return passthru_chars_; }
        ///
-       docstring noPassThruChars() const { return no_passthru_chars_; }
+       docstring const & noPassThruChars() const { return no_passthru_chars_; }
        ///
-       std::string newlineCmd() const { return newline_cmd_; }
+       std::string const & newlineCmd() const { return newline_cmd_; }
        ///
        bool parbreakIsNewline() const { return parbreakisnewline_; }
        ///
diff --git a/src/insets/InsetSpace.cpp b/src/insets/InsetSpace.cpp
index 283193c44c..7ac5d3155d 100644
--- a/src/insets/InsetSpace.cpp
+++ b/src/insets/InsetSpace.cpp
@@ -49,18 +49,6 @@ InsetSpace::InsetSpace(InsetSpaceParams const & params)
 {}
 
 
-InsetSpaceParams::Kind InsetSpace::kind() const
-{
-       return params_.kind;
-}
-
-
-GlueLength InsetSpace::length() const
-{
-       return params_.length;
-}
-
-
 docstring InsetSpace::toolTip(BufferView const &, int, int) const
 {
        docstring message;
diff --git a/src/insets/InsetSpace.h b/src/insets/InsetSpace.h
index 719e09483d..7cb3b3ab49 100644
--- a/src/insets/InsetSpace.h
+++ b/src/insets/InsetSpace.h
@@ -103,15 +103,13 @@ public:
        ///
        InsetSpaceParams const & params() const { return params_; }
        ///
-       InsetSpaceParams::Kind kind() const;
-
+       InsetSpaceParams::Kind kind() const { return params_.kind; }
        ///
        static void string2params(std::string const &, InsetSpaceParams &);
        ///
        static std::string params2string(InsetSpaceParams const &);
        ///
-       GlueLength length() const;
-
+       GlueLength length() const { return params_.length; }
        ///
        docstring toolTip(BufferView const & bv, int x, int y) const override;
        /// unprotected spaces allow line breaking after them
diff --git a/src/mathed/InsetMathMacro.cpp b/src/mathed/InsetMathMacro.cpp
index d67b8f02bb..414bcf985e 100644
--- a/src/mathed/InsetMathMacro.cpp
+++ b/src/mathed/InsetMathMacro.cpp
@@ -490,7 +490,7 @@ docstring InsetMathMacro::name() const
 }
 
 
-docstring InsetMathMacro::macroName() const
+docstring const & InsetMathMacro::macroName() const
 {
        return d->name_;
 }
diff --git a/src/mathed/InsetMathMacro.h b/src/mathed/InsetMathMacro.h
index b630d751d5..d614f750a0 100644
--- a/src/mathed/InsetMathMacro.h
+++ b/src/mathed/InsetMathMacro.h
@@ -138,7 +138,7 @@ public:
        /// FIXME: Often dangling.
        MacroData const * macro() const;
        ///
-       docstring macroName() const;
+       docstring const & macroName() const;
        /// Level of nesting in macros (including this one)
        int nesting() const;
        ///
diff --git a/src/mathed/InsetMathNumber.h b/src/mathed/InsetMathNumber.h
index 99e8c3c70b..2231de29b4 100644
--- a/src/mathed/InsetMathNumber.h
+++ b/src/mathed/InsetMathNumber.h
@@ -30,7 +30,7 @@ public:
        ///
        void draw(PainterInfo &, int x, int y) const override;
        ///
-       docstring str() const { return str_; }
+       docstring const & str() const { return str_; }
        ///
        InsetMathNumber * asNumberInset() { return this; }
 
diff --git a/src/mathed/InsetMathString.h b/src/mathed/InsetMathString.h
index 6112b2546b..c7d95bd95e 100644
--- a/src/mathed/InsetMathString.h
+++ b/src/mathed/InsetMathString.h
@@ -32,7 +32,7 @@ public:
        ///
        void draw(PainterInfo & pi, int x, int y) const override;
        ///
-       docstring str() const { return str_; }
+       docstring const & str() const { return str_; }
        ///
        InsetMathString * asStringInset() override { return this; }
        ///
diff --git a/src/mathed/MathStream.h b/src/mathed/MathStream.h
index c4ff39a5f9..39fe949fb8 100644
--- a/src/mathed/MathStream.h
+++ b/src/mathed/MathStream.h
@@ -497,7 +497,7 @@ public:
        ///
        bool inText() const { return text_level_ != nlevel; }
        ///
-       std::string xmlns() const { return xmlns_; }
+       std::string const & xmlns() const { return xmlns_; }
        ///
        MathMLVersion version() const { return version_; }
        /// Returns the tag name prefixed by the name space if needed.
diff --git a/src/tex2lyx/Parser.h b/src/tex2lyx/Parser.h
index ec2fc3c355..75549cbfa1 100644
--- a/src/tex2lyx/Parser.h
+++ b/src/tex2lyx/Parser.h
@@ -191,7 +191,7 @@ public:
        /// change the encoding of the input stream to \p encoding (iconv name)
        bool setEncoding(std::string const & encoding);
        /// get the current iconv encoding of the input stream
-       std::string getEncoding() const { return encoding_iconv_; }
+       std::string const & getEncoding() const { return encoding_iconv_; }
 
        ///
        CatCode catcode(char_type c) const;
diff --git a/src/tex2lyx/Preamble.h b/src/tex2lyx/Preamble.h
index 5a0efa25ad..b6c8a4ce49 100644
--- a/src/tex2lyx/Preamble.h
+++ b/src/tex2lyx/Preamble.h
@@ -35,17 +35,17 @@ public:
        Preamble();
 
        ///
-       std::string inputencoding() const { return h_inputencoding; }
+       std::string const & inputencoding() const { return h_inputencoding; }
        ///
        void setInputencoding(std::string const & e) { h_inputencoding = e; }
        ///
-       std::string notefontcolor() const { return h_notefontcolor; }
+       std::string const & notefontcolor() const { return h_notefontcolor; }
        ///
-       std::string crossrefPackage() const { return h_crossref_package; }
+       std::string const & crossrefPackage() const { return 
h_crossref_package; }
        ///
        bool fontCJKSet() const { return h_font_cjk_set; }
        ///
-       std::string fontCJK() const { return h_font_cjk; }
+       std::string const & fontCJK() const { return h_font_cjk; }
        ///
        void fontCJK(std::string const & f) { h_font_cjk_set = true; h_font_cjk 
= f; }
        ///
@@ -55,17 +55,17 @@ public:
        ///
        std::string getLyXColor(std::string const & col, bool reg = false);
        ///
-       std::string nomenclOpts() const { return h_nomencl_options; }
+       std::string const & nomenclOpts() const { return h_nomencl_options; }
        /// The document language
-       std::string docLanguage() const { return h_language; }
+       std::string const & docLanguage() const { return h_language; }
        /// The language of text which is not explicitly marked
-       std::string defaultLanguage() const  { return default_language; }
+       std::string const & defaultLanguage() const  { return default_language; 
}
        /// The quotation marks style
-       std::string quotesStyle() const { return h_quotes_style; }
+       std::string const & quotesStyle() const { return h_quotes_style; }
        ///
        bool usePolyglossia() const;
        ///
-       std::string use_indices() const { return h_use_indices; }
+       std::string const & use_indices() const { return h_use_indices; }
        ///
        std::string polyglossia2lyx(std::string const & language);
        ///
@@ -88,13 +88,13 @@ public:
        ///
        void suppressDate(bool suppress);
        ///
-       std::string citeEngine() const { return h_cite_engine; }
+       std::string const & citeEngine() const { return h_cite_engine; }
        ///
        void citeEngine(std::string const & e) { h_cite_engine = e; }
        ///
-       std::string biblatexCiteStyle() const { return h_biblatex_citestyle; }
+       std::string const & biblatexCiteStyle() const { return 
h_biblatex_citestyle; }
        ///
-       std::string multibib() const { return h_multibib; }
+       std::string const & multibib() const { return h_multibib; }
        ///
        void multibib(std::string const & s) { h_multibib = s; }
        ///
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to