diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-10-13 22:53:16 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-10-15 22:05:17 +0200 |
commit | d3a0815b12c0d040e99e22e53f6574726b868ec7 (patch) | |
tree | c57aefa2deaaa7e67cad3b46ed601d9e7ede0769 | |
parent | b4844c310bd9897fef59e8a4da0513100ea86096 (diff) |
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 <sbergman@redhat.com>
-rw-r--r-- | include/rtl/string.hxx | 38 | ||||
-rw-r--r-- | vcl/source/fontsubset/cff.cxx | 2 |
2 files changed, 1 insertions, 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<std::size_t N> constexpr OStringConstExpr(OStringLiteral<N> const & literal): - pData(const_cast<rtl_String *>(&literal.str)) {} - - // prevent mis-use - template<std::size_t N> constexpr OStringConstExpr(OStringLiteral<N> && 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 { @@ -2287,11 +2254,6 @@ public: }; #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<char> const & rhs) { return lhs == std::string_view(rhs); } inline bool operator !=(OString const & lhs, StringConcatenation<char> const & 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, |