[Libreoffice-commits] core.git: include/rtl

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 21 15:59:44 UTC 2021


 include/rtl/strbuf.hxx  |    4 ++++
 include/rtl/ustrbuf.hxx |    5 +++++
 2 files changed, 9 insertions(+)

New commits:
commit 967da14b48035f5acdd8a604a5c33cc6fe37035a
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Apr 21 11:56:40 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Apr 21 17:58:54 2021 +0200

    string_view conversion operator for O[U]StringBuffer
    
    which will be useful in an upcoming change of mine, so I don't need to
    construct a temporary from a buffer
    
    Change-Id: I1737a725ac5792b7d866d7f2b4c9f9ff7b50dffe
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114397
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/rtl/strbuf.hxx b/include/rtl/strbuf.hxx
index 5bdf072a7777..a238f305fa07 100644
--- a/include/rtl/strbuf.hxx
+++ b/include/rtl/strbuf.hxx
@@ -248,6 +248,10 @@ public:
     {}
 #endif
 
+#if defined LIBO_INTERNAL_ONLY
+    operator std::string_view() const { return {getStr(), sal_uInt32(getLength())}; }
+#endif
+
     /** Assign to this a copy of value.
      */
     OStringBuffer& operator = ( const OStringBuffer& value )
diff --git a/include/rtl/ustrbuf.hxx b/include/rtl/ustrbuf.hxx
index 170b76908dff..65762d53960d 100644
--- a/include/rtl/ustrbuf.hxx
+++ b/include/rtl/ustrbuf.hxx
@@ -253,6 +253,11 @@ public:
         rtl_uStringbuffer_newFromStr_WithLength( &pData, n.buf, n.length );
     }
 #endif
+
+#if defined LIBO_INTERNAL_ONLY
+    operator std::u16string_view() const { return {getStr(), sal_uInt32(getLength())}; }
+#endif
+
     /** Assign to this a copy of value.
      */
     OUStringBuffer& operator = ( const OUStringBuffer& value )


More information about the Libreoffice-commits mailing list