From d3a0815b12c0d040e99e22e53f6574726b868ec7 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 13 Oct 2023 22:53:16 +0200 Subject: Drop OStringConstExpr, use constexpr OString instead Change-Id: Ibb41a27fe7d5456d8db0c98821d5b2acf8586b70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157949 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- include/rtl/string.hxx | 38 -------------------------------------- vcl/source/fontsubset/cff.cxx | 2 +- 2 files changed, 1 insertion(+), 39 deletions(-) diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx index 6cc26e7befe3..de468f127757 100644 --- a/include/rtl/string.hxx +++ b/include/rtl/string.hxx @@ -153,39 +153,6 @@ public: }; }; -/** - This is intended to be used when declaring compile-time-constant structs or arrays - that can be initialised from named OStringLiteral e.g. - - constexpr OStringLiteral AAA = u"aaa"; - constexpr OStringLiteral BBB = u"bbb"; - constexpr OStringConstExpr FOO[] { AAA, BBB }; -*/ -class OString; -class OStringConstExpr -{ -public: - template constexpr OStringConstExpr(OStringLiteral const & literal): - pData(const_cast(&literal.str)) {} - - // prevent mis-use - template constexpr OStringConstExpr(OStringLiteral && literal) - = delete; - - // no destructor necessary because we know we are pointing at a compile-time - // constant OStringLiteral, which bypasses ref-counting. - - /** - make it easier to pass to OStringBuffer and similar without casting/converting - */ - constexpr std::string_view asView() const { return std::string_view(pData->buffer, pData->length); } - - inline operator const OString&() const; - -private: - rtl_String* pData; -}; - #if !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED) namespace detail { @@ -2286,11 +2253,6 @@ public: #endif }; -#if defined LIBO_INTERNAL_ONLY -// Can only define this after we define OString -inline OStringConstExpr::operator const OString &() const { return OString::unacquired(&pData); } -#endif - #if defined LIBO_INTERNAL_ONLY inline bool operator ==(OString const & lhs, StringConcatenation const & rhs) { return lhs == std::string_view(rhs); } diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index 7284954397fd..365d5459ee0a 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -433,7 +433,7 @@ constexpr OStringLiteral tok_Regular = "Regular"; constexpr OStringLiteral tok_Roman = "Roman"; constexpr OStringLiteral tok_Semibold = "Semibold"; -constexpr rtl::OStringConstExpr pStringIds[] = { +constexpr OString pStringIds[] = { /*0*/ tok_notdef, tok_space, tok_exclam, tok_quotedbl, tok_numbersign, tok_dollar, tok_percent, tok_ampersand, tok_quoteright, tok_parenleft, tok_parenright, tok_asterisk, -- cgit