diff options
author | Noel Grandin <noel@peralex.com> | 2021-06-15 21:12:25 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-06-17 14:32:11 +0200 |
commit | 0771ac00acc8730f77db76b901724f1513a32723 (patch) | |
tree | 8af934c3f11e452bc8ef8941fd284cdc9cdbab5c | |
parent | 0d97abc8ef890b2e2ead34c449f2a140e22dd5ee (diff) |
use string_view in the Translate API
Change-Id: I0bb0ea9d39ed623928060ffd3f2e2bc36ba33209
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117272
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
67 files changed, 143 insertions, 120 deletions
diff --git a/accessibility/inc/helper/accresmgr.hxx b/accessibility/inc/helper/accresmgr.hxx index 5b16c47e8166..c0926f190ac1 100644 --- a/accessibility/inc/helper/accresmgr.hxx +++ b/accessibility/inc/helper/accresmgr.hxx @@ -20,7 +20,8 @@ #pragma once #include <rtl/ustring.hxx> +#include <string_view> -OUString AccResId(const char* pId); +OUString AccResId(std::string_view aId); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/helper/accresmgr.cxx b/accessibility/source/helper/accresmgr.cxx index 57f886587bd3..b335f8ac185b 100644 --- a/accessibility/source/helper/accresmgr.cxx +++ b/accessibility/source/helper/accresmgr.cxx @@ -20,6 +20,6 @@ #include <helper/accresmgr.hxx> #include <unotools/resmgr.hxx> -OUString AccResId(const char* pId) { return Translate::get(pId, Translate::Create("acc")); } +OUString AccResId(std::string_view aId) { return Translate::get(aId, Translate::Create("acc")); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/inc/mediamisc.hxx b/avmedia/source/inc/mediamisc.hxx index 79c46ab404c4..014a73c6c56f 100644 --- a/avmedia/source/inc/mediamisc.hxx +++ b/avmedia/source/inc/mediamisc.hxx @@ -35,9 +35,9 @@ // Mime types #define AVMEDIA_MIMETYPE_COMMON "application/vnd.sun.star.media" -inline OUString AvmResId(const char* pId) +inline OUString AvmResId(std::string_view aId) { - return Translate::get(pId, Translate::Create("avmedia")); + return Translate::get(aId, Translate::Create("avmedia")); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/iderdll.cxx b/basctl/source/basicide/iderdll.cxx index cdcfdf24c1a8..a6f3abd68edb 100644 --- a/basctl/source/basicide/iderdll.cxx +++ b/basctl/source/basicide/iderdll.cxx @@ -105,9 +105,9 @@ ExtraData* GetExtraData() return nullptr; } -OUString IDEResId(const char *pId) +OUString IDEResId(std::string_view aId) { - return Translate::get(pId, SfxApplication::GetModule(SfxToolsModule::Basic)->GetResLocale()); + return Translate::get(aId, SfxApplication::GetModule(SfxToolsModule::Basic)->GetResLocale()); } namespace diff --git a/basctl/source/inc/iderid.hxx b/basctl/source/inc/iderid.hxx index 5d18586079e5..254d481ad614 100644 --- a/basctl/source/inc/iderid.hxx +++ b/basctl/source/inc/iderid.hxx @@ -20,10 +20,11 @@ #pragma once #include <rtl/ustring.hxx> +#include <string_view> namespace basctl { -OUString IDEResId(const char* pId); +OUString IDEResId(std::string_view aId); } // namespace basctl diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index 0a7be60432a7..45375173209b 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -591,9 +591,9 @@ std::locale BasResLocale() return Translate::Create("sb"); } -OUString BasResId(const char *pId) +OUString BasResId(std::string_view aId) { - return Translate::get(pId, BasResLocale()); + return Translate::get(aId, BasResLocale()); } namespace diff --git a/chart2/source/inc/ResId.hxx b/chart2/source/inc/ResId.hxx index bb057866118f..91dc561e2cb9 100644 --- a/chart2/source/inc/ResId.hxx +++ b/chart2/source/inc/ResId.hxx @@ -20,10 +20,11 @@ #include <rtl/ustring.hxx> #include "charttoolsdllapi.hxx" +#include <string_view> namespace chart { -OUString OOO_DLLPUBLIC_CHARTTOOLS SchResId(const char* pId); +OUString OOO_DLLPUBLIC_CHARTTOOLS SchResId(std::string_view aId); } // namespace chart diff --git a/chart2/source/tools/ResId.cxx b/chart2/source/tools/ResId.cxx index 850eb9b84dd7..7a19075a57b3 100644 --- a/chart2/source/tools/ResId.cxx +++ b/chart2/source/tools/ResId.cxx @@ -22,9 +22,9 @@ namespace chart { - OUString SchResId(const char *pId) + OUString SchResId(std::string_view aId) { - return Translate::get(pId, Translate::Create("chart")); + return Translate::get(aId, Translate::Create("chart")); } } // namespace chart diff --git a/cui/source/factory/cuiresmgr.cxx b/cui/source/factory/cuiresmgr.cxx index ae22515bd261..fc6f0d5fd24d 100644 --- a/cui/source/factory/cuiresmgr.cxx +++ b/cui/source/factory/cuiresmgr.cxx @@ -20,6 +20,6 @@ #include <dialmgr.hxx> #include <unotools/resmgr.hxx> -OUString CuiResId(const char* pKey) { return Translate::get(pKey, Translate::Create("cui")); } +OUString CuiResId(std::string_view aKey) { return Translate::get(aKey, Translate::Create("cui")); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/dialmgr.hxx b/cui/source/inc/dialmgr.hxx index c31fde3a27a3..003941790603 100644 --- a/cui/source/inc/dialmgr.hxx +++ b/cui/source/inc/dialmgr.hxx @@ -21,6 +21,6 @@ #include <rtl/ustring.hxx> -OUString CuiResId(const char* pKey); +OUString CuiResId(std::string_view aKey); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/inc/dp_shared.hxx b/desktop/inc/dp_shared.hxx index 121bfd430fb5..0db47190c48c 100644 --- a/desktop/inc/dp_shared.hxx +++ b/desktop/inc/dp_shared.hxx @@ -33,9 +33,9 @@ struct DeploymentLocale : } // namespace dp -inline OUString DpResId(const char* pId) +inline OUString DpResId(std::string_view aId) { - return Translate::get(pId, dp::DeploymentLocale::get()); + return Translate::get(aId, dp::DeploymentLocale::get()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx index bc3bb4c82b35..8141c6481f86 100644 --- a/editeng/source/editeng/eerdll.cxx +++ b/editeng/source/editeng/eerdll.cxx @@ -188,9 +188,9 @@ uno::Reference< linguistic2::XLanguageGuessing > const & GlobalEditData::GetLang return xLanguageGuesser; } -OUString EditResId(const char *pId) +OUString EditResId(std::string_view aId) { - return Translate::get(pId, Translate::Create("editeng")); + return Translate::get(aId, Translate::Create("editeng")); } EditDLL::EditDLL() diff --git a/extensions/source/bibliography/bibmod.cxx b/extensions/source/bibliography/bibmod.cxx index c355e836a02b..5f32aef3a366 100644 --- a/extensions/source/bibliography/bibmod.cxx +++ b/extensions/source/bibliography/bibmod.cxx @@ -54,9 +54,9 @@ void CloseBibModul(HdlBibModul ppBibModul) } } -OUString BibResId(const char* pId) +OUString BibResId(std::string_view aId) { - return Translate::get(pId, pBibModul->GetResLocale()); + return Translate::get(aId, pBibModul->GetResLocale()); } BibConfig* BibModul::pBibConfig = nullptr; diff --git a/extensions/source/bibliography/bibresid.hxx b/extensions/source/bibliography/bibresid.hxx index 354b5233e599..7de3d0c46bfb 100644 --- a/extensions/source/bibliography/bibresid.hxx +++ b/extensions/source/bibliography/bibresid.hxx @@ -20,7 +20,8 @@ #pragma once #include <rtl/ustring.hxx> +#include <string_view> -OUString BibResId(const char* pId); +OUString BibResId(std::string_view aId); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/modulepcr.cxx b/extensions/source/propctrlr/modulepcr.cxx index 74d4b5daff7c..67a6e198b27e 100644 --- a/extensions/source/propctrlr/modulepcr.cxx +++ b/extensions/source/propctrlr/modulepcr.cxx @@ -23,7 +23,7 @@ namespace pcr { -OUString PcrRes(const char* pId) { return Translate::get(pId, Translate::Create("pcr")); } +OUString PcrRes(std::string_view aId) { return Translate::get(aId, Translate::Create("pcr")); } } // namespace pcr diff --git a/extensions/source/propctrlr/modulepcr.hxx b/extensions/source/propctrlr/modulepcr.hxx index edfef48d8e29..c8eed78eef32 100644 --- a/extensions/source/propctrlr/modulepcr.hxx +++ b/extensions/source/propctrlr/modulepcr.hxx @@ -20,10 +20,11 @@ #pragma once #include <rtl/ustring.hxx> +#include <string_view> namespace pcr { -OUString PcrRes(const char* pId); +OUString PcrRes(std::string_view pId); } // namespace pcr /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx index 7dc78017ced8..d13ebcc53da9 100644 --- a/extensions/source/scanner/sanedlg.cxx +++ b/extensions/source/scanner/sanedlg.cxx @@ -273,9 +273,9 @@ SaneDlg::~SaneDlg() namespace { -OUString SaneResId(const char *pID) +OUString SaneResId(std::string_view aID) { - return Translate::get(pID, Translate::Create("pcr")); + return Translate::get(aID, Translate::Create("pcr")); } } diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index 7162cd2de2b2..a1a8978e04ff 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -42,9 +42,9 @@ #include <com/sun/star/beans/XMaterialHolder.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -static OUString PDFFilterResId(const char* pId) +static OUString PDFFilterResId(std::string_view aId) { - return Translate::get(pId, Translate::Create("flt")); + return Translate::get(aId, Translate::Create("flt")); } using namespace ::com::sun::star; diff --git a/filter/source/xsltdialog/xmlfiltercommon.hxx b/filter/source/xsltdialog/xmlfiltercommon.hxx index 9a65974f2606..c8b8ea7bfa67 100644 --- a/filter/source/xsltdialog/xmlfiltercommon.hxx +++ b/filter/source/xsltdialog/xmlfiltercommon.hxx @@ -77,6 +77,6 @@ struct application_info_impl extern std::vector< application_info_impl > const & getApplicationInfos(); extern OUString getApplicationUIName( std::u16string_view rServiceName ); extern const application_info_impl* getApplicationInfo( std::u16string_view rServiceName ); -OUString XsltResId(const char* pId); +OUString XsltResId(std::string_view pId); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index c06a9ec1b5cc..aa1280368756 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -58,9 +58,9 @@ using namespace com::sun::star::util; using ::rtl::Uri; -OUString XsltResId(const char* pId) +OUString XsltResId(std::string_view aId) { - return Translate::get(pId, Translate::Create("flt")); + return Translate::get(aId, Translate::Create("flt")); } XMLFilterSettingsDialog::XMLFilterSettingsDialog(weld::Window* pParent, diff --git a/forms/source/inc/frm_resource.hxx b/forms/source/inc/frm_resource.hxx index f56c6e3cfd76..5766af787f2c 100644 --- a/forms/source/inc/frm_resource.hxx +++ b/forms/source/inc/frm_resource.hxx @@ -20,6 +20,7 @@ #pragma once #include <rtl/ustring.hxx> +#include <string_view> namespace frm { @@ -31,7 +32,7 @@ namespace frm { /** loads the string with the specified resource id from the FormLayer mo file */ - OUString loadString(const char* pResId); + OUString loadString(std::string_view aResId); }; } diff --git a/forms/source/resource/frm_resource.cxx b/forms/source/resource/frm_resource.cxx index 362c41974192..00c6bd5c5b22 100644 --- a/forms/source/resource/frm_resource.cxx +++ b/forms/source/resource/frm_resource.cxx @@ -22,9 +22,9 @@ namespace frm::ResourceManager { - OUString loadString(const char* pResId) + OUString loadString(std::string_view aResId) { - return Translate::get(pResId, Translate::Create("frm")); + return Translate::get(aResId, Translate::Create("frm")); } } diff --git a/formula/inc/core_resource.hxx b/formula/inc/core_resource.hxx index a1533f1b5186..f8943f603999 100644 --- a/formula/inc/core_resource.hxx +++ b/formula/inc/core_resource.hxx @@ -21,7 +21,8 @@ #include <rtl/ustring.hxx> #include <formula/formuladllapi.h> +#include <string_view> -FORMULA_DLLPUBLIC OUString ForResId(const char* pId); +FORMULA_DLLPUBLIC OUString ForResId(std::string_view aId); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/formula/source/core/resource/core_resource.cxx b/formula/source/core/resource/core_resource.cxx index b9e1347f0b5a..6a0943aba18f 100644 --- a/formula/source/core/resource/core_resource.cxx +++ b/formula/source/core/resource/core_resource.cxx @@ -19,6 +19,6 @@ #include <unotools/resmgr.hxx> #include <core_resource.hxx> -OUString ForResId(const char* pId) { return Translate::get(pId, Translate::Create("for")); } +OUString ForResId(std::string_view aId) { return Translate::get(aId, Translate::Create("for")); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/inc/fpsofficeResMgr.hxx b/fpicker/inc/fpsofficeResMgr.hxx index 13721bb9635a..3393f8afa95a 100644 --- a/fpicker/inc/fpsofficeResMgr.hxx +++ b/fpicker/inc/fpsofficeResMgr.hxx @@ -10,6 +10,9 @@ #include <unotools/resmgr.hxx> -inline OUString FpsResId(const char* pId) { return Translate::get(pId, Translate::Create("fps")); }; +inline OUString FpsResId(std::string_view aId) +{ + return Translate::get(aId, Translate::Create("fps")); +}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/classes/fwkresid.hxx b/framework/inc/classes/fwkresid.hxx index e1a2b9a36b1d..4aacac961019 100644 --- a/framework/inc/classes/fwkresid.hxx +++ b/framework/inc/classes/fwkresid.hxx @@ -20,7 +20,8 @@ #pragma once #include <rtl/ustring.hxx> +#include <string_view> -OUString FwkResId(const char* pId); +OUString FwkResId(std::string_view aId); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/fwe/classes/fwkresid.cxx b/framework/source/fwe/classes/fwkresid.cxx index 00bc8232370f..9acac0728885 100644 --- a/framework/source/fwe/classes/fwkresid.cxx +++ b/framework/source/fwe/classes/fwkresid.cxx @@ -20,6 +20,6 @@ #include <classes/fwkresid.hxx> #include <unotools/resmgr.hxx> -OUString FwkResId(const char* pId) { return Translate::get(pId, Translate::Create("fwk")); } +OUString FwkResId(std::string_view aId) { return Translate::get(aId, Translate::Create("fwk")); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basic/sbdef.hxx b/include/basic/sbdef.hxx index 275eacf2a131..e84a14d5d51d 100644 --- a/include/basic/sbdef.hxx +++ b/include/basic/sbdef.hxx @@ -71,7 +71,7 @@ enum class PropertyMode BASIC_DLLPUBLIC extern std::pair<const char*, ErrCode> const RID_BASIC_START[]; BASIC_DLLPUBLIC std::locale BasResLocale(); -OUString BasResId(const char* pId); +OUString BasResId(std::string_view pId); #endif diff --git a/include/editeng/eerdll.hxx b/include/editeng/eerdll.hxx index d57ad101fcfd..a3b215f44395 100644 --- a/include/editeng/eerdll.hxx +++ b/include/editeng/eerdll.hxx @@ -30,7 +30,7 @@ namespace editeng class SharedVclResources; } -OUString EDITENG_DLLPUBLIC EditResId(const char* pId); +OUString EDITENG_DLLPUBLIC EditResId(std::string_view aId); class EditDLL { diff --git a/include/sfx2/sfxresid.hxx b/include/sfx2/sfxresid.hxx index 922c59941738..62bbc99e92bc 100644 --- a/include/sfx2/sfxresid.hxx +++ b/include/sfx2/sfxresid.hxx @@ -21,8 +21,9 @@ #include <sfx2/dllapi.h> #include <rtl/ustring.hxx> +#include <string_view> -SFX2_DLLPUBLIC OUString SfxResId(const char* pId); +SFX2_DLLPUBLIC OUString SfxResId(std::string_view aId); #endif diff --git a/include/svl/svlresid.hxx b/include/svl/svlresid.hxx index 4b568bb12b39..5e6f271ea7a1 100644 --- a/include/svl/svlresid.hxx +++ b/include/svl/svlresid.hxx @@ -12,8 +12,9 @@ #include <svl/svldllapi.h> #include <rtl/ustring.hxx> +#include <string_view> -SVL_DLLPUBLIC OUString SvlResId(const char* pId); +SVL_DLLPUBLIC OUString SvlResId(std::string_view aId); #endif // INCLUDED_SVL_SVTRESID_HXX diff --git a/include/svtools/svtresid.hxx b/include/svtools/svtresid.hxx index d89790c854d6..cf2fa976293b 100644 --- a/include/svtools/svtresid.hxx +++ b/include/svtools/svtresid.hxx @@ -24,6 +24,6 @@ #include <locale> SVT_DLLPUBLIC std::locale SvtResLocale(); -SVT_DLLPUBLIC OUString SvtResId(const char* pId); +SVT_DLLPUBLIC OUString SvtResId(std::string_view aId); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/dialmgr.hxx b/include/svx/dialmgr.hxx index 6dc6dcaa436d..ea31de153123 100644 --- a/include/svx/dialmgr.hxx +++ b/include/svx/dialmgr.hxx @@ -23,7 +23,7 @@ #include <svx/svxdllapi.h> SVXCORE_DLLPUBLIC std::locale SvxResLocale(); -SVXCORE_DLLPUBLIC OUString SvxResId(const char* pId); +SVXCORE_DLLPUBLIC OUString SvxResId(std::string_view aId); #endif diff --git a/include/unotools/resmgr.hxx b/include/unotools/resmgr.hxx index d1c64e399ffe..4fce82b82294 100644 --- a/include/unotools/resmgr.hxx +++ b/include/unotools/resmgr.hxx @@ -22,6 +22,7 @@ #include <unotools/unotoolsdllapi.h> #include <unotools/syslocale.hxx> #include <rtl/ustring.hxx> +#include <string_view> class LanguageTag; @@ -29,9 +30,9 @@ typedef OUString (*ResHookProc)(const OUString& rStr); namespace Translate { - UNOTOOLS_DLLPUBLIC std::locale Create(const char* pPrefixName, const LanguageTag& rLocale = SvtSysLocale().GetUILanguageTag()); - UNOTOOLS_DLLPUBLIC OUString get(const char* pId, const std::locale &loc); - UNOTOOLS_DLLPUBLIC OUString nget(const char* pId, int n, const std::locale &loc); + UNOTOOLS_DLLPUBLIC std::locale Create(std::string_view aPrefixName, const LanguageTag& rLocale = SvtSysLocale().GetUILanguageTag()); + UNOTOOLS_DLLPUBLIC OUString get(std::string_view aId, const std::locale &loc); + UNOTOOLS_DLLPUBLIC OUString nget(std::string_view aId, int n, const std::locale &loc); UNOTOOLS_DLLPUBLIC void SetReadStringHook( ResHookProc pProc ); UNOTOOLS_DLLPUBLIC ResHookProc GetReadStringHook(); UNOTOOLS_DLLPUBLIC OUString ExpandVariables(const OUString& rString); diff --git a/oox/inc/ooxresid.hxx b/oox/inc/ooxresid.hxx index 6af3b7f83237..d8015dc120ac 100644 --- a/oox/inc/ooxresid.hxx +++ b/oox/inc/ooxresid.hxx @@ -11,8 +11,9 @@ #define INCLUDED_OOX_INC_RESID_HXX #include <rtl/ustring.hxx> +#include <string_view> -OUString OoxResId(const char* pId); +OUString OoxResId(std::string_view aId); #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/oox/source/helper/ooxresid.cxx b/oox/source/helper/ooxresid.cxx index 7d125505203c..6a509ccbca7b 100644 --- a/oox/source/helper/ooxresid.cxx +++ b/oox/source/helper/ooxresid.cxx @@ -11,6 +11,6 @@ #include <ooxresid.hxx> #include <unotools/resmgr.hxx> -OUString OoxResId(const char* pId) { return Translate::get(pId, Translate::Create("oox")); } +OUString OoxResId(std::string_view aId) { return Translate::get(aId, Translate::Create("oox")); } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
\ No newline at end of file diff --git a/reportdesign/inc/core_resource.hxx b/reportdesign/inc/core_resource.hxx index 5d6643b83276..f5d6bfb6e1a7 100644 --- a/reportdesign/inc/core_resource.hxx +++ b/reportdesign/inc/core_resource.hxx @@ -22,8 +22,9 @@ #include "dllapi.h" #include <rtl/ustring.hxx> +#include <string_view> -OUString REPORTDESIGN_DLLPUBLIC RptResId(const char* pId); +OUString REPORTDESIGN_DLLPUBLIC RptResId(std::string_view pId); #endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_CORE_RESOURCE_HXX diff --git a/reportdesign/source/core/resource/core_resource.cxx b/reportdesign/source/core/resource/core_resource.cxx index d809249c9b78..a81ab5e34fae 100644 --- a/reportdesign/source/core/resource/core_resource.cxx +++ b/reportdesign/source/core/resource/core_resource.cxx @@ -19,6 +19,6 @@ #include <core_resource.hxx> #include <unotools/resmgr.hxx> -OUString RptResId(const char* pId) { return Translate::get(pId, Translate::Create("rpt")); } +OUString RptResId(std::string_view aId) { return Translate::get(aId, Translate::Create("rpt")); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/scresid.hxx b/sc/inc/scresid.hxx index 0be9da0ff5b6..017c7a91c5c8 100644 --- a/sc/inc/scresid.hxx +++ b/sc/inc/scresid.hxx @@ -22,7 +22,7 @@ #include <rtl/ustring.hxx> #include "scdllapi.h" -OUString SC_DLLPUBLIC ScResId(const char* pId); -OUString ScResId(const char* pId, int nCardinality); +OUString SC_DLLPUBLIC ScResId(std::string_view aId); +OUString ScResId(std::string_view aId, int nCardinality); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index 548ae028853a..2dbebc32f675 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -86,14 +86,14 @@ #include <filter.hxx> #include <scabstdlg.hxx> -OUString ScResId(const char* pId) +OUString ScResId(std::string_view aId) { - return Translate::get(pId, SC_MOD()->GetResLocale()); + return Translate::get(aId, SC_MOD()->GetResLocale()); } -OUString ScResId(const char* pId, int nCardinality) +OUString ScResId(std::string_view aId, int nCardinality) { - return Translate::nget(pId, nCardinality, SC_MOD()->GetResLocale()); + return Translate::nget(aId, nCardinality, SC_MOD()->GetResLocale()); } void ScDLL::Init() diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx index b89fb2137d44..0e92095bb6b1 100644 --- a/scaddins/source/analysis/analysis.cxx +++ b/scaddins/source/analysis/analysis.cxx @@ -1045,9 +1045,9 @@ double SAL_CALL AnalysisAddIn::getConvert( double f, const OUString& aFU, const RETURN_FINITE( fRet ); } -OUString AnalysisAddIn::AnalysisResId(const char* pResId) +OUString AnalysisAddIn::AnalysisResId(std::string_view aResId) { - return Translate::get(pResId, aResLocale); + return Translate::get(aResId, aResLocale); } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* diff --git a/scaddins/source/analysis/analysis.hxx b/scaddins/source/analysis/analysis.hxx index bb72c18fc9e8..5a0d31f1b5a2 100644 --- a/scaddins/source/analysis/analysis.hxx +++ b/scaddins/source/analysis/analysis.hxx @@ -73,7 +73,7 @@ public: explicit AnalysisAddIn( const css::uno::Reference< css::uno::XComponentContext >& xContext ); - OUString AnalysisResId(const char* pId); + OUString AnalysisResId(std::string_view aId); virtual ~AnalysisAddIn() override; diff --git a/scaddins/source/datefunc/datefunc.cxx b/scaddins/source/datefunc/datefunc.cxx index 1828679e365e..ba5f4f989627 100644 --- a/scaddins/source/datefunc/datefunc.cxx +++ b/scaddins/source/datefunc/datefunc.cxx @@ -717,9 +717,9 @@ OUString SAL_CALL ScaDateAddIn::getRot13( const OUString& aSrcString ) return aBuffer.makeStringAndClear(); } -OUString ScaDateAddIn::ScaResId(const char* pId) +OUString ScaDateAddIn::ScaResId(std::string_view aId) { - return Translate::get(pId, aResLocale); + return Translate::get(aId, aResLocale); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scaddins/source/datefunc/datefunc.hxx b/scaddins/source/datefunc/datefunc.hxx index e58f779370e2..74113e814ffe 100644 --- a/scaddins/source/datefunc/datefunc.hxx +++ b/scaddins/source/datefunc/datefunc.hxx @@ -120,7 +120,7 @@ private: public: ScaDateAddIn(); - OUString ScaResId(const char* pId); + OUString ScaResId(std::string_view aId); // XAddIn virtual OUString SAL_CALL getProgrammaticFuntionName( const OUString& aDisplayName ) override; diff --git a/scaddins/source/pricing/pricing.cxx b/scaddins/source/pricing/pricing.cxx index b006ae3f9a04..64b01938d0be 100644 --- a/scaddins/source/pricing/pricing.cxx +++ b/scaddins/source/pricing/pricing.cxx @@ -500,9 +500,9 @@ double SAL_CALL ScaPricingAddIn::getOptProbInMoney( double spot, double vol, RETURN_FINITE( fRet ); } -OUString ScaPricingAddIn::ScaResId(const char* pResId) +OUString ScaPricingAddIn::ScaResId(std::string_view aResId) { - return Translate::get(pResId, aResLocale); + return Translate::get(aResId, aResLocale); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scaddins/source/pricing/pricing.hxx b/scaddins/source/pricing/pricing.hxx index 0f613ddbe3ee..42f23dcc81a6 100644 --- a/scaddins/source/pricing/pricing.hxx +++ b/scaddins/source/pricing/pricing.hxx @@ -140,7 +140,7 @@ public: ScaPricingAddIn(); virtual ~ScaPricingAddIn() override; - OUString ScaResId(const char* pResId); + OUString ScaResId(std::string_view aResId); // XAddIn virtual OUString SAL_CALL getProgrammaticFuntionName( const OUString& aDisplayName ) override; diff --git a/sccomp/source/solver/SolverComponent.cxx b/sccomp/source/solver/SolverComponent.cxx index 3df7bf5d5887..3f01c529a2cd 100644 --- a/sccomp/source/solver/SolverComponent.cxx +++ b/sccomp/source/solver/SolverComponent.cxx @@ -41,9 +41,9 @@ using namespace com::sun::star; // Resources from tools are used for translated strings -OUString SolverComponent::GetResourceString(const char* pId) +OUString SolverComponent::GetResourceString(std::string_view aId) { - return Translate::get(pId, Translate::Create("scc")); + return Translate::get(aId, Translate::Create("scc")); } size_t ScSolverCellHash::operator()( const css::table::CellAddress& rAddress ) const diff --git a/sccomp/source/solver/SolverComponent.hxx b/sccomp/source/solver/SolverComponent.hxx index 1abe8f494a16..0c3869bdd4b4 100644 --- a/sccomp/source/solver/SolverComponent.hxx +++ b/sccomp/source/solver/SolverComponent.hxx @@ -82,7 +82,7 @@ protected: css::uno::Sequence< double > maSolution; OUString maStatus; - static OUString GetResourceString(const char* pId); + static OUString GetResourceString(std::string_view aId); static css::uno::Reference<css::table::XCell> GetCell( const css::uno::Reference<css::sheet::XSpreadsheetDocument>& xDoc, const css::table::CellAddress& rPos ); diff --git a/sccomp/source/solver/SwarmSolver.cxx b/sccomp/source/solver/SwarmSolver.cxx index a55f410b4f10..515beaed0d51 100644 --- a/sccomp/source/solver/SwarmSolver.cxx +++ b/sccomp/source/solver/SwarmSolver.cxx @@ -130,7 +130,7 @@ private: std::vector<sheet::SolverConstraint> maNonBoundedConstraints; private: - static OUString getResourceString(const char* pId); + static OUString getResourceString(std::string_view aId); uno::Reference<table::XCell> getCell(const table::CellAddress& rPosition); void setValue(const table::CellAddress& rPosition, double fValue); @@ -283,12 +283,12 @@ public: }; } -OUString SwarmSolver::getResourceString(const char* pId) +OUString SwarmSolver::getResourceString(std::string_view aId) { - if (!pId) + if (aId.empty()) return OUString(); - return Translate::get(pId, Translate::Create("scc")); + return Translate::get(aId, Translate::Create("scc")); } uno::Reference<table::XCell> SwarmSolver::getCell(const table::CellAddress& rPosition) diff --git a/sd/inc/sdresid.hxx b/sd/inc/sdresid.hxx index 8c4e80b90e03..768b9a14998d 100644 --- a/sd/inc/sdresid.hxx +++ b/sd/inc/sdresid.hxx @@ -22,7 +22,7 @@ #include <rtl/ustring.hxx> #include "sddllapi.h" -SD_DLLPUBLIC OUString SdResId(const char* pId); -SD_DLLPUBLIC OUString SdResId(const char* pId, int nCardinality); +SD_DLLPUBLIC OUString SdResId(std::string_view aId); +SD_DLLPUBLIC OUString SdResId(std::string_view aId, int nCardinality); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx index 739484e39239..4d99ce7aacf3 100644 --- a/sd/source/ui/app/sdmod.cxx +++ b/sd/source/ui/app/sdmod.cxx @@ -80,14 +80,14 @@ SdModule::SdModule(SfxObjectFactory* pFact1, SfxObjectFactory* pFact2 ) mpVirtualRefDevice->SetReferenceDevice ( VirtualDevice::RefDevMode::Dpi600 ); } -OUString SdResId(const char* pId) +OUString SdResId(std::string_view aId) { - return Translate::get(pId, SD_MOD()->GetResLocale()); + return Translate::get(aId, SD_MOD()->GetResLocale()); } -OUString SdResId(const char* pId, int nCardinality) +OUString SdResId(std::string_view aId, int nCardinality) { - return Translate::nget(pId, nCardinality, SD_MOD()->GetResLocale()); + return Translate::nget(aId, nCardinality, SD_MOD()->GetResLocale()); } // Dtor diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index 0825c2430754..787079b09662 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -98,7 +98,7 @@ SfxModule::~SfxModule() std::locale SfxModule::GetResLocale() const { - return Translate::Create(pImpl->maResName.getStr()); + return Translate::Create(pImpl->maResName); } SfxSlotPool* SfxModule::GetSlotPool() const diff --git a/sfx2/source/bastyp/sfxresid.cxx b/sfx2/source/bastyp/sfxresid.cxx index 74eb3f4aa0fd..2c60a31fe6e8 100644 --- a/sfx2/source/bastyp/sfxresid.cxx +++ b/sfx2/source/bastyp/sfxresid.cxx @@ -20,6 +20,6 @@ #include <sfx2/sfxresid.hxx> #include <unotools/resmgr.hxx> -OUString SfxResId(const char* pId) { return Translate::get(pId, Translate::Create("sfx")); } +OUString SfxResId(std::string_view aId) { return Translate::get(aId, Translate::Create("sfx")); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/inc/smmod.hxx b/starmath/inc/smmod.hxx index bb783e7ad2e0..b1eabcbc39fb 100644 --- a/starmath/inc/smmod.hxx +++ b/starmath/inc/smmod.hxx @@ -46,7 +46,7 @@ class SvtSysLocale; class VirtualDevice; -OUString SmResId(const char* pId); +OUString SmResId(std::string_view aId); class SmLocalizedSymbolData { diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx index e3b6c041903e..d4f197406bcc 100644 --- a/starmath/source/smmod.cxx +++ b/starmath/source/smmod.cxx @@ -39,9 +39,9 @@ #define ShellClass_SmModule #include <smslots.hxx> -OUString SmResId(const char* pId) +OUString SmResId(std::string_view aId) { - return Translate::get(pId, SM_MOD()->GetResLocale()); + return Translate::get(aId, SM_MOD()->GetResLocale()); } OUString SmLocalizedSymbolData::GetUiSymbolName( const OUString &rExportName ) diff --git a/svl/source/misc/getstringresource.cxx b/svl/source/misc/getstringresource.cxx index 766b6d96fcdd..241600895d10 100644 --- a/svl/source/misc/getstringresource.cxx +++ b/svl/source/misc/getstringresource.cxx @@ -23,6 +23,6 @@ #include <svl/svlresid.hxx> #include <unotools/resmgr.hxx> -OUString SvlResId(const char* id) { return Translate::get(id, Translate::Create("svl")); } +OUString SvlResId(std::string_view id) { return Translate::get(id, Translate::Create("svl")); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/svtresid.cxx b/svtools/source/misc/svtresid.cxx index 5271d218f5f4..e6dd8d45677f 100644 --- a/svtools/source/misc/svtresid.cxx +++ b/svtools/source/misc/svtresid.cxx @@ -22,6 +22,6 @@ std::locale SvtResLocale() { return Translate::Create("svt"); } -OUString SvtResId(const char* pId) { return Translate::get(pId, SvtResLocale()); } +OUString SvtResId(std::string_view aId) { return Translate::get(aId, SvtResLocale()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/dialmgr.cxx b/svx/source/dialog/dialmgr.cxx index 4e4389bd8463..1281324eaad9 100644 --- a/svx/source/dialog/dialmgr.cxx +++ b/svx/source/dialog/dialmgr.cxx @@ -22,6 +22,6 @@ std::locale SvxResLocale() { return Translate::Create("svx"); } -OUString SvxResId(const char* pId) { return Translate::get(pId, SvxResLocale()); } +OUString SvxResId(std::string_view aId) { return Translate::get(aId, SvxResLocale()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx index 519229e2f230..2a662a7ee2a2 100644 --- a/sw/inc/swtypes.hxx +++ b/sw/inc/swtypes.hxx @@ -114,8 +114,8 @@ const short lOutlineMinTextDistance = 216; // 0.15 inch = 0.38 cm #define INIT_SEQ_FLDTYPES 5 // defined in sw/source/uibase/app/swmodule.cxx -SW_DLLPUBLIC OUString SwResId(const char* pId); -OUString SwResId(const char* pId, int nCardinality); +SW_DLLPUBLIC OUString SwResId(std::string_view aId); +OUString SwResId(std::string_view aId, int nCardinality); css::uno::Reference< css::linguistic2::XSpellChecker1 > GetSpellChecker(); css::uno::Reference< css::linguistic2::XHyphenator > GetHyphenator(); diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index 1a9622ebbd5f..b0c68b7d72c0 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -162,14 +162,14 @@ SwModule::SwModule( SfxObjectFactory* pWebFact, } } -OUString SwResId(const char* pId) +OUString SwResId(std::string_view aId) { - return Translate::get(pId, SW_MOD()->GetResLocale()); + return Translate::get(aId, SW_MOD()->GetResLocale()); } -OUString SwResId(const char* pId, int nCardinality) +OUString SwResId(std::string_view aId, int nCardinality) { - return Translate::nget(pId, nCardinality, SW_MOD()->GetResLocale()); + return Translate::nget(aId, nCardinality, SW_MOD()->GetResLocale()); } uno::Reference< scanner::XScannerManager2 > const & diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx index ef525cf48ca5..cdca420e2636 100644 --- a/unotools/source/i18n/resmgr.cxx +++ b/unotools/source/i18n/resmgr.cxx @@ -116,11 +116,11 @@ static int IgnoringCrtReportHook(int reportType, wchar_t *message, int * /* retu namespace Translate { - std::locale Create(const char* pPrefixName, const LanguageTag& rLocale) + std::locale Create(std::string_view aPrefixName, const LanguageTag& rLocale) { static std::unordered_map<OString, std::locale> aCache; OString sIdentifier = rLocale.getGlibcLocaleString(u".UTF-8").toUtf8(); - OString sUnique = sIdentifier + pPrefixName; + OString sUnique = sIdentifier + aPrefixName; auto aFind = aCache.find(sUnique); if (aFind != aCache.end()) return aFind->second; @@ -146,11 +146,11 @@ namespace Translate gen.add_messages_path(sPath.getStr()); #if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID // allow gettext to find these .mo files e.g. so gtk dialogs can use them - bindtextdomain(pPrefixName, sPath.getStr()); + bindtextdomain(aPrefixName.data(), sPath.getStr()); // tdf#131069 gtk, and anything sane, always wants utf-8 strings as output - bind_textdomain_codeset(pPrefixName, "UTF-8"); + bind_textdomain_codeset(aPrefixName.data(), "UTF-8"); #endif - gen.add_messages_domain(pPrefixName); + gen.add_messages_domain(aPrefixName.data()); #if defined(_WIN32) && defined(DBG_UTIL) // With a newer C++ debug runtime (in an --enable-dbgutil build), passing an invalid locale @@ -197,28 +197,29 @@ namespace Translate return aRet; } - OUString get(const char* pContextAndId, const std::locale &loc) + OUString get(std::string_view sContextAndId, const std::locale &loc) { - OString sContext; - const char *pId = strchr(pContextAndId, '\004'); - if (!pId) - pId = pContextAndId; + std::string_view sContext; + std::string_view sId; + const char *p = strchr(sContextAndId.data(), '\004'); + if (!p) + sId = sContextAndId; else { - sContext = OString(pContextAndId, pId - pContextAndId); - ++pId; - assert(!strchr(pId, '\004') && "should be using nget, not get"); + sContext = std::string_view(sContextAndId.data(), p - sContextAndId.data()); + sId = sContextAndId.substr(p - sContextAndId.data() + 1); + assert(!strchr(sId.data(), '\004') && "should be using nget, not get"); } //if it's a key id locale, generate it here if (std::use_facet<boost::locale::info>(loc).language() == "qtz") { - OString sKeyId(genKeyId(OString(pContextAndId).replace('\004', '|'))); - return OUString::fromUtf8(sKeyId) + u"\u2016" + createFromUtf8(pId, strlen(pId)); + OString sKeyId(genKeyId(OString(sContextAndId).replace('\004', '|'))); + return OUString::fromUtf8(sKeyId) + u"\u2016" + createFromUtf8(sId.data(), sId.size()); } //otherwise translate it - const std::string ret = boost::locale::pgettext(sContext.getStr(), pId, loc); + const std::string ret = boost::locale::pgettext(sContext.data(), sId.data(), loc); OUString result(ExpandVariables(createFromUtf8(ret.data(), ret.size()))); if (comphelper::LibreOfficeKit::isActive()) @@ -231,9 +232,9 @@ namespace Translate return result; } - OUString nget(const char* pContextAndIds, int n, const std::locale &loc) + OUString nget(std::string_view aContextAndIds, int n, const std::locale &loc) { - OString sContextIdId(pContextAndIds); + OString sContextIdId(aContextAndIds); std::vector<OString> aContextIdId; sal_Int32 nIndex = 0; do diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 105fe8f91cfc..0a22d2127d2a 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -429,7 +429,7 @@ VCL_PLUGIN_PUBLIC basegfx::SystemDependentDataManager& ImplGetSystemDependentDat VCL_PLUGIN_PUBLIC vcl::Window* ImplGetDefaultWindow(); vcl::Window* ImplGetDefaultContextWindow(); const std::locale& ImplGetResLocale(); -VCL_PLUGIN_PUBLIC OUString VclResId(const char* pId); +VCL_PLUGIN_PUBLIC OUString VclResId(std::string_view aId); DockingManager* ImplGetDockingManager(); BlendFrameCache* ImplGetBlendFrameCache(); diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 79d6dfa9c146..7e1ad0865010 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1144,12 +1144,12 @@ OUString Application::GetAppName() enum {hwAll=0, hwEnv=1, hwUI=2}; -static OUString Localize(const char *pId, const bool bLocalize) +static OUString Localize(std::string_view aId, const bool bLocalize) { if (bLocalize) - return VclResId(pId); + return VclResId(aId); else - return Translate::get(pId, Translate::Create("vcl", LanguageTag("en-US"))); + return Translate::get(aId, Translate::Create("vcl", LanguageTag("en-US"))); } OUString Application::GetHWOSConfInfo(const int bSelection, const bool bLocalize) diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index ba5fce26278a..8b4e5fc1662a 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -256,9 +256,9 @@ const std::locale& ImplGetResLocale() return pSVData->maResLocale; } -OUString VclResId(const char* pId) +OUString VclResId(std::string_view aId) { - return Translate::get(pId, ImplGetResLocale()); + return Translate::get(aId, ImplGetResLocale()); } const FieldUnitStringList& ImplGetFieldUnits() diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index e80bf84df992..09dde08cb986 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -2858,7 +2858,7 @@ void VclBuilder::handleChild(vcl::Window *pParent, stringmap* pAtkProps, xmlread { name = reader.getAttributeValue(false); sType = OString(name.begin, name.length); - m_pParserState->m_aResLocale = Translate::Create(sType.getStr()); + m_pParserState->m_aResLocale = Translate::Create(sType); } } ++nLevel; diff --git a/writerperfect/inc/WPFTResMgr.hxx b/writerperfect/inc/WPFTResMgr.hxx index 103b68a985a8..f1825f87b781 100644 --- a/writerperfect/inc/WPFTResMgr.hxx +++ b/writerperfect/inc/WPFTResMgr.hxx @@ -4,6 +4,9 @@ #include <unotools/resmgr.hxx> -inline OUString WpResId(const char* pId) { return Translate::get(pId, Translate::Create("wpt")); } +inline OUString WpResId(std::string_view aId) +{ + return Translate::get(aId, Translate::Create("wpt")); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/inc/resourcemanager.hxx b/xmlsecurity/inc/resourcemanager.hxx index 8bb4ae13443d..2999d5fd44ff 100644 --- a/xmlsecurity/inc/resourcemanager.hxx +++ b/xmlsecurity/inc/resourcemanager.hxx @@ -21,6 +21,9 @@ #include <unotools/resmgr.hxx> -inline OUString XsResId(const char* pId) { return Translate::get(pId, Translate::Create("xsc")); } +inline OUString XsResId(std::string_view aId) +{ + return Translate::get(aId, Translate::Create("xsc")); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |