]> git.lyx.org Git - features.git/commitdiff
Refactor `params2string` -> `toString`
authorYuriy Skalko <yuriy.skalko@gmail.com>
Mon, 21 Dec 2020 15:30:34 +0000 (17:30 +0200)
committerYuriy Skalko <yuriy.skalko@gmail.com>
Fri, 15 Jan 2021 19:09:15 +0000 (21:09 +0200)
Move `params2string` static methods of Insets into `toString`
methods of InsetParams.

73 files changed:
src/BufferView.cpp
src/Text3.cpp
src/frontends/qt/FloatPlacement.cpp
src/frontends/qt/GuiBibitem.cpp
src/frontends/qt/GuiBibtex.cpp
src/frontends/qt/GuiBox.cpp
src/frontends/qt/GuiBranch.cpp
src/frontends/qt/GuiCitation.cpp
src/frontends/qt/GuiCounter.cpp
src/frontends/qt/GuiExternal.cpp
src/frontends/qt/GuiGraphics.cpp
src/frontends/qt/GuiHSpace.cpp
src/frontends/qt/GuiHyperlink.cpp
src/frontends/qt/GuiInclude.cpp
src/frontends/qt/GuiIndex.cpp
src/frontends/qt/GuiLabel.cpp
src/frontends/qt/GuiLine.cpp
src/frontends/qt/GuiListings.cpp
src/frontends/qt/GuiNomenclature.cpp
src/frontends/qt/GuiNote.cpp
src/frontends/qt/GuiPhantom.cpp
src/frontends/qt/GuiPrintNomencl.cpp
src/frontends/qt/GuiPrintindex.cpp
src/frontends/qt/GuiRef.cpp
src/frontends/qt/GuiWrap.cpp
src/frontends/qt/Menus.cpp
src/insets/InsetBox.cpp
src/insets/InsetBox.h
src/insets/InsetBranch.cpp
src/insets/InsetBranch.h
src/insets/InsetCommand.cpp
src/insets/InsetCommand.h
src/insets/InsetCommandParams.cpp
src/insets/InsetCommandParams.h
src/insets/InsetExternal.cpp
src/insets/InsetExternal.h
src/insets/InsetFloat.cpp
src/insets/InsetFloat.h
src/insets/InsetFloatList.cpp
src/insets/InsetGraphics.cpp
src/insets/InsetGraphics.h
src/insets/InsetGraphicsParams.cpp
src/insets/InsetGraphicsParams.h
src/insets/InsetIPAMacro.cpp
src/insets/InsetIPAMacro.h
src/insets/InsetIndex.cpp
src/insets/InsetIndex.h
src/insets/InsetLabel.cpp
src/insets/InsetListings.cpp
src/insets/InsetListings.h
src/insets/InsetListingsParams.cpp
src/insets/InsetListingsParams.h
src/insets/InsetNewline.cpp
src/insets/InsetNewline.h
src/insets/InsetNewpage.cpp
src/insets/InsetNewpage.h
src/insets/InsetNote.cpp
src/insets/InsetNote.h
src/insets/InsetParams.h
src/insets/InsetPhantom.cpp
src/insets/InsetPhantom.h
src/insets/InsetRef.cpp
src/insets/InsetScript.cpp
src/insets/InsetScript.h
src/insets/InsetSeparator.cpp
src/insets/InsetSeparator.h
src/insets/InsetSpace.cpp
src/insets/InsetSpace.h
src/insets/InsetTOC.cpp
src/insets/InsetWrap.cpp
src/insets/InsetWrap.h
src/mathed/InsetMathHull.cpp
src/mathed/InsetMathRef.cpp

index dafab28c7be9e6ef7a9cc1546b5578d23b0dabd1..ba25b8884cafde1097f98f6de2307788e4505fc4 100644 (file)
@@ -2121,7 +2121,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                        icp["before"] = from_utf8(opt1);
                icp["literal"] = 
                        from_ascii(InsetCitation::last_literal ? "true" : "false");
-               string icstr = InsetCommand::params2string(icp);
+               string icstr = icp.toString();
                FuncRequest fr(LFUN_INSET_INSERT, icstr);
                lyx::dispatch(fr);
                break;
index a59eec8b97703d4fd3c0c8b0bd245878ecf83025..94f8875d17c6e612a52ab0abfa960a9f2c4e0a93 100644 (file)
@@ -2018,7 +2018,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        } else
                                p["name"] = content;
                }
-               string const data = InsetCommand::params2string(p);
+               string const data = p.toString();
 
                // we need to have a target. if we already have one, then
                // that gets used at the default for the name, too, which
@@ -2038,7 +2038,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                p["name"] = (cmd.argument().empty()) ?
                        cur.getPossibleLabel() :
                        cmd.argument();
-               string const data = InsetCommand::params2string(p);
+               string const data = p.toString();
 
                if (cmd.argument().empty()) {
                        bv->showDialog("label", data);
@@ -2274,7 +2274,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        cur.clearSelection();
                } else
                        p["symbol"] = cmd.argument();
-               string const data = InsetCommand::params2string(p);
+               string const data = p.toString();
                bv->showDialog("nomenclature", data);
                break;
        }
@@ -2285,7 +2285,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        p["type"] = from_ascii("idx");
                else
                        p["type"] = cmd.argument();
-               string const data = InsetCommand::params2string(p);
+               string const data = p.toString();
                FuncRequest fr(LFUN_INSET_INSERT, data);
                dispatch(cur, fr);
                break;
index 21d13e9c3b19f2386202f800b2a3f4952900fe20..4141608e4ea92e45a408db4cb767e2849fca4bd1 100644 (file)
@@ -73,7 +73,7 @@ docstring FloatPlacement::dialogToParams() const
        params.sideways = sidewaysCB->isChecked();
        params.alignment = getAlignment();
        params.placement = getPlacement();
-       return from_ascii(InsetFloat::params2string(params));
+       return from_ascii(params.toString());
 }
 
 
index ccbbf95b20908cb54b31dc2eff281896a49f1484..a0321f18c9d91aaace43cb830b23d1519613c560 100644 (file)
@@ -106,7 +106,7 @@ docstring GuiBibitem::dialogToParams() const
        params["label"] = qstring_to_ucs4(label);
        params["literal"] = literalCB->isChecked()
                        ? from_ascii("true") : from_ascii("false");
-       return from_utf8(InsetCommand::params2string(params));
+       return from_utf8(params.toString());
 }
 
 
index a9b5fade516aa8f63c1ed021f3325388d283546c..1ad64eeb5919bc340863bed219ca95177c0d2428 100644 (file)
@@ -637,7 +637,7 @@ bool GuiBibtex::initialiseParams(std::string const & sdata)
 
 void GuiBibtex::dispatchParams()
 {
-       std::string const lfun = InsetCommand::params2string(params_);
+       std::string const lfun = params_.toString();
        dispatch(FuncRequest(getLfun(), lfun));
        connectToNewInset();
 }
index 0d22aa79638ad8d6bde577207a8424b161598313..14cbaf7f5be74c550395b93e04ec75cdefc3835c 100644 (file)
@@ -493,7 +493,7 @@ docstring GuiBox::dialogToParams() const
        else
                params.backgroundcolor = "none";
 
-       return from_ascii(InsetBox::params2string(params));
+       return from_ascii(params.toString());
 }
 
 
index 24b6977390101ee03e43ccf8316f0015ced405c9..e66cff2e42f474ebae12cd5e147892affa9a5011 100644 (file)
@@ -63,7 +63,7 @@ void GuiBranch::paramsToDialog(Inset const * inset)
 docstring GuiBranch::dialogToParams() const
 {
        InsetBranchParams params(qstring_to_ucs4(branchCO->currentText()), invertedCB->isChecked());
-       return from_utf8(InsetBranch::params2string(params));
+       return from_utf8(params.toString());
 }
 
 
index eed9574904570033681cc6c167bfbaa4c977342c..61b3e1383fe5db366dcd524c743e2d0a8b44f49a 100644 (file)
@@ -1061,7 +1061,7 @@ vector<docstring> GuiCitation::searchKeys(BiblioInfo const & bi,
 
 void GuiCitation::dispatchParams()
 {
-       std::string const lfun = InsetCommand::params2string(params_);
+       std::string const lfun = params_.toString();
        dispatch(FuncRequest(getLfun(), lfun));
 }
 
index 1c79725a87cd376fff0126480ebcd6069b342388..6c5e9bf6e31d2090c5aba78ee807896b5e9dcd3e 100644 (file)
@@ -132,7 +132,7 @@ docstring GuiCounter::dialogToParams() const
        params["value"] = convert<docstring>(valueSB->value());
        params.setCmdName(fromqstr(actionCB->itemData(actionCB->currentIndex()).toString()));
        params["lyxonly"] = from_ascii(lyxonlyXB->isChecked() ? "true" : "false");
-       return from_utf8(InsetCounter::params2string(params));
+       return from_utf8(params.toString());
 }
 
 
index 25f0e657332b639eba577c7a85334f89f39d4bc0..0a56214f27751e55bb33e089ea541dfedd468286 100644 (file)
@@ -643,7 +643,7 @@ void GuiExternal::clearParams()
 
 void GuiExternal::dispatchParams()
 {
-       string const lfun = InsetExternal::params2string(params_);
+       string const lfun = params_.toString();
        dispatch(FuncRequest(getLfun(), lfun));
        connectToNewInset();
 }
index db911613bcf384542c514d7a2f4e9b225a1dbed5..04b0ca3285280ce66a9a0c49ecafea7fd7b70b87 100644 (file)
@@ -772,7 +772,7 @@ void GuiGraphics::dispatchParams()
 {
        InsetGraphicsParams tmp_params(params_);
        tmp_params.setBuffer(&buffer());
-       string const lfun = InsetGraphics::params2string(tmp_params);
+       string const lfun = tmp_params.toString();
        dispatch(FuncRequest(getLfun(), lfun));
        connectToNewInset();
 }
index 64c5b3809f8bb3e94ac9dc8d1cb7d35655321aab..a02cfa517cc4d42a40eb6abf69b363b5f1ed8393 100644 (file)
@@ -286,7 +286,7 @@ docstring GuiHSpace::dialogToParams() const
        } else if (item == "visible")
                params.kind = InsetSpaceParams::VISIBLE;
 
-       return from_ascii(InsetSpace::params2string(params));
+       return from_ascii(params.toString());
 }
 
 
index c063ca236260789badf89e16a8178c55e010e019..468d3dbf3cafa55a6dfcfe38aaab2e221c1f5042 100644 (file)
@@ -104,7 +104,7 @@ docstring GuiHyperlink::dialogToParams() const
        params["literal"] = literalCB->isChecked()
                        ? from_ascii("true") : from_ascii("false");
        params.setCmdName("href");
-       return from_utf8(InsetHyperlink::params2string(params));
+       return from_utf8(params.toString());
 }
 
 
index 3d4f3dde1b9282e64fd62b94a8eea740ecdda3b1..555db0eeef2a02adf498c39097f0d4ed74a32b04 100644 (file)
@@ -391,7 +391,7 @@ bool GuiInclude::initialiseParams(std::string const & sdata)
 
 void GuiInclude::dispatchParams()
 {
-       std::string const lfun = InsetCommand::params2string(params_);
+       std::string const lfun = params_.toString();
        dispatch(FuncRequest(getLfun(), lfun));
 }
 
index 6264d6a1012b24ba405675481cab6c29d689acf3..e23f5793b5ae171da4df8450e60766871f7e2ae0 100644 (file)
@@ -92,7 +92,7 @@ void GuiIndex::clearParams()
 
 void GuiIndex::dispatchParams()
 {
-       dispatch(FuncRequest(getLfun(), InsetIndex::params2string(params_)));
+       dispatch(FuncRequest(getLfun(), params_.toString()));
 }
 
 
index 78d1e3fc43dacc8d5b88e8ae86ab9032919cdc3b..102a89f1eb0e9257426b2b35cc8f77ee62288ca8 100644 (file)
@@ -54,7 +54,7 @@ docstring GuiLabel::dialogToParams() const
 {
        InsetCommandParams params(insetCode());
        params["name"] = qstring_to_ucs4(keywordED->text());
-       return from_utf8(InsetLabel::params2string(params));
+       return from_utf8(params.toString());
 }
 
 
index 2a8b9de2bc16429900fdb3d98c6da4af9c8037f0..139d12cc45b3bce868bcbdc9b1f0306a73bda3ad 100644 (file)
@@ -77,7 +77,7 @@ docstring GuiLine::dialogToParams() const
        params["width"] = from_utf8(widgetsToLength(WidthLE, WidthUnitCO));
        params["height"] = from_utf8(widgetsToLength(HeightLE, HeightUnitCO));
        params.setCmdName("rule");
-       return from_ascii(InsetLine::params2string(params));
+       return from_ascii(params.toString());
 }
 
 
index 0b3cb24b3b6dbf4f9468765752e4039366eaa02f..76483de160f2e4ea3770f27241ada2a5db1237d3 100644 (file)
@@ -690,7 +690,7 @@ void GuiListings::clearParams()
 
 void GuiListings::dispatchParams()
 {
-       string const lfun = InsetListings::params2string(params_);
+       string const lfun = params_.toString();
        dispatch(FuncRequest(getLfun(), lfun));
 }
 
index 92e7760abeed66d139fceef3fbf97f994f3d3de6..0d63f55b1aed03e84e36d299d930d1d4cade54c5 100644 (file)
@@ -61,7 +61,7 @@ docstring GuiNomenclature::dialogToParams() const
        params["description"] = qstring_to_ucs4(description);
        params["literal"] = literalCB->isChecked()
                        ? from_ascii("true") : from_ascii("false");
-       return from_utf8(InsetNomencl::params2string(params));
+       return from_utf8(params.toString());
 }
 
 
index 59c771d55c8dd9b127af783b23460a7c53fdf0b9..480f7b3f12e3745ae7548eb1fcee68d709defe40 100644 (file)
@@ -86,7 +86,7 @@ void GuiNote::clearParams()
 
 void GuiNote::dispatchParams()
 {
-       dispatch(FuncRequest(getLfun(), InsetNote::params2string(params_)));
+       dispatch(FuncRequest(getLfun(), params_.toString()));
 }
 
 
index 62fc99036c5c5f7f340a9850c51dc2343735decb..bcc8ee6d4f8638367506d72f70593872ca3bb227 100644 (file)
@@ -85,7 +85,7 @@ void GuiPhantom::clearParams()
 
 void GuiPhantom::dispatchParams()
 {
-       dispatch(FuncRequest(getLfun(), InsetPhantom::params2string(params_)));
+       dispatch(FuncRequest(getLfun(), params_.toString()));
 }
 
 
index a70a9e091ce535d2eda06467e16c19e94e8f95f4..8ea61cfdcc87060dac3b15c90785b8c16e6f0e5d 100644 (file)
@@ -86,7 +86,7 @@ docstring GuiPrintNomencl::dialogToParams() const
        if (set_width == from_ascii("custom"))
                width = from_utf8(widgetsToLength(valueLE, unitLC));
        params["width"] = width;
-       return from_ascii(InsetNomencl::params2string(params));
+       return from_ascii(params.toString());
 }
 
 
index b618287ae1af13bcb7f613b766881bd156161609..06071823350c746e5ef0bb3825cc9e97aab88f21 100644 (file)
@@ -126,7 +126,7 @@ bool GuiPrintindex::initialiseParams(string const & sdata)
 
 void GuiPrintindex::dispatchParams()
 {
-       std::string const lfun = InsetCommand::params2string(params_);
+       std::string const lfun = params_.toString();
        dispatch(FuncRequest(getLfun(), lfun));
 }
 
index 77ab51535de94f2d37fd8931db7e5dc67b36d81f..6686ed73c22788a737f40239b03d19486b2e2041 100644 (file)
@@ -611,7 +611,7 @@ bool GuiRef::initialiseParams(std::string const & sdata)
 
 void GuiRef::dispatchParams()
 {
-       std::string const lfun = InsetCommand::params2string(params_);
+       std::string const lfun = params_.toString();
        dispatch(FuncRequest(getLfun(), lfun));
        connectToNewInset();
 }
index 0f66cf07583f50e8f61ee71ef6329bc810bac3c2..8ecacbbe5af4df3b3b2e444640fa65412f07a301 100644 (file)
@@ -201,7 +201,7 @@ void GuiWrap::clearParams()
 
 void GuiWrap::dispatchParams()
 {
-       string const lfun = InsetWrap::params2string(params_);
+       string const lfun = params_.toString();
        dispatch(FuncRequest(getLfun(), lfun));
 }
 
index 266fb68d306968019ee50f711cfdd9c44811d770..584f22f5a1c576ad9ee829601aa023f730373a41 100644 (file)
@@ -1563,7 +1563,7 @@ void MenuDefinition::expandIndicesContext(Buffer const * buf, bool listof)
                if (listof) {
                        InsetCommandParams p(INDEX_PRINT_CODE);
                        p["type"] = cit->shortcut();
-                       string const data = InsetCommand::params2string(p);
+                       string const data = p.toString();
                        addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(cit->index()),
                                           FuncRequest(LFUN_INSET_MODIFY, data)));
                } else {
index 9cf0169422d39b392f1a20d5e722208e3076bdb6..60291bf62ba228cfc6d52026e3a79377b7bc04a0 100644 (file)
@@ -834,11 +834,11 @@ string InsetBox::contextMenuName() const
 }
 
 
-string InsetBox::params2string(InsetBoxParams const & params)
+string InsetBoxParams::toString() const
 {
        ostringstream data;
        data << "box" << ' ';
-       params.write(data);
+       write(data);
        return data.str();
 }
 
index a0a2334df9bd798c32b3fd7ef1dd059c0a7e64db..6cc0db6bf3e4698ef4abb5725f23f6c597b62d70 100644 (file)
@@ -30,6 +30,8 @@ public:
        void write(std::ostream & os) const override;
        ///
        void read(Lexer & lex) override;
+       ///
+       std::string toString() const override;
 
        ///
        std::string type;
@@ -92,8 +94,6 @@ public:
        ///
        InsetBox(Buffer *, std::string const &);
 
-       ///
-       static std::string params2string(InsetBoxParams const &);
        ///
        static void string2params(std::string const &, InsetBoxParams &);
        ///
index c0d6bd31e20f961fdbf1ba04a8853dab47a03f95..baa6c587685b6f8e700c9f43213f7df253226178 100644 (file)
@@ -387,10 +387,10 @@ bool InsetBranch::isMacroScope() const
 }
 
 
-string InsetBranch::params2string(InsetBranchParams const & params)
+string InsetBranchParams::toString() const
 {
        ostringstream data;
-       params.write(data);
+       write(data);
        return data.str();
 }
 
index fdde0a18160ecd62f00984df5baf73d187eca6bc..87eb71ff917a945a0863537a9688a4638b5f349a 100644 (file)
@@ -28,6 +28,8 @@ public:
        ///
        void read(Lexer & lex) override;
        ///
+       std::string toString() const override;
+       ///
        docstring branch;
        ///
        bool inverted;
@@ -48,8 +50,6 @@ public:
        ///
        InsetBranch(Buffer *, InsetBranchParams const &);
 
-       ///
-       static std::string params2string(InsetBranchParams const &);
        ///
        static void string2params(std::string const &, InsetBranchParams &);
        ///
index 1089247f839bae998f137f70eab5ab1ca6391712..0f3b33327bb218d78f77b3efdefdcde1f45c0062 100644 (file)
@@ -195,7 +195,7 @@ void InsetCommand::changeCmdName(string const & new_name)
                InsetCommandParams p(p_.code());
                p = p_;
                p.setCmdName(new_name);
-               string const data = InsetCommand::params2string(p);
+               string const data = p.toString();
                lyx::dispatch(FuncRequest(LFUN_INSET_INSERT, data));
                lyx::dispatch(FuncRequest(LFUN_CHAR_DELETE_FORWARD));
        } else
@@ -226,7 +226,7 @@ void InsetCommand::doDispatch(Cursor & cur, FuncRequest & cmd)
                        if (buffer().masterParams().track_changes) {
                                // With change tracking, we insert a new inset and
                                // delete the old one
-                               string const data = InsetCommand::params2string(p);
+                               string const data = p.toString();
                                lyx::dispatch(FuncRequest(LFUN_INSET_INSERT, data));
                                lyx::dispatch(FuncRequest(LFUN_CHAR_DELETE_FORWARD));
                                cur.forceBufferUpdate();
@@ -243,7 +243,7 @@ void InsetCommand::doDispatch(Cursor & cur, FuncRequest & cmd)
 
        case LFUN_INSET_DIALOG_UPDATE: {
                string const name = to_utf8(cmd.argument());
-               cur.bv().updateDialog(name, params2string(params()));
+               cur.bv().updateDialog(name, params().toString());
                break;
        }
 
@@ -293,7 +293,7 @@ string InsetCommand::contextMenuName() const
 bool InsetCommand::showInsetDialog(BufferView * bv) const
 {
        if (p_.code() != NO_CODE)
-               bv->showDialog(insetName(p_.code()), params2string(p_),
+               bv->showDialog(insetName(p_.code()), p_.toString(),
                        const_cast<InsetCommand *>(this));
        return true;
 }
@@ -322,16 +322,6 @@ bool InsetCommand::string2params(string const & data,
 }
 
 
-string InsetCommand::params2string(InsetCommandParams const & params)
-{
-       ostringstream data;
-       data << insetName(params.code()) << ' ';
-       params.write(data);
-       data << "\\end_inset\n";
-       return data.str();
-}
-
-
 bool decodeInsetParam(string const & name, string & data,
        Buffer const & buffer)
 {
@@ -348,8 +338,7 @@ bool decodeInsetParam(string const & name, string & data,
        case TOC_CODE:
        case HYPERLINK_CODE:
        case COUNTER_CODE: {
-               InsetCommandParams p(code);
-               data = InsetCommand::params2string(p);
+               data = InsetCommandParams(code).toString();
                break;
        }
        case INCLUDE_CODE: {
@@ -358,24 +347,20 @@ bool decodeInsetParam(string const & name, string & data,
                if (data.empty())
                        // default type is requested
                        data = "include";
-               InsetCommandParams p(INCLUDE_CODE, data);
-               data = InsetCommand::params2string(p);
+               data = InsetCommandParams(INCLUDE_CODE, data).toString();
                break;
        }
        case BOX_CODE: {
                // \c data == "Boxed" || "Frameless" etc
-               InsetBoxParams p(data);
-               data = InsetBox::params2string(p);
+               data = InsetBoxParams(data).toString();
                break;
        }
        case BRANCH_CODE: {
-               InsetBranchParams p;
-               data = InsetBranch::params2string(p);
+               data = InsetBranchParams().toString();
                break;
        }
        case CITE_CODE: {
-               InsetCommandParams p(CITE_CODE);
-               data = InsetCommand::params2string(p);
+               data = InsetCommandParams(CITE_CODE).toString();
                break;
        }
        case ERT_CODE: {
@@ -383,48 +368,39 @@ bool decodeInsetParam(string const & name, string & data,
                break;
        }
        case EXTERNAL_CODE: {
-               InsetExternalParams p(&buffer);
-               data = InsetExternal::params2string(p);
+               data = InsetExternalParams(&buffer).toString();
                break;
        }
        case FLOAT_CODE:  {
-               InsetFloatParams p;
-               data = InsetFloat::params2string(p);
+               data = InsetFloatParams().toString();
                break;
        }
        case INDEX_CODE: {
-               InsetIndexParams p;
-               data = InsetIndex::params2string(p);
+               data = InsetIndexParams().toString();
                break;
        }
        case LISTINGS_CODE: {
-               InsetListingsParams p;
-               data = InsetListings::params2string(p);
+               data = InsetListingsParams().toString();
                break;
        }
        case GRAPHICS_CODE: {
-               InsetGraphicsParams p(&buffer);
-               data = InsetGraphics::params2string(p);
+               data = InsetGraphicsParams(&buffer).toString();
                break;
        }
        case MATH_SPACE_CODE: {
-               InsetSpaceParams p(true);
-               data = InsetSpace::params2string(p);
+               data = InsetSpaceParams(true).toString();
                break;
        }
        case NOTE_CODE: {
-               InsetNoteParams p;
-               data = InsetNote::params2string(p);
+               data = InsetNoteParams().toString();
                break;
        }
        case PHANTOM_CODE: {
-               InsetPhantomParams p;
-               data = InsetPhantom::params2string(p);
+               data = InsetPhantomParams().toString();
                break;
        }
        case SPACE_CODE: {
-               InsetSpaceParams p;
-               data = InsetSpace::params2string(p);
+               data = InsetSpaceParams().toString();
                break;
        }
        case VSPACE_CODE: {
@@ -433,8 +409,7 @@ bool decodeInsetParam(string const & name, string & data,
                break;
        }
        case WRAP_CODE: {
-               InsetWrapParams p;
-               data = InsetWrap::params2string(p);
+               data = InsetWrapParams().toString();
                break;
        }
        default:
index 7b2b5bde08700cee77d958a6c886afcc01876525..a4c66b3d1fcfb4251069066dfe31213ea7df72d3 100644 (file)
@@ -51,8 +51,6 @@ public:
        static bool string2params(std::string const & data,
                                  InsetCommandParams &);
        ///
-       static std::string params2string(InsetCommandParams const &);
-       ///
        InsetCommandParams const & params() const { return p_; }
        ///
        void setParams(InsetCommandParams const &);
index 09c9ee85a0926b279c396cec0040a97eecda13e2..4ea716f9c451d5e2783d789b650fe3cc5139229e 100644 (file)
@@ -604,6 +604,16 @@ docstring InsetCommandParams::getFirstNonOptParam() const
 }
 
 
+string InsetCommandParams::toString() const
+{
+       ostringstream data;
+       data << insetName(code()) << ' ';
+       write(data);
+       data << "\\end_inset\n";
+       return data.str();
+}
+
+
 docstring const & InsetCommandParams::operator[](string const & name) const
 {
        static const docstring dummy;
index 4e417ad94d14def879cd09cb50815f52d32eaaf8..a7656dc4fc0dd18ef244c5f1f28440988739bbad 100644 (file)
@@ -136,6 +136,8 @@ public:
        void write(std::ostream &) const override;
        ///
        void Write(std::ostream & os, Buffer const * buf) const;
+       ///
+       std::string toString() const override;
        /// Build the complete LaTeX command
        docstring getCommand(OutputParams const &) const;
        /// Return the command name
index eba87560567ae180e35f92b9c69ef1df128c9149..42918ec81dce85ab5f79ac727664c84168e85c48 100644 (file)
@@ -478,8 +478,7 @@ void InsetExternal::doDispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_INSET_DIALOG_UPDATE: {
                InsetExternalParams p(params());
                p.setBuffer(&cur.bv().buffer());
-               cur.bv().updateDialog("external",
-                       params2string(p));
+               cur.bv().updateDialog("external", p.toString());
                break;
        }
 
@@ -520,7 +519,7 @@ bool InsetExternal::showInsetDialog(BufferView * bv) const
 {
        InsetExternalParams p(params());
        p.setBuffer(&bv->buffer());
-       bv->showDialog("external", params2string(p),
+       bv->showDialog("external", p.toString(),
                const_cast<InsetExternal *>(this));
        return true;
 }
@@ -935,11 +934,11 @@ void InsetExternal::string2params(string const & in, InsetExternalParams & param
 }
 
 
-string InsetExternal::params2string(InsetExternalParams const & params)
+string InsetExternalParams::toString() const
 {
        ostringstream data;
        data << "external" << ' ';
-       params.write(data);
+       write(data);
        data << "\\end_inset\n";
        return data.str();
 }
index 1649802d07fc91b81bcd6535a7da06a0e62b7e14..8d233c80b748cf4a6289546b9cf251dedf26e345 100644 (file)
@@ -53,6 +53,7 @@ public:
 
        void write(std::ostream &) const override;
        void read(Lexer &) override;
+       std::string toString() const override;
 
        Buffer const * buffer() { return buffer_; }
        void setBuffer(Buffer const * b) { buffer_ = b; }
@@ -105,8 +106,6 @@ public:
        ///
        static void string2params(std::string const &, InsetExternalParams &);
        ///
-       static std::string params2string(InsetExternalParams const &);
-       ///
        InsetExternalParams const & params() const;
        ///
        void setParams(InsetExternalParams const &);
index db74e9ef1b35edeb306d5df06101fb394bcb5d2a..b6120ddd986c5c943c197b513640269ed15af369 100644 (file)
@@ -189,7 +189,7 @@ void InsetFloat::doDispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_INSET_DIALOG_UPDATE: {
-               cur.bv().updateDialog("float", params2string(params()));
+               cur.bv().updateDialog("float", params().toString());
                break;
        }
 
@@ -281,7 +281,7 @@ void InsetFloatParams::write(ostream & os) const
 {
        if (type.empty()) {
                // Better this than creating a parse error. This in fact happens in the
-               // parameters dialog via InsetFloatParams::params2string.
+               // parameters dialog via InsetFloatParams::toString.
                os << "senseless" << '\n';
        } else
                os << type << '\n';
@@ -967,10 +967,10 @@ void InsetFloat::string2params(string const & in, InsetFloatParams & params)
 }
 
 
-string InsetFloat::params2string(InsetFloatParams const & params)
+string InsetFloatParams::toString() const
 {
        ostringstream data;
-       params.write(data);
+       write(data);
        return data.str();
 }
 
index daa5b3181dafa3c54990fd38fe46218f0e685e21..9a043b5babb9b0ec97d7952b240e721bcc1138f3 100644 (file)
@@ -32,6 +32,8 @@ public:
        ///
        void read(Lexer & lex) override;
        ///
+       std::string toString() const override;
+       ///
        std::string type;
        ///
        std::string placement;
@@ -61,8 +63,6 @@ public:
        ///
        static void string2params(std::string const &, InsetFloatParams &);
        ///
-       static std::string params2string(InsetFloatParams const &);
-       ///
        void setWide(bool w, bool update_label = true);
        ///
        void setSideways(bool s, bool update_label = true);
index e711feebf4c6db3e397a2c441fcb48111cf5d0c4..d5ff6cd6045272daab35921345a40e9019b38afd 100644 (file)
@@ -87,7 +87,7 @@ void InsetFloatList::doDispatch(Cursor & cur, FuncRequest & cmd) {
        switch (cmd.action()) {
        case LFUN_MOUSE_RELEASE:
                if (!cur.selection() && cmd.button() == mouse_button::button1) {
-                       cur.bv().showDialog("toc", params2string(params()));
+                       cur.bv().showDialog("toc", params().toString());
                        cur.dispatched();
                }
                break;
index 8d56fc9f1cd2696bc8bb9bffedf31d86875a080a..14f303c1a548ec453ec8bfcf9edbb43c0b784271 100644 (file)
@@ -243,7 +243,7 @@ void InsetGraphics::doDispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_INSET_DIALOG_UPDATE: {
                InsetGraphicsParams p(params());
                p.setBuffer(&buffer());
-               cur.bv().updateDialog("graphics", params2string(p));
+               cur.bv().updateDialog("graphics", p.toString());
                break;
        }
 
@@ -283,7 +283,7 @@ bool InsetGraphics::showInsetDialog(BufferView * bv) const
 {
        InsetGraphicsParams p(params());
        p.setBuffer(&bv->buffer());
-       bv->showDialog("graphics", params2string(p),
+       bv->showDialog("graphics", p.toString(),
                const_cast<InsetGraphics *>(this));
        return true;
 }
@@ -1178,16 +1178,6 @@ void InsetGraphics::string2params(string const & in, InsetGraphicsParams & param
 }
 
 
-string InsetGraphics::params2string(InsetGraphicsParams const & params)
-{
-       ostringstream data;
-       data << "graphics" << ' ';
-       params.write(data);
-       data << "\\end_inset\n";
-       return data.str();
-}
-
-
 docstring InsetGraphics::toolTip(BufferView const &, int, int) const
 {
        return from_utf8(params().filename.onlyFileName());
@@ -1237,7 +1227,7 @@ string getGroupParams(Buffer const & b, string const & groupId)
                        InsetGraphicsParams tmp = inspar;
                        tmp.setBuffer(&b);
                        tmp.filename.erase();
-                       return InsetGraphics::params2string(tmp);
+                       return tmp.toString();
                }
        }
        return string();
index 151e4313f2ac34b5ee0262e722988fc521d7b110..a597ca31e909b02cd83d7c07ebcf210d55a4ef50 100644 (file)
@@ -41,8 +41,6 @@ public:
        ///
        static void string2params(std::string const & data,
                                  InsetGraphicsParams &);
-       ///
-       static std::string params2string(InsetGraphicsParams const &);
 
        /** Set the inset parameters, used by the GUIndependent dialog.
            Return true of new params are different from what was so far.
index a33ef661033c0c5eb44d20695bafc01617e125c8..c4de6335528e67cb5563f64c9cad44e28a33969d 100644 (file)
@@ -28,6 +28,7 @@
 #include "support/Translator.h"
 
 #include <ostream>
+#include <sstream>
 
 using namespace std;
 using namespace lyx::support;
@@ -253,6 +254,16 @@ bool InsetGraphicsParams::read(Lexer & lex, string const & token, bool allowOrig
 }
 
 
+string InsetGraphicsParams::toString() const
+{
+       ostringstream data;
+       data << "graphics" << ' ';
+       write(data);
+       data << "\\end_inset\n";
+       return data.str();
+}
+
+
 graphics::Params InsetGraphicsParams::as_grfxParams() const
 {
        graphics::Params pars;
index bae4d3598218c21db42cc958391469e197c6c8d8..be3fae8a14bd6b48c9634b2f0c67073e68241302 100644 (file)
@@ -81,6 +81,8 @@ public:
        void write(std::ostream & os) const;
        /// If the token belongs to our parameters, read it.
        bool read(Lexer & lex, std::string const & token, bool allowOrigin);
+       ///
+       std::string toString() const;
        /// convert
        // Only a subset of InsetGraphicsParams is needed for display purposes.
        // This function also interrogates lyxrc to ascertain whether
index 5d2035b5591d5537df07713c77dcb59717f87f77..1da5e295995f94f9d3760385b6ed09bc91808ae6 100644 (file)
@@ -340,11 +340,11 @@ docstring InsetIPADeco::toolTip(BufferView const &, int, int) const
 }
 
 
-string InsetIPADeco::params2string(InsetIPADecoParams const & params)
+string InsetIPADecoParams::toString() const
 {
        ostringstream data;
        data << "IPADeco" << ' ';
-       params.write(data);
+       write(data);
        return data.str();
 }
 
index 432bb5a897b0c1cf356c6e70ff29f9e802403bfa..41dd3bf405f4c2433bfd0588597e4aa40e4a66e9 100644 (file)
@@ -35,6 +35,8 @@ public:
        ///
        void read(Lexer & lex) override;
        ///
+       std::string toString() const override;
+       ///
        Type type;
 };
 
@@ -53,8 +55,6 @@ public:
        ///
        ~InsetIPADeco();
        ///
-       static std::string params2string(InsetIPADecoParams const &);
-       ///
        static void string2params(std::string const &, InsetIPADecoParams &);
        ///
        InsetIPADecoParams const & params() const { return params_; }
index 149ef6506a32ef703741b28089d122f48df57ccd..4deae0eba304e245e919e3bdc90ba82557db4b09 100644 (file)
@@ -384,7 +384,7 @@ docstring InsetIndex::xhtml(XMLStream & xs, OutputParams const &) const
 
 bool InsetIndex::showInsetDialog(BufferView * bv) const
 {
-       bv->showDialog("index", params2string(params_),
+       bv->showDialog("index", params_.toString(),
                        const_cast<InsetIndex *>(this));
        return true;
 }
@@ -411,7 +411,7 @@ void InsetIndex::doDispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_INSET_DIALOG_UPDATE:
-               cur.bv().updateDialog("index", params2string(params_));
+               cur.bv().updateDialog("index", params_.toString());
                break;
 
        default:
@@ -520,11 +520,11 @@ void InsetIndex::read(Lexer & lex)
 }
 
 
-string InsetIndex::params2string(InsetIndexParams const & params)
+string InsetIndexParams::toString() const
 {
        ostringstream data;
        data << "index";
-       params.write(data);
+       write(data);
        return data.str();
 }
 
index b2038536f2e98c8236c021359112352e7a412225..c2f23a610c1b995eb416e536a1b9997447efe03f 100644 (file)
@@ -29,6 +29,8 @@ public:
        ///
        void read(Lexer & lex) override;
        ///
+       std::string toString() const override;
+
        docstring index;
 };
 
@@ -40,8 +42,6 @@ public:
        ///
        InsetIndex(Buffer *, InsetIndexParams const &);
        ///
-       static std::string params2string(InsetIndexParams const &);
-       ///
        static void string2params(std::string const &, InsetIndexParams &);
 private:
        ///
index 2c0c1e5194be2844a90267799f966f103516f92f..910c08682c849d1dec2a52e8c205986a1e4be2a4 100644 (file)
@@ -104,7 +104,7 @@ void InsetLabel::updateLabelAndRefs(docstring const & new_label,
                // delete the old one
                InsetCommandParams p(LABEL_CODE, "label");
                p["name"] = label;
-               string const data = InsetCommand::params2string(p);
+               string const data = p.toString();
                lyx::dispatch(FuncRequest(LFUN_INSET_INSERT, data));
                lyx::dispatch(FuncRequest(LFUN_CHAR_DELETE_FORWARD));
        } else
@@ -294,7 +294,7 @@ void InsetLabel::doDispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_LABEL_INSERT_AS_REFERENCE: {
                InsetCommandParams p(REF_CODE, "ref");
                p["reference"] = getParam("name");
-               string const data = InsetCommand::params2string(p);
+               string const data = p.toString();
                lyx::dispatch(FuncRequest(LFUN_INSET_INSERT, data));
                break;
        }
index 51763d40afda5e378cc070123c3c899fca33a656..c99e4c512d739f3e3acf1059c83279f56b317c19 100644 (file)
@@ -569,7 +569,7 @@ void InsetListings::doDispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_INSET_DIALOG_UPDATE:
-               cur.bv().updateDialog("listings", params2string(params()));
+               cur.bv().updateDialog("listings", params().toString());
                break;
 
        default:
@@ -635,7 +635,7 @@ void InsetListings::validate(LaTeXFeatures & features) const
 
 bool InsetListings::showInsetDialog(BufferView * bv) const
 {
-       bv->showDialog("listings", params2string(params()),
+       bv->showDialog("listings", params().toString(),
                const_cast<InsetListings *>(this));
        return true;
 }
@@ -700,13 +700,4 @@ void InsetListings::string2params(string const & in,
 }
 
 
-string InsetListings::params2string(InsetListingsParams const & params)
-{
-       ostringstream data;
-       data << "listings" << ' ';
-       params.write(data);
-       return data.str();
-}
-
-
 } // namespace lyx
index 1a8007864538c2b4cfea2f7c23145d512838ba25..cc65ef14a606d960a8c110f41c7cda27740b7e49 100644 (file)
@@ -36,8 +36,6 @@ public:
        ~InsetListings();
        ///
        static void string2params(std::string const &, InsetListingsParams &);
-       ///
-       static std::string params2string(InsetListingsParams const &);
 private:
        ///
        bool isLabeled() const override { return true; }
index 8ffb4387974b8be06fd58b4275c4abbfecc2c3b6..ab8a0573c36261305321ed9efce2e0eb70fbc0b6 100644 (file)
@@ -1006,6 +1006,15 @@ void InsetListingsParams::read(Lexer & lex)
 }
 
 
+string InsetListingsParams::toString() const
+{
+       ostringstream data;
+       data << "listings" << ' ';
+       write(data);
+       return data.str();
+}
+
+
 string InsetListingsParams::params(string const & sep) const
 {
        string par;
index 7497110738abbbd0bd0ef450a185001e71c91963..6f008b88653e9c680fe4bfc4206a95067b3ae312 100644 (file)
@@ -33,6 +33,9 @@ public:
        /// read parameters from an ostream
        void read(Lexer &) override;
 
+       ///
+       std::string toString() const override;
+
        /// valid parameter string
        std::string params(std::string const & sep=",") const;
 
index f5fcd42ac6a54f32e4ab7b0bc439813e9b2aa309..983457dd533313d3323d468f4a4f5b318edc5444 100644 (file)
@@ -281,11 +281,11 @@ void InsetNewline::string2params(string const & in, InsetNewlineParams & params)
 }
 
 
-string InsetNewline::params2string(InsetNewlineParams const & params)
+string InsetNewlineParams::toString() const
 {
        ostringstream data;
        data << "newline" << ' ';
-       params.write(data);
+       write(data);
        return data.str();
 }
 
index 10f894d1e67e47b6aef36a9774985ed49bf106af..82667f524050369243bd06c9476234744ae1ab22 100644 (file)
@@ -34,6 +34,8 @@ public:
        ///
        void read(Lexer & lex) override;
        ///
+       std::string toString() const override;
+       ///
        Kind kind;
 };
 
@@ -50,8 +52,6 @@ public:
        RowFlags rowFlags() const override { return BreakAfter | RowAfter; }
        ///
        static void string2params(std::string const &, InsetNewlineParams &);
-       ///
-       static std::string params2string(InsetNewlineParams const &);
 private:
        ///
        InsetCode lyxCode() const override { return NEWLINE_CODE; }
index da944526321eb299cca73cc096ca368541d13749..6ab41fa3cedcc082ec97d192f3a4657bcc3078b3 100644 (file)
@@ -351,11 +351,11 @@ void InsetNewpage::string2params(string const & in, InsetNewpageParams & params)
 }
 
 
-string InsetNewpage::params2string(InsetNewpageParams const & params)
+string InsetNewpageParams::toString() const
 {
        ostringstream data;
        data << "newpage" << ' ';
-       params.write(data);
+       write(data);
        return data.str();
 }
 
index 633b81ffd7a547634e1cabc6b376bc4b74791485..55df6b8b96c3a85a3e3c2574c9e74a5eb1f9b069 100644 (file)
@@ -40,6 +40,8 @@ public:
        ///
        void read(Lexer & lex) override;
        ///
+       std::string toString() const override;
+       ///
        Kind kind;
 };
 
@@ -53,8 +55,6 @@ public:
        explicit InsetNewpage(InsetNewpageParams const & par);
        ///
        static void string2params(std::string const &, InsetNewpageParams &);
-       ///
-       static std::string params2string(InsetNewpageParams const &);
 private:
        ///
        InsetCode lyxCode() const override { return NEWPAGE_CODE; }
index 28d8db18e5d42f48b58be6614e8a440139990ec1..c2ab7e003f58a506963e66e45d74fcb8d3b26529 100644 (file)
@@ -129,7 +129,7 @@ void InsetNote::read(Lexer & lex)
 
 bool InsetNote::showInsetDialog(BufferView * bv) const
 {
-       bv->showDialog("note", params2string(params()),
+       bv->showDialog("note", params().toString(),
                const_cast<InsetNote *>(this));
        return true;
 }
@@ -161,7 +161,7 @@ void InsetNote::doDispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_INSET_DIALOG_UPDATE:
-               cur.bv().updateDialog("note", params2string(params()));
+               cur.bv().updateDialog("note", params().toString());
                break;
 
        default:
@@ -338,11 +338,11 @@ FontInfo InsetNote::getFont() const
 }
 
 
-string InsetNote::params2string(InsetNoteParams const & params)
+string InsetNoteParams::toString() const
 {
        ostringstream data;
        data << "note" << ' ';
-       params.write(data);
+       write(data);
        return data.str();
 }
 
index bf14e147588bd16e9160392b50c1739b8fa3dd9c..eb99a139e003f7012be76a91fa8aa4ccff70da9f 100644 (file)
@@ -32,6 +32,8 @@ public:
        ///
        void read(Lexer & lex) override;
        ///
+       std::string toString() const override;
+
        Type type;
 };
 
@@ -51,8 +53,6 @@ public:
        ///
        ~InsetNote();
        ///
-       static std::string params2string(InsetNoteParams const &);
-       ///
        static void string2params(std::string const &, InsetNoteParams &);
        ///
        InsetNoteParams const & params() const { return params_; }
index 0d7060317a41f394034a4b6c47518586865f4dc5..81866cb33ab862ea965bc195cf9549531edcb1cd 100644 (file)
@@ -13,6 +13,7 @@
 #define INSETPARAMS_H
 
 #include <ostream>
+#include <string>
 
 namespace lyx {
 
@@ -28,6 +29,8 @@ public:
        virtual void write(std::ostream & os) const = 0;
        ///
        virtual void read(Lexer & lex) = 0;
+       ///
+       virtual std::string toString() const = 0;
 };
 
 
index d1a25f6a70bc32cfcce4f32712c6112e7e37ca97..61d41ca2b2230678b7a1c82569a2ca535f8be8e6 100644 (file)
@@ -238,7 +238,7 @@ void InsetPhantom::setButtonLabel()
 
 bool InsetPhantom::showInsetDialog(BufferView * bv) const
 {
-       bv->showDialog("phantom", params2string(params()),
+       bv->showDialog("phantom", params().toString(),
                const_cast<InsetPhantom *>(this));
        return true;
 }
@@ -256,7 +256,7 @@ void InsetPhantom::doDispatch(Cursor & cur, FuncRequest & cmd)
                break;
 
        case LFUN_INSET_DIALOG_UPDATE:
-               cur.bv().updateDialog("phantom", params2string(params()));
+               cur.bv().updateDialog("phantom", params().toString());
                break;
 
        default:
@@ -362,11 +362,11 @@ string InsetPhantom::contextMenuName() const
 }
 
 
-string InsetPhantom::params2string(InsetPhantomParams const & params)
+string InsetPhantomParams::toString() const
 {
        ostringstream data;
        data << "phantom" << ' ';
-       params.write(data);
+       write(data);
        return data.str();
 }
 
index 2ca9b056221625faf3b394531220e34508c70c36..4d31099b031e1c295b2b8a81b3b1e341a30a98ca 100644 (file)
@@ -32,6 +32,7 @@ public:
        ///
        void read(Lexer & lex) override;
        ///
+       std::string toString() const override;
        Type type;
 };
 
@@ -51,8 +52,6 @@ public:
        ///
        ~InsetPhantom();
        ///
-       static std::string params2string(InsetPhantomParams const &);
-       ///
        static void string2params(std::string const &, InsetPhantomParams &);
        ///
        InsetPhantomParams const & params() const { return params_; }
index ed43d6a9505c5a4f37aa108cfa46070794890bc4..2a5415ab53c92c4e348320d5b24e661fcea7dcd7 100644 (file)
@@ -92,7 +92,7 @@ void InsetRef::changeTarget(docstring const & new_label)
        if (buffer().masterParams().track_changes) {
                InsetCommandParams icp(REF_CODE, "ref");
                icp["reference"] = new_label;
-               string const data = InsetCommand::params2string(icp);
+               string const data = icp.toString();
                lyx::dispatch(FuncRequest(LFUN_INSET_INSERT, data));
                lyx::dispatch(FuncRequest(LFUN_CHAR_DELETE_FORWARD));
        } else
index c1f8da1e828406a3966ed922a1a3c25a8a452059..4a9ed85ee84512c590cc6626ea26aa7f2c53542c 100644 (file)
@@ -378,11 +378,11 @@ string InsetScript::contextMenuName() const
 }
 
 
-string InsetScript::params2string(InsetScriptParams const & params)
+string InsetScriptParams::toString() const
 {
        ostringstream data;
        data << "script ";
-       params.write(data);
+       write(data);
        return data.str();
 }
 
index e4a9da7621c223aa752d028a4b33d26d747e4c91..516f40fc1419ba5dcb1a743b82921e851da79cdd 100644 (file)
@@ -32,6 +32,8 @@ public:
        ///
        void read(Lexer & lex) override;
        ///
+       std::string toString() const override;
+       ///
        int shift(FontInfo const & font) const;
        ///
        Type type;
@@ -55,8 +57,6 @@ public:
        ///
        ~InsetScript();
        ///
-       static std::string params2string(InsetScriptParams const &);
-       ///
        static void string2params(std::string const &, InsetScriptParams &);
        ///
        InsetScriptParams const & params() const { return params_; }
index 218172c87af761e1ade1423b71720dc69e3f4ec9..5d6b71f7342db0ab9ba467f2d1e38b2b95f92edf 100644 (file)
@@ -302,11 +302,11 @@ void InsetSeparator::string2params(string const & in, InsetSeparatorParams & par
 }
 
 
-string InsetSeparator::params2string(InsetSeparatorParams const & params)
+string InsetSeparatorParams::toString() const
 {
        ostringstream data;
        data << "separator" << ' ';
-       params.write(data);
+       write(data);
        return data.str();
 }
 
index 212d3894b434d23635b53ea3c9b076bd1c3cebeb..b930a2ada2c8dfcbd15f5e268834ea124185c705 100644 (file)
@@ -33,6 +33,8 @@ public:
        ///
        void read(Lexer & lex) override;
        ///
+       std::string toString() const override;
+
        Kind kind;
 };
 
@@ -46,8 +48,6 @@ public:
        explicit InsetSeparator(InsetSeparatorParams const & params);
        ///
        static void string2params(std::string const &, InsetSeparatorParams &);
-       ///
-       static std::string params2string(InsetSeparatorParams const &);
        /// To be used in combination with inset-forall
        /// Here's a command that removes every latexpar separator:
        ///   inset-forall Separator:latexpar char-delete-forward
index 2deea3097ee239a59393a38834e9dd65e49c84b8..4f9ba96e5910dfae0c722c48790b002d0309b253 100644 (file)
@@ -158,7 +158,7 @@ void InsetSpace::doDispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_INSET_DIALOG_UPDATE:
-               cur.bv().updateDialog("space", params2string(params()));
+               cur.bv().updateDialog("space", params().toString());
                break;
 
        default:
@@ -946,13 +946,13 @@ void InsetSpace::string2params(string const & in, InsetSpaceParams & params)
 }
 
 
-string InsetSpace::params2string(InsetSpaceParams const & params)
+string InsetSpaceParams::toString() const
 {
        ostringstream data;
-       if (params.math)
+       if (math)
                data << "math";
        data << "space" << ' ';
-       params.write(data);
+       write(data);
        return data.str();
 }
 
index a4fb63357fe03773e7efddf7697e58542168dd52..44f6a5e61e871b38dd705c7389f9ed6d151922e0 100644 (file)
@@ -81,6 +81,8 @@ struct InsetSpaceParams : public InsetParams {
        ///
        void read(Lexer & lex) override;
        ///
+       std::string toString() const override;
+       ///
        Kind kind;
        ///
        GlueLength length;
@@ -108,8 +110,6 @@ public:
        ///
        static void string2params(std::string const &, InsetSpaceParams &);
        ///
-       static std::string params2string(InsetSpaceParams const &);
-       ///
        GlueLength length() const;
 
        ///
index a429d2d5bcf1326493016c812e983b22e413cf91..6302f819ada4789b8668a4e95bdf6b14e8a3ebf3 100644 (file)
@@ -83,7 +83,7 @@ void InsetTOC::doDispatch(Cursor & cur, FuncRequest & cmd) {
        switch (cmd.action()) {
        case LFUN_MOUSE_RELEASE:
                if (!cur.selection() && cmd.button() == mouse_button::button1) {
-                       cur.bv().showDialog("toc", params2string(params()));
+                       cur.bv().showDialog("toc", params().toString());
                        cur.dispatched();
                }
                break;
index c862b175f7c9f08dbfb33439934597d085b2899f..d70f8818da67a38665e03657d3e9c8d73174a85f 100644 (file)
@@ -102,7 +102,7 @@ void InsetWrap::doDispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_INSET_DIALOG_UPDATE:
-               cur.bv().updateDialog("wrap", params2string(params()));
+               cur.bv().updateDialog("wrap", params().toString());
                break;
 
        default:
@@ -248,7 +248,7 @@ bool InsetWrap::insetAllowed(InsetCode code) const
 bool InsetWrap::showInsetDialog(BufferView * bv) const
 {
        if (!InsetText::showInsetDialog(bv))
-               bv->showDialog("wrap", params2string(params()),
+               bv->showDialog("wrap", params().toString(),
                        const_cast<InsetWrap *>(this));
        return true;
 }
@@ -268,11 +268,11 @@ void InsetWrap::string2params(string const & in, InsetWrapParams & params)
 }
 
 
-string InsetWrap::params2string(InsetWrapParams const & params)
+string InsetWrapParams::toString() const
 {
        ostringstream data;
        data << "wrap" << ' ';
-       params.write(data);
+       write(data);
        return data.str();
 }
 
index bbf4000820965a6cf4f08cbad58269fbad82932a..bf65db4e58766eab2f630d0dc7de04b373c64feb 100644 (file)
@@ -26,7 +26,8 @@ public:
        void write(std::ostream &) const override;
        ///
        void read(Lexer &) override;
-
+       ///
+       std::string toString() const override;
        ///
        std::string type;
        ///
@@ -52,8 +53,6 @@ public:
        InsetWrapParams const & params() const { return params_; }
        ///
        static void string2params(std::string const &, InsetWrapParams &);
-       ///
-       static std::string params2string(InsetWrapParams const &);
 private:
        ///
        void setCaptionType(std::string const & type) override;
index 24e4397490573b0e117da11cd4a44b956efd2cd1..522c4405a5d7bbc4316e4c3576b37e25ab8e3a68 100644 (file)
@@ -1881,7 +1881,7 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd)
 
                InsetCommandParams p(LABEL_CODE);
                p["name"] = cmd.argument().empty() ? old_label : cmd.argument();
-               string const data = InsetCommand::params2string(p);
+               string const data = p.toString();
 
                if (cmd.argument().empty())
                        cur.bv().showDialog("label", data);
index 7170ca637806dc5dca630426818f4c8de265d957..bdff2685592c2fedf852c296bda3a59ca1f65c60 100644 (file)
@@ -233,7 +233,7 @@ string const InsetMathRef::createDialogStr() const
        icp["reference"] = asString(cell(0));
        if (!cell(1).empty())
                icp["name"] = asString(cell(1));
-       return InsetCommand::params2string(icp);
+       return icp.toString();
 }
 
 
@@ -252,7 +252,7 @@ void InsetMathRef::changeTarget(docstring const & target)
        MathData ar;
        Buffer & buf = buffer();
        if (createInsetMath_fromDialogStr(
-           from_utf8(InsetCommand::params2string(icp)), ar)) {
+           from_utf8(icp.toString()), ar)) {
                *this = *ar[0].nucleus()->asRefInset();
                // FIXME audit setBuffer calls
                setBuffer(buf);