Kaydet (Commit) dac7be50 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

o3tl::string_view -> std::string_view (in configmgr)

Change-Id: I64131f59ce859a252baa9c84291d262bcb04fffd
Reviewed-on: https://gerrit.libreoffice.org/66012
Tested-by: Jenkins
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst b8f497a0
......@@ -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) {
......
......@@ -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);
......
......@@ -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
};
/* ======================================================================= */
......
......@@ -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 )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment