diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-18 12:30:40 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-09-29 12:43:37 +0200 |
commit | 1820fcbbc38e82daf43ebe759200050ce05b3fe1 (patch) | |
tree | f5a494e6a437971ef7b9ae003547d4b156bb8b13 | |
parent | 66889d5219cec22bd0e654e5a812e90cdd04e59d (diff) |
constmethod for accessor-type methods
Apply the constmethod plugin, but only to accessor-type methods, e.g.
IsFoo(), GetBar(), etc, where we can be sure of that
constifying is a reasonable thing to do.
Change-Id: Ibc97f5f359a0992dd1ce2d66f0189f8a0a43d98a
Reviewed-on: https://gerrit.libreoffice.org/74269
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
23 files changed, 91 insertions, 88 deletions
diff --git a/compilerplugins/clang/store/constmethod.cxx b/compilerplugins/clang/constmethod.cxx index d4bae3f015f3..888d1bbd15bd 100644 --- a/compilerplugins/clang/store/constmethod.cxx +++ b/compilerplugins/clang/constmethod.cxx @@ -30,38 +30,13 @@ namespace { -static bool startswith(const std::string& rStr, const char* pSubStr) { - return rStr.compare(0, strlen(pSubStr), pSubStr) == 0; -} - class ConstMethod: public loplugin::FunctionAddress<ConstMethod> { public: - explicit ConstMethod(InstantiationData const & data): loplugin::FunctionAddress<ConstMethod>(data) {} + explicit ConstMethod(loplugin::InstantiationData const & data): loplugin::FunctionAddress<ConstMethod>(data) {} virtual void run() override { - std::string fn( compiler.getSourceManager().getFileEntryForID( - compiler.getSourceManager().getMainFileID())->getName() ); - normalizeDotDotInFilePath(fn); - if (fn.find("/qa/") != std::string::npos) - return; - // the rest of the stuff in these folders is technically const, but not logically const (IMO) - if (startswith(fn, SRCDIR "/unotools/")) - return; - if (startswith(fn, SRCDIR "/svl/")) - return; - if (startswith(fn, SRCDIR "/binaryurp/")) - return; - if (startswith(fn, SRCDIR "/cpputools/")) - return; - if (startswith(fn, SRCDIR "/opencl/")) - return; - if (startswith(fn, SRCDIR "/helpcompiler/")) - return; - // very little in here can usefully be made const. Could tighten this up a little and only exclude stuff declared in .cxx files - if (startswith(fn, SRCDIR "/vcl/")) - return; TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); for (const CXXMethodDecl *pMethodDecl : interestingMethodSet) { @@ -71,22 +46,21 @@ public: if (getFunctionsWithAddressTaken().find((FunctionDecl const *)canonicalDecl) != getFunctionsWithAddressTaken().end()) continue; - StringRef aFileName = compiler.getSourceManager().getFilename(compiler.getSourceManager().getSpellingLoc(canonicalDecl->getLocStart())); + StringRef aFileName = compiler.getSourceManager().getFilename(compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(canonicalDecl))); if (loplugin::isSamePathname(aFileName, SRCDIR "/include/LibreOfficeKit/LibreOfficeKit.hxx")) continue; report( DiagnosticsEngine::Warning, "this method can be const", - pMethodDecl->getLocStart()) + compat::getBeginLoc(pMethodDecl)) << pMethodDecl->getSourceRange(); if (canonicalDecl->getLocation() != pMethodDecl->getLocation()) { report( DiagnosticsEngine::Note, "canonical method declaration here", - canonicalDecl->getLocStart()) + compat::getBeginLoc(canonicalDecl)) << canonicalDecl->getSourceRange(); } - //pMethodDecl->dump(); } } @@ -160,12 +134,27 @@ bool ConstMethod::VisitCXXMethodDecl(const CXXMethodDecl * cxxMethodDecl) if (!cxxMethodDecl->getIdentifier()) return true; + if (cxxMethodDecl->getNumParams() > 0) + return true; + // returning pointers or refs to non-const stuff, and then having the whole method + // be const doesn't seem like a good idea + auto tc = loplugin::TypeCheck(cxxMethodDecl->getReturnType()); + if (tc.Pointer().NonConst()) + return true; + if (tc.LvalueReference().NonConst()) + return true; + // a Get method that returns void is probably doing something that has side-effects + if (tc.Void()) + return true; StringRef name = cxxMethodDecl->getName(); - if (name == "PAGE") // otherwise we have two methods that only differ in their return type + if (!name.startswith("get") && !name.startswith("Get") + && !name.startswith("is") && !name.startswith("Is") + && !name.startswith("has") && !name.startswith("Has")) return true; - // stuff in comphelper I'm not sure about - if (name == "CommitImageSubStorage" || name == "CloseEmbeddedObjects" || name == "flush") + + // something lacking in my analysis here + if (loplugin::DeclCheck(cxxMethodDecl).Function("GetDescr").Class("SwRangeRedline").GlobalNamespace()) return true; interestingMethodSet.insert(cxxMethodDecl); @@ -180,7 +169,7 @@ bool ConstMethod::VisitCXXThisExpr( const CXXThisExpr* cxxThisExpr ) if (ignoreLocation(cxxThisExpr)) return true; // ignore stuff that forms part of the stable URE interface - if (isInUnoIncludeFile(cxxThisExpr->getLocStart())) + if (isInUnoIncludeFile(compat::getBeginLoc(cxxThisExpr))) return true; if (interestingMethodSet.find(currCXXMethodDecl) == interestingMethodSet.end()) return true; @@ -208,7 +197,7 @@ bool ConstMethod::checkIfCanBeConst(const Stmt* stmt, const CXXMethodDecl* cxxMe report( DiagnosticsEngine::Warning, "no parent?", - stmt->getLocStart()) + compat::getBeginLoc(stmt)) << stmt->getSourceRange(); return false; } @@ -447,7 +436,7 @@ bool ConstMethod::checkIfCanBeConst(const Stmt* stmt, const CXXMethodDecl* cxxMe return checkIfCanBeConst(parent, cxxMethodDecl); // } else if (isa<UnaryExprOrTypeTraitExpr>(parent)) { // return false; // ??? - } else if (auto cxxNewExpr = dyn_cast<CXXNewExpr>(parent)) { + } else if (isa<CXXNewExpr>(parent)) { // for (auto pa : cxxNewExpr->placement_arguments()) // if (pa == stmt) // return false; @@ -491,7 +480,7 @@ bool ConstMethod::checkIfCanBeConst(const Stmt* stmt, const CXXMethodDecl* cxxMe report( DiagnosticsEngine::Warning, "oh dear, what can the matter be?", - parent->getLocStart()) + compat::getBeginLoc(parent)) << parent->getSourceRange(); return false; } @@ -516,7 +505,7 @@ bool ConstMethod::isPointerOrReferenceToNonConst(const QualType& qt) { return false; } -loplugin::Plugin::Registration< ConstMethod > X("constmethod", true); +loplugin::Plugin::Registration< ConstMethod > X("constmethod", false); } diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx index 94c4f74bee61..388c813de18a 100644 --- a/compilerplugins/clang/constparams.cxx +++ b/compilerplugins/clang/constparams.cxx @@ -50,15 +50,10 @@ public: || loplugin::hasPathnamePrefix(fn, SRCDIR "/sfx2/source/doc/syspath.cxx") // ignore this for now || loplugin::hasPathnamePrefix(fn, SRCDIR "/libreofficekit") - // I end up with a - // CXXMemberCallExpr - // to a - // BuiltinType '<bound member function type>' - // and the AST gives me no further useful information. - || loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/core/doc/docfly.cxx") - || loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/core/doc/DocumentContentOperationsManager.cxx") - || loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/core/fields/cellfml.cxx") - || loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/filter/ww8/ww8par6.cxx") + // FunctionAddress not working well enough here + || loplugin::hasPathnamePrefix(fn, SRCDIR "/pyuno/source/module/pyuno_struct.cxx") + || loplugin::hasPathnamePrefix(fn, SRCDIR "/pyuno/source/module/pyuno.cxx") + || loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/filter/ascii/ascatr.cxx") ) return; @@ -201,6 +196,8 @@ bool ConstParams::CheckTraverseFunctionDecl(FunctionDecl * functionDecl) || name == "GlobalBasicErrorHdl_Impl" // template || name == "extract_throw" || name == "readProp" + // callbacks + || name == "signalDragDropReceived" || name == "signal_column_clicked" || name == "signal_key_press" ) return false; diff --git a/compilerplugins/clang/test/constmethod.cxx b/compilerplugins/clang/test/constmethod.cxx index e801db419aa7..e5efcae16619 100644 --- a/compilerplugins/clang/test/constmethod.cxx +++ b/compilerplugins/clang/test/constmethod.cxx @@ -17,30 +17,43 @@ struct Class1 struct Impl { void foo_notconst(); void foo_const() const; - int & foo_both(); - int const & foo_both() const; + int & foo_int_ref() const; + int const & foo_const_int_ref() const; + int * foo_int_ptr() const; + int const * foo_const_int_ptr() const; }; std::unique_ptr<Impl> pImpl; int* m_pint; VclPtr<OutputDevice> m_pvcl; - void foo1() { + void GetFoo1() { pImpl->foo_notconst(); } - void foo2() { // expected-error {{this method can be const [loplugin:constmethod]}} + void GetFoo2() { pImpl->foo_const(); } - // TODO this should trigger a warning, but doesn't - void foo3() { - pImpl->foo_both(); + int& GetFoo3() { + return pImpl->foo_int_ref(); } - Impl* foo4() { + int const & GetFoo3a() { // expected-error {{this method can be const [loplugin:constmethod]}} + return pImpl->foo_const_int_ref(); + } + int* GetFoo3b() { + return pImpl->foo_int_ptr(); + } + int const * GetFoo3c() { // expected-error {{this method can be const [loplugin:constmethod]}} + return pImpl->foo_const_int_ptr(); + } + Impl* GetFoo4() { return pImpl.get(); // no warning expected } - int* foo5() { + int* GetFoo5() { return m_pint; // no warning expected } - OutputDevice* foo6() { + int& GetFoo6() { + return *m_pint; // no warning expected + } + OutputDevice* GetFoo7() { return m_pvcl; // no warning expected } }; diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx index 0a3d11931638..3456783101b3 100644 --- a/cui/source/options/optcolor.cxx +++ b/cui/source/options/optcolor.cxx @@ -176,7 +176,7 @@ public: Link<weld::Widget&,void> const&); void Update(EditableColorConfig const*, EditableExtendedColorConfig const*); void ClickHdl(EditableColorConfig*, weld::ToggleButton&); - void ColorHdl(EditableColorConfig*, EditableExtendedColorConfig*, ColorListBox*); + void ColorHdl(EditableColorConfig*, EditableExtendedColorConfig*, const ColorListBox*); weld::Widget& GetWidget1() { @@ -226,8 +226,8 @@ private: void ColorChanged (ColorConfigValue&); void ColorChanged (ExtendedColorConfigValue&); public: - bool Is(weld::ToggleButton* pBox) const { return m_xText.get() == pBox; } - bool Is(ColorListBox* pBox) const { return m_xColorList.get() == pBox; } + bool Is(const weld::ToggleButton* pBox) const { return m_xText.get() == pBox; } + bool Is(const ColorListBox* pBox) const { return m_xColorList.get() == pBox; } private: // checkbox (CheckBox) or simple text (FixedText) std::unique_ptr<weld::Widget> m_xText; @@ -513,7 +513,7 @@ void ColorConfigWindow_Impl::ClickHdl(EditableColorConfig* pConfig, weld::Toggle // ColorHdl() void ColorConfigWindow_Impl::ColorHdl( EditableColorConfig* pConfig, EditableExtendedColorConfig* pExtConfig, - ColorListBox* pBox) + const ColorListBox* pBox) { unsigned i = 0; diff --git a/dbaccess/source/ui/control/RelationControl.cxx b/dbaccess/source/ui/control/RelationControl.cxx index 959aee714949..e83d66fa74cf 100644 --- a/dbaccess/source/ui/control/RelationControl.cxx +++ b/dbaccess/source/ui/control/RelationControl.cxx @@ -76,7 +76,7 @@ namespace dbaui */ sal_uInt16 getColumnIdent( sal_uInt16 _nColId ) const; public: - explicit ORelationControl(css::uno::Reference<css::awt::XWindow>& rParent); + explicit ORelationControl(const css::uno::Reference<css::awt::XWindow>& rParent); void SetController(OTableListBoxControl* pController) { m_pBoxControl = pController; @@ -126,7 +126,7 @@ namespace dbaui }; // class ORelationControl - ORelationControl::ORelationControl(css::uno::Reference<css::awt::XWindow>& rParent) + ORelationControl::ORelationControl(const css::uno::Reference<css::awt::XWindow>& rParent) : EditBrowseBox(VCLUnoHelper::GetWindow(rParent), EditBrowseBoxFlags::SMART_TAB_TRAVEL | EditBrowseBoxFlags::NO_HANDLE_COLUMN_CONTENT, WB_TABSTOP | WB_BORDER, diff --git a/dbaccess/source/ui/querydesign/querydlg.cxx b/dbaccess/source/ui/querydesign/querydlg.cxx index 55e3e49a49b6..abc203ce9c13 100644 --- a/dbaccess/source/ui/querydesign/querydlg.cxx +++ b/dbaccess/source/ui/querydesign/querydlg.cxx @@ -41,7 +41,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::container; using namespace ::com::sun::star::sdbc; -DlgQryJoin::DlgQryJoin(OQueryTableView* pParent, +DlgQryJoin::DlgQryJoin(const OQueryTableView* pParent, const TTableConnectionData::value_type& _pData, const OJoinTableView::OTableWindowMap* _pTableMap, const Reference< XConnection >& _xConnection, diff --git a/dbaccess/source/ui/querydesign/querydlg.hxx b/dbaccess/source/ui/querydesign/querydlg.hxx index 3304a50ed50b..4631d7fbe29f 100644 --- a/dbaccess/source/ui/querydesign/querydlg.hxx +++ b/dbaccess/source/ui/querydesign/querydlg.hxx @@ -54,7 +54,7 @@ namespace dbaui */ void setJoinType(EJoinType _eNewJoinType); public: - DlgQryJoin( OQueryTableView * pParent, + DlgQryJoin( const OQueryTableView * pParent, const TTableConnectionData::value_type& pData, const OJoinTableView::OTableWindowMap* _pTableMap, const css::uno::Reference< css::sdbc::XConnection >& _xConnection, diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 96d7c1561f27..bf3ac6349545 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -2508,7 +2508,7 @@ bool SvxAutoCorrectLanguageLists::MakeCombinedChanges( std::vector<SvxAutocorrWo } } - for (SvxAutocorrWord & aNewEntrie : aNewEntries) + for (const SvxAutocorrWord & aNewEntrie : aNewEntries) { SvxAutocorrWord aWordToAdd(aNewEntrie.GetShort(), aNewEntrie.GetLong(), true ); boost::optional<SvxAutocorrWord> xRemoved = pAutocorr_List->FindAndRemove( &aWordToAdd ); @@ -2692,7 +2692,7 @@ bool SvxAutocorrWordList::empty() const return mpImpl->maHash.empty() && mpImpl->maSortedVector.empty(); } -boost::optional<SvxAutocorrWord> SvxAutocorrWordList::FindAndRemove(SvxAutocorrWord *pWord) +boost::optional<SvxAutocorrWord> SvxAutocorrWordList::FindAndRemove(const SvxAutocorrWord *pWord) { if ( mpImpl->maSortedVector.empty() ) // use the hash diff --git a/include/basegfx/DrawCommands.hxx b/include/basegfx/DrawCommands.hxx index 1da33c325694..f72d17011c0b 100644 --- a/include/basegfx/DrawCommands.hxx +++ b/include/basegfx/DrawCommands.hxx @@ -45,7 +45,7 @@ public: { } - DrawCommandType getType() { return meType; } + DrawCommandType getType() const { return meType; } }; class DrawRoot : public DrawBase diff --git a/include/dbaccess/dataview.hxx b/include/dbaccess/dataview.hxx index 53d6b490acd9..a8da6376da91 100644 --- a/include/dbaccess/dataview.hxx +++ b/include/dbaccess/dataview.hxx @@ -74,7 +74,7 @@ namespace dbaui IController& getCommandController() const { return *m_xController.get(); } - const css::uno::Reference< css::uno::XComponentContext >& getORB() { return m_xContext;} + const css::uno::Reference< css::uno::XComponentContext >& getORB() const { return m_xContext;} // the default implementation simply calls resizeAll( GetSizePixel() ) virtual void Resize() override; diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx index e6477f28dac1..4106122ee94b 100644 --- a/include/editeng/svxacorr.hxx +++ b/include/editeng/svxacorr.hxx @@ -155,7 +155,7 @@ public: ~SvxAutocorrWordList(); void DeleteAndDestroyAll(); const SvxAutocorrWord* Insert(SvxAutocorrWord aWord) const; - boost::optional<SvxAutocorrWord> FindAndRemove(SvxAutocorrWord *pWord); + boost::optional<SvxAutocorrWord> FindAndRemove(const SvxAutocorrWord *pWord); void LoadEntry(const OUString& sWrong, const OUString& sRight, bool bOnlyTxt); bool empty() const; diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 97a37b8557b8..f2b35617c952 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -1363,7 +1363,7 @@ callback (gpointer pData) priv->m_aReferenceMarks.clear(); - for(auto& rMark : aTree.get_child("marks")) + for(const auto& rMark : aTree.get_child("marks")) { sal_uInt32 nColor = std::stoi(rMark.second.get<std::string>("color"), nullptr, 16); std::string sRect = rMark.second.get<std::string>("rectangle"); @@ -1849,7 +1849,7 @@ renderOverlay(LOKDocView* pDocView, cairo_t* pCairo) } // Draw reference marks. - for (auto& rPair : priv->m_aReferenceMarks) + for (const auto& rPair : priv->m_aReferenceMarks) { const ViewRectangle& rMark = rPair.first; if (rMark.m_nPart != priv->m_nPartId) diff --git a/lingucomponent/source/languageguessing/guess.hxx b/lingucomponent/source/languageguessing/guess.hxx index d85db86900f8..e68d852a53a6 100644 --- a/lingucomponent/source/languageguessing/guess.hxx +++ b/lingucomponent/source/languageguessing/guess.hxx @@ -43,8 +43,8 @@ class Guess final { */ Guess(const char * guess_str); - const string& GetLanguage() { return language_str;} - const string& GetCountry() { return country_str;} + const string& GetLanguage() const { return language_str;} + const string& GetCountry() const { return country_str;} private: string language_str; diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx index 0984acb86aae..f708c4911797 100644 --- a/sal/osl/unx/socket.cxx +++ b/sal/osl/unx/socket.cxx @@ -582,7 +582,7 @@ struct oslAddrInfo freeaddrinfo(pAddrInfoList); } - const char* getHostName() + const char* getHostName() const { assert(pAddrInfoList); return pAddrInfoList->ai_canonname; diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index f7d04468f46b..e7090c108bbd 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -425,7 +425,7 @@ handle_r1c1: } } -static ReferenceMark lcl_GetReferenceMark( ScViewData& rViewData, ScDocShell* pDocSh, +static ReferenceMark lcl_GetReferenceMark( const ScViewData& rViewData, ScDocShell* pDocSh, long nX1, long nX2, long nY1, long nY2, long nTab, const Color& rColor ) { diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk index b575074e184f..b76d3767149b 100644 --- a/solenv/CompilerTest_compilerplugins_clang.mk +++ b/solenv/CompilerTest_compilerplugins_clang.mk @@ -18,6 +18,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \ compilerplugins/clang/test/commaoperator \ $(if $(filter-out WNT,$(OS)),compilerplugins/clang/test/constfields) \ compilerplugins/clang/test/constparams \ + compilerplugins/clang/test/constmethod \ compilerplugins/clang/test/constvars \ compilerplugins/clang/test/convertlong \ compilerplugins/clang/test/cppunitassertequals \ diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index 9d0ac1972cd5..c89b6861b7d9 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -1668,6 +1668,7 @@ compilerplugins/clang/commaoperator.cxx compilerplugins/clang/comparisonwithconstant.cxx compilerplugins/clang/compat.hxx compilerplugins/clang/constantparam.cxx +compilerplugins/clang/constmethod.cxx compilerplugins/clang/constparams.cxx compilerplugins/clang/conststringvar.cxx compilerplugins/clang/countusersofdefaultparams.cxx @@ -1741,7 +1742,6 @@ compilerplugins/clang/store/cascadingcondop.cxx compilerplugins/clang/store/cascadingcondop.hxx compilerplugins/clang/store/changefunctioncalls.cxx compilerplugins/clang/store/constantfunction.cxx -compilerplugins/clang/store/constmethod.cxx compilerplugins/clang/store/deadclass.cxx compilerplugins/clang/store/defaultparams.cxx compilerplugins/clang/store/deletedspecial.cxx diff --git a/svgio/inc/svgvisitor.hxx b/svgio/inc/svgvisitor.hxx index 46adbfb22924..c3265d67b960 100644 --- a/svgio/inc/svgvisitor.hxx +++ b/svgio/inc/svgvisitor.hxx @@ -31,7 +31,7 @@ public: void visit(svgio::svgreader::SvgNode const& rNode) override; void goToChildren(svgio::svgreader::SvgNode const& rNode); - std::shared_ptr<gfx::DrawRoot> const& getDrawRoot() { return mpDrawRoot; } + std::shared_ptr<gfx::DrawRoot> const& getDrawRoot() const { return mpDrawRoot; } }; } } diff --git a/writerperfect/source/writer/exp/xmlimp.cxx b/writerperfect/source/writer/exp/xmlimp.cxx index 1f3960a2dae4..1ed88dffcf73 100644 --- a/writerperfect/source/writer/exp/xmlimp.cxx +++ b/writerperfect/source/writer/exp/xmlimp.cxx @@ -376,9 +376,12 @@ XMLImport::XMLImport(const uno::Reference<uno::XComponentContext>& xContext, mxUriReferenceFactory = uri::UriReferenceFactory::create(mxContext); } -const librevenge::RVNGPropertyListVector& XMLImport::GetCoverImages() { return maCoverImages; } +const librevenge::RVNGPropertyListVector& XMLImport::GetCoverImages() const +{ + return maCoverImages; +} -const librevenge::RVNGPropertyList& XMLImport::GetMetaData() { return maMetaData; } +const librevenge::RVNGPropertyList& XMLImport::GetMetaData() const { return maMetaData; } namespace { diff --git a/writerperfect/source/writer/exp/xmlimp.hxx b/writerperfect/source/writer/exp/xmlimp.hxx index fc6c473a048b..2797168f4609 100644 --- a/writerperfect/source/writer/exp/xmlimp.hxx +++ b/writerperfect/source/writer/exp/xmlimp.hxx @@ -128,8 +128,8 @@ public: std::map<OUString, librevenge::RVNGPropertyList>& GetGraphicStyles(); std::map<OUString, librevenge::RVNGPropertyList>& GetPageLayouts(); std::map<OUString, librevenge::RVNGPropertyList>& GetMasterStyles(); - const librevenge::RVNGPropertyListVector& GetCoverImages(); - const librevenge::RVNGPropertyList& GetMetaData(); + const librevenge::RVNGPropertyListVector& GetCoverImages() const; + const librevenge::RVNGPropertyList& GetMetaData() const; PopupState FillPopupData(const OUString& rURL, librevenge::RVNGPropertyList& rPropList); const std::vector<FixedLayoutPage>& GetPageMetafiles() const; const css::uno::Reference<css::uno::XComponentContext>& GetComponentContext() const; diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index cf5e5c0fa128..bf45b130a40e 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -166,7 +166,7 @@ Databases::~Databases() m_aKeywordInfo.clear(); } -OString Databases::getImageTheme() +OString Databases::getImageTheme() const { uno::Reference< lang::XMultiServiceFactory > xConfigProvider = configuration::theDefaultProvider::get(m_xContext); diff --git a/xmlhelp/source/cxxhelp/provider/databases.hxx b/xmlhelp/source/cxxhelp/provider/databases.hxx index ff1c6fd69271..3577b39d975f 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.hxx +++ b/xmlhelp/source/cxxhelp/provider/databases.hxx @@ -141,7 +141,7 @@ namespace chelp { ~Databases(); - OString getImageTheme(); + OString getImageTheme() const; OUString getInstallPathAsURL(); diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.hxx b/xmlhelp/source/cxxhelp/provider/urlparameter.hxx index 7adc4c1aa4e9..a4c33513d5ff 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.hxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.hxx @@ -40,7 +40,7 @@ namespace chelp { { } - OUString getHash() + OUString getHash() const { if( m_ptr ) { @@ -54,7 +54,7 @@ namespace chelp { } - OUString getFile() + OUString getFile() const { if( ! m_ptr ) return OUString(); @@ -69,7 +69,7 @@ namespace chelp { } - OUString getDatabase() + OUString getDatabase() const { if( ! m_ptr ) return OUString(); @@ -79,7 +79,7 @@ namespace chelp { } - OUString getTitle() + OUString getTitle() const { if( ! m_ptr ) return OUString(); |