include/unotools/resmgr.hxx | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-)
New commits: commit 3df7f42937f8f73e6eda540105609c488ea3174e Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Mon Aug 25 16:59:19 2025 +0200 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Thu Aug 28 16:41:17 2025 +0200 resmgr: simplify construction, remove obvious operator!= Change-Id: Id23d1fb9f887ade1901cc5e249fedf809a375799 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190186 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/include/unotools/resmgr.hxx b/include/unotools/resmgr.hxx index 973ec2ce3037..2345d0cbd698 100644 --- a/include/unotools/resmgr.hxx +++ b/include/unotools/resmgr.hxx @@ -31,39 +31,45 @@ typedef OUString (*ResHookProc)(const OUString& rStr); struct UNOTOOLS_DLLPUBLIC TranslateId { - const char* mpContext; - const char8_t* mpId; + const char* mpContext = nullptr; + const char8_t* mpId = nullptr; - inline constexpr TranslateId() - : mpContext(nullptr), mpId(nullptr) {} - inline TranslateId(const char* pContext, const char* pId) - : mpContext(pContext), mpId(reinterpret_cast<char8_t const *>(pId)) {} - inline constexpr TranslateId(const char* pContext, const char8_t* pId) - : mpContext(pContext), mpId(pId) {} + constexpr TranslateId() = default; + + TranslateId(const char* pContext, const char* pId) + : mpContext(pContext) + , mpId(reinterpret_cast<char8_t const *>(pId)) + {} + + constexpr TranslateId(const char* pContext, const char8_t* pId) + : mpContext(pContext) + , mpId(pId) + {} char const * getId() const { return reinterpret_cast<char const *>(mpId); } - inline operator bool() const { return mpId != nullptr; } + operator bool() const { return mpId != nullptr; } bool operator==(const TranslateId& other) const; - inline bool operator!=(const TranslateId& other) const { return !operator==(other); } }; struct UNLESS_MERGELIBS(UNOTOOLS_DLLPUBLIC) TranslateNId { - const char* mpContext; - const char* mpSingular; - const char* mpPlural; + const char* mpContext = nullptr; + const char* mpSingular = nullptr; + const char* mpPlural = nullptr; + + TranslateNId() = default; - inline TranslateNId() - : mpContext(nullptr), mpSingular(nullptr), mpPlural(nullptr) {} - inline TranslateNId(const char* pContext, const char* pSingular, const char* pPlural) - : mpContext(pContext), mpSingular(pSingular), mpPlural(pPlural) {} + TranslateNId(const char* pContext, const char* pSingular, const char* pPlural) + : mpContext(pContext) + , mpSingular(pSingular) + , mpPlural(pPlural) + {} - inline operator bool() const { return mpContext != nullptr; } + operator bool() const { return mpContext != nullptr; } bool operator==(const TranslateNId& other) const; - inline bool operator!=(const TranslateNId& other) const { return !operator==(other); } }; namespace Translate