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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jan 10 21:22:59 UTC 2019


 embedserv/source/embed/ed_ipersiststr.cxx |   13 ++++++++-----
 embedserv/source/embed/guid.cxx           |    2 +-
 embedserv/source/embed/guid.hxx           |    5 +++--
 include/rtl/ustring.hxx                   |   11 +++++++++++
 4 files changed, 23 insertions(+), 8 deletions(-)

New commits:
commit 6856da30665705be6380e84cf55de954c41f15d1
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Jan 10 11:21:45 2019 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Jan 10 22:22:29 2019 +0100

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

diff --git a/embedserv/source/embed/ed_ipersiststr.cxx b/embedserv/source/embed/ed_ipersiststr.cxx
index 44757a5eb35c..77131196b4b9 100644
--- a/embedserv/source/embed/ed_ipersiststr.cxx
+++ b/embedserv/source/embed/ed_ipersiststr.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <string_view>
+
 #include <embeddoc.hxx>
 #include <com/sun/star/uno/Exception.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -34,7 +38,6 @@
 
 #include <comphelper/processfactory.hxx>
 #include <o3tl/char16_t2wchar_t.hxx>
-#include <o3tl/string_view.hxx>
 #include <osl/mutex.hxx>
 #include <osl/diagnose.h>
 #include <sal/types.h>
@@ -397,7 +400,7 @@ STDMETHODIMP EmbedDocument_Impl::InitNew( IStorage *pStg )
         if ( m_xFactory.is() && pStg )
         {
             uno::Reference< frame::XModel > aDocument(
-                            m_xFactory->createInstance( o3tl::toOUString(getServiceNameFromGUID_Impl( &m_guid )) ),
+                            m_xFactory->createInstance( getServiceNameFromGUID_Impl( &m_guid ) ),
                             uno::UNO_QUERY );
             if ( aDocument.is() )
             {
@@ -532,7 +535,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( IStorage *pStg )
         if ( xTempIn.is() )
         {
             uno::Reference< frame::XModel > aDocument(
-                                                m_xFactory->createInstance( o3tl::toOUString(getServiceNameFromGUID_Impl( &m_guid )) ),
+                                                m_xFactory->createInstance( getServiceNameFromGUID_Impl( &m_guid ) ),
                                                 uno::UNO_QUERY );
             if ( aDocument.is() )
             {
@@ -739,7 +742,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD /*dwMode*/ )
 
     if ( FAILED( hr ) || !m_pMasterStorage ) return E_FAIL;
 
-    o3tl::u16string_view aCurType = getServiceNameFromGUID_Impl( &m_guid ); // ???
+    std::u16string_view aCurType = getServiceNameFromGUID_Impl( &m_guid ); // ???
     CLIPFORMAT cf = static_cast<CLIPFORMAT>(RegisterClipboardFormatW( L"Embedded Object" ));
     hr = WriteFmtUserTypeStg( m_pMasterStorage,
                             cf,                         // ???
@@ -765,7 +768,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD /*dwMode*/ )
 
 
     uno::Reference< frame::XModel > aDocument(
-                    m_xFactory->createInstance( o3tl::toOUString(getServiceNameFromGUID_Impl( &m_guid )) ),
+                    m_xFactory->createInstance( getServiceNameFromGUID_Impl( &m_guid ) ),
                     uno::UNO_QUERY );
     if ( aDocument.is() )
     {
diff --git a/embedserv/source/embed/guid.cxx b/embedserv/source/embed/guid.cxx
index cb23d05f0fc5..0260cb0ebc7e 100644
--- a/embedserv/source/embed/guid.cxx
+++ b/embedserv/source/embed/guid.cxx
@@ -58,7 +58,7 @@ wchar_t const * getStorageTypeFromGUID_Impl( GUID const * guid )
     return L"";
 }
 
-o3tl::u16string_view getServiceNameFromGUID_Impl( GUID const * guid )
+std::u16string_view getServiceNameFromGUID_Impl( GUID const * guid )
 {
     if ( *guid == OID_WriterTextServer )
         return u"com.sun.star.comp.Writer.TextDocument";
diff --git a/embedserv/source/embed/guid.hxx b/embedserv/source/embed/guid.hxx
index 886004c663ef..eca39c2880c8 100644
--- a/embedserv/source/embed/guid.hxx
+++ b/embedserv/source/embed/guid.hxx
@@ -22,14 +22,15 @@
 
 #include <sal/config.h>
 
-#include <o3tl/string_view.hxx>
+#include <string_view>
+
 #include <rtl/ustring.hxx>
 
 #include <common.h>
 
 OUString getFilterNameFromGUID_Impl( GUID const * );
 
-o3tl::u16string_view getServiceNameFromGUID_Impl( GUID const * );
+std::u16string_view getServiceNameFromGUID_Impl( GUID const * );
 
 wchar_t const * getStorageTypeFromGUID_Impl( GUID const * guid );
 
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index c6e3760838ce..35e0ca7756be 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -24,6 +24,7 @@
 
 #include <cassert>
 #include <cstddef>
+#include <limits>
 #include <new>
 #include <ostream>
 #include <utility>
@@ -410,6 +411,16 @@ public:
     }
 #endif
 
+#if defined LIBO_INTERNAL_ONLY
+    OUString(std::u16string_view sv) {
+        if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max())) {
+            throw std::bad_alloc();
+        }
+        pData = nullptr;
+        rtl_uString_newFromStr_WithLength(&pData, sv.data(), sv.size());
+    }
+#endif
+
     /**
       Release the string data.
     */


More information about the Libreoffice-commits mailing list