summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2017-08-18 12:06:36 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-08-19 19:53:23 +0200
commite62a8f333332688203867fdddbc8ffa89a657b9f (patch)
tree8eb2b3ffdd17e92f70e5dca2ef0668c58b26ecfd /svl
parente947d11753e8d3a13a251ec99ce7129099dca1a1 (diff)
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/41331 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r--svl/Library_svl.mk1
-rw-r--r--svl/source/inc/poolio.hxx44
-rw-r--r--svl/source/inc/stringio.hxx26
-rw-r--r--svl/source/items/poolio.cxx27
-rw-r--r--svl/source/items/stringio.cxx35
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: */