diff options
-rw-r--r-- | svl/Library_svl.mk | 1 | ||||
-rw-r--r-- | svl/source/inc/poolio.hxx | 44 | ||||
-rw-r--r-- | svl/source/inc/stringio.hxx | 26 | ||||
-rw-r--r-- | svl/source/items/poolio.cxx | 27 | ||||
-rw-r--r-- | svl/source/items/stringio.cxx | 35 |
5 files changed, 43 insertions, 90 deletions
diff --git a/svl/Library_svl.mk b/svl/Library_svl.mk index e4be06e1157e..c61b0e789f40 100644 --- a/svl/Library_svl.mk +++ b/svl/Library_svl.mk @@ -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 \ diff --git a/svl/source/inc/poolio.hxx b/svl/source/inc/poolio.hxx index 8695dfe8b69e..65ceb1680ec7 100644 --- a/svl/source/inc/poolio.hxx +++ b/svl/source/inc/poolio.hxx @@ -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: */ diff --git a/svl/source/inc/stringio.hxx b/svl/source/inc/stringio.hxx index 6d8685205ee2..1b935d07797d 100644 --- a/svl/source/inc/stringio.hxx +++ b/svl/source/inc/stringio.hxx @@ -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 diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx index 6c4e64381f80..81f498bd1d76 100644 --- a/svl/source/items/poolio.cxx +++ b/svl/source/items/poolio.cxx @@ -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: */ diff --git a/svl/source/items/stringio.cxx b/svl/source/items/stringio.cxx new file mode 100644 index 000000000000..3ee78e354078 --- /dev/null +++ b/svl/source/items/stringio.cxx @@ -0,0 +1,35 @@ +/* -*- 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: */ |