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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jan 10 07:27:30 UTC 2019


 configmgr/source/writemodfile.cxx |   20 ++++++++++----------
 configmgr/source/writemodfile.hxx |    9 +++++----
 include/rtl/string.hxx            |    7 +++++++
 include/rtl/ustring.hxx           |    8 ++++++++
 4 files changed, 30 insertions(+), 14 deletions(-)

New commits:
commit dac7be50cff94e0c34cdca5ac7e35c19685c40c1
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Jan 9 12:12:13 2019 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Jan 10 08:27:04 2019 +0100

    o3tl::string_view -> std::string_view (in configmgr)
    
    Change-Id: I64131f59ce859a252baa9c84291d262bcb04fffd
    Reviewed-on: https://gerrit.libreoffice.org/66012
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/configmgr/source/writemodfile.cxx b/configmgr/source/writemodfile.cxx
index b3592bb1a8af..2122c3fdf947 100644
--- a/configmgr/source/writemodfile.cxx
+++ b/configmgr/source/writemodfile.cxx
@@ -22,13 +22,13 @@
 #include <cassert>
 #include <cstddef>
 #include <limits>
+#include <string_view>
 
 #include <com/sun/star/uno/Any.hxx>
 #include <com/sun/star/uno/Reference.hxx>
 #include <com/sun/star/uno/RuntimeException.hpp>
 #include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/uno/XInterface.hpp>
-#include <o3tl/string_view.hxx>
 #include <osl/file.h>
 #include <osl/file.hxx>
 #include <rtl/string.h>
@@ -60,7 +60,7 @@ class Components;
 
 namespace {
 
-OString convertToUtf8(o3tl::u16string_view text) {
+OString convertToUtf8(std::u16string_view text) {
     OString s;
     assert(text.size() <= sal_uInt32(std::numeric_limits<sal_Int32>::max()));
     if (!rtl_convertUStringToString(
@@ -140,7 +140,7 @@ oslFileError TempFile::flush() {
     return e;
 }
 
-void TempFile::writeString(o3tl::string_view text) {
+void TempFile::writeString(std::string_view text) {
     buffer.append(text.data(), text.size());
     if (buffer.getLength() > 0x10000)
         flush();
@@ -186,8 +186,8 @@ void writeValueContent_(
             '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C',
             'D', 'E', 'F' };
         handle.writeString(
-            o3tl::string_view(hexDigit + ((value[i] >> 4) & 0xF), 1));
-        handle.writeString(o3tl::string_view(hexDigit + (value[i] & 0xF), 1));
+            std::string_view(hexDigit + ((value[i] >> 4) & 0xF), 1));
+        handle.writeString(std::string_view(hexDigit + (value[i] & 0xF), 1));
     }
 }
 
@@ -281,7 +281,7 @@ void writeValue(TempFile &handle, Type type, css::uno::Any const & value) {
 
 void writeNode(
     Components & components, TempFile &handle,
-    rtl::Reference< Node > const & parent, o3tl::u16string_view name,
+    rtl::Reference< Node > const & parent, std::u16string_view name,
     rtl::Reference< Node > const & node)
 {
     static xmlreader::Span const typeNames[] = {
@@ -316,7 +316,7 @@ void writeNode(
                 if (type != TYPE_NIL) {
                     handle.writeString(" oor:type=\"");
                     handle.writeString(
-                        o3tl::string_view(
+                        std::string_view(
                             typeNames[type].begin, typeNames[type].length));
                     handle.writeString("\"");
                 }
@@ -359,7 +359,7 @@ void writeNode(
                 if (type != TYPE_NIL) {
                     handle.writeString(" oor:type=\"");
                     handle.writeString(
-                        o3tl::string_view(
+                        std::string_view(
                             typeNames[type].begin, typeNames[type].length));
                     handle.writeString("\"");
                 }
@@ -479,7 +479,7 @@ void writeModifications(
 
 }
 
-void writeAttributeValue(TempFile &handle, o3tl::u16string_view value) {
+void writeAttributeValue(TempFile &handle, std::u16string_view value) {
     std::size_t i = 0;
     std::size_t j = i;
     for (; j != value.size(); ++j) {
@@ -524,7 +524,7 @@ void writeAttributeValue(TempFile &handle, o3tl::u16string_view value) {
     handle.writeString(convertToUtf8(value.substr(i, j - i)));
 }
 
-void writeValueContent(TempFile &handle, o3tl::u16string_view value) {
+void writeValueContent(TempFile &handle, std::u16string_view value) {
     std::size_t i = 0;
     std::size_t j = i;
     for (; j != value.size(); ++j) {
diff --git a/configmgr/source/writemodfile.hxx b/configmgr/source/writemodfile.hxx
index a8925ab8e758..435a24caf63f 100644
--- a/configmgr/source/writemodfile.hxx
+++ b/configmgr/source/writemodfile.hxx
@@ -22,7 +22,8 @@
 
 #include <sal/config.h>
 
-#include <o3tl/string_view.hxx>
+#include <string_view>
+
 #include <rtl/strbuf.hxx>
 
 namespace configmgr {
@@ -43,15 +44,15 @@ struct TempFile {
 #ifdef _WIN32
     oslFileError closeWithoutUnlink();
 #endif
-    void writeString(o3tl::string_view text);
+    void writeString(std::string_view text);
 
 private:
     TempFile(const TempFile&) = delete;
     TempFile& operator=(const TempFile&) = delete;
 };
 
-void writeAttributeValue(TempFile &handle, o3tl::u16string_view value);
-void writeValueContent(TempFile &handle, o3tl::u16string_view value);
+void writeAttributeValue(TempFile &handle, std::u16string_view value);
+void writeValueContent(TempFile &handle, std::u16string_view value);
 
 void writeModFile(
     Components & components, OUString const & url, Data const & data);
diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx
index cac60d34d8e6..b26aa23e556a 100644
--- a/include/rtl/string.hxx
+++ b/include/rtl/string.hxx
@@ -28,6 +28,10 @@
 #include <ostream>
 #include <string.h>
 
+#if defined LIBO_INTERNAL_ONLY
+#include <string_view>
+#endif
+
 #include "rtl/textenc.h"
 #include "rtl/string.h"
 #include "rtl/stringutils.hxx"
@@ -1787,6 +1791,9 @@ public:
         return number(d);
     }
 
+#if defined LIBO_INTERNAL_ONLY
+    operator std::string_view() const { return {getStr(), sal_uInt32(getLength())}; }
+#endif
 };
 
 /* ======================================================================= */
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index 5f738cfaa5fc..bf63efc71723 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -27,6 +27,10 @@
 #include <new>
 #include <ostream>
 
+#if defined LIBO_INTERNAL_ONLY
+#include <string_view>
+#endif
+
 #include "rtl/ustring.h"
 #include "rtl/string.hxx"
 #include "rtl/stringutils.hxx"
@@ -3544,6 +3548,10 @@ public:
         return OUString( pNew, SAL_NO_ACQUIRE );
     }
 
+#if defined LIBO_INTERNAL_ONLY
+    operator std::u16string_view() const { return {getStr(), sal_uInt32(getLength())}; }
+#endif
+
 private:
     OUString & internalAppend( rtl_uString* pOtherData )
     {


More information about the Libreoffice-commits mailing list