Kaydet (Commit) e62a8f33 authored tarafından Jochen Nitschke's avatar Jochen Nitschke Kaydeden (comit) Noel Grandin

svl: refactor string stream helpers

functions were declared twice, in stringio.hxx and poolio.hxx.

remove unicode functions as they were unused.
remove duplicate function declarations in poolio.hxx.
move implementations from poolio.cxx to new stringio.cxx.

Change-Id: I469346a01d793d22721e62bf7e96fd01e28d560c
Reviewed-on: https://gerrit.libreoffice.org/41331Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst e947d117
......@@ -149,6 +149,7 @@ $(eval $(call gb_Library_add_exception_objects,svl,\
svl/source/items/sitem \
svl/source/items/slstitm \
svl/source/items/srchitem \
svl/source/items/stringio \
svl/source/items/stritem \
svl/source/items/style \
svl/source/items/stylepool \
......
......@@ -20,12 +20,12 @@
#ifndef INCLUDED_SVL_SOURCE_INC_POOLIO_HXX
#define INCLUDED_SVL_SOURCE_INC_POOLIO_HXX
#include <svl/itempool.hxx>
#include <svl/SfxBroadcaster.hxx>
#include <deque>
#include <memory>
#include <unordered_map>
#include <vector>
#include <tools/stream.hxx>
class SfxPoolItem;
class SfxItemPoolUser;
......@@ -140,48 +140,6 @@ struct SfxItemPool_Impl
#define SFX_ITEMPOOL_REC_ITEMS sal_uInt16(0x0040)
#define SFX_ITEMPOOL_REC_DEFAULTS sal_uInt16(0x0050)
/** Read in a Unicode string from a streamed byte string representation.
@param rStream Some (input) stream. Its Stream/TargetCharSets must
be set to correct values!
@return On success, returns the reconstructed Unicode string.
*/
OUString readByteString(SvStream & rStream);
/** Write a byte string representation of a Unicode string into a stream.
@param rStream Some (output) stream. Its Stream/TargetCharSets must
be set to correct values!
@param rString Some Unicode string.
*/
void writeByteString(SvStream & rStream, const OUString& rString);
/** Read in a Unicode string from either a streamed Unicode or byte string
representation.
@param rStream Some (input) stream. If bUnicode is false, its
Stream/TargetCharSets must be set to correct values!
@param bUnicode Whether to read in a stream Unicode (true) or byte
string (false) representation.
@return On success, returns the reconstructed Unicode string.
*/
OUString readUnicodeString(SvStream & rStream, bool bUnicode);
/** Write a Unicode string representation of a Unicode string into a
stream.
@param rStream Some (output) stream.
@param rString Some Unicode string.
*/
void writeUnicodeString(SvStream & rStream, const OUString& rString);
#endif // INCLUDED_SVL_SOURCE_INC_POOLIO_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -20,6 +20,10 @@
#ifndef INCLUDED_SVL_SOURCE_INC_STRINGIO_HXX
#define INCLUDED_SVL_SOURCE_INC_STRINGIO_HXX
#include <rtl/ustring.hxx>
class SvStream;
/** Read in a Unicode string from a streamed byte string representation.
@param rStream Some (input) stream. Its Stream/TargetCharSets must
......@@ -38,28 +42,6 @@ OUString readByteString(SvStream & rStream);
*/
void writeByteString(SvStream & rStream, const OUString& rString);
/** Read in a Unicode string from either a streamed Unicode or byte string
representation.
@param rStream Some (input) stream. If bUnicode is false, its
Stream/TargetCharSets must be set to correct values!
@param bUnicode Whether to read in a stream Unicode (true) or byte
string (false) representation.
@return On success, returns the reconstructed Unicode string.
*/
OUString readUnicodeString(SvStream & rStream, bool bUnicode);
/** Write a Unicode string representation of a Unicode string into a
stream.
@param rStream Some (output) stream.
@param rString Some Unicode string.
*/
void writeUnicodeString(SvStream & rStream, const OUString& rString);
#endif // INCLUDED_SVL_SOURCE_INC_STRINGIO_HXX
......
......@@ -17,14 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <string.h>
#include "poolio.hxx"
#include <sal/log.hxx>
#include <tools/solar.h>
#include <svl/itempool.hxx>
#include <svl/SfxBroadcaster.hxx>
#include "poolio.hxx"
#include <algorithm>
#include <memory>
......@@ -118,26 +117,4 @@ bool SfxItemPool::CheckItemInPool(const SfxPoolItem *pItem) const
return false;
}
OUString readByteString(SvStream& rStream)
{
return rStream.ReadUniOrByteString(rStream.GetStreamCharSet());
}
void writeByteString(SvStream & rStream, const OUString& rString)
{
rStream.WriteUniOrByteString(rString, rStream.GetStreamCharSet());
}
OUString readUnicodeString(SvStream & rStream, bool bUnicode)
{
return rStream.ReadUniOrByteString(bUnicode ? RTL_TEXTENCODING_UCS2 :
rStream.GetStreamCharSet());
}
void writeUnicodeString(SvStream & rStream, const OUString& rString)
{
rStream.WriteUniOrByteString(rString, RTL_TEXTENCODING_UCS2);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "stringio.hxx"
#include <tools/stream.hxx>
OUString readByteString(SvStream& rStream)
{
return rStream.ReadUniOrByteString(rStream.GetStreamCharSet());
}
void writeByteString(SvStream & rStream, const OUString& rString)
{
rStream.WriteUniOrByteString(rString, rStream.GetStreamCharSet());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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