summaryrefslogtreecommitdiff
path: root/include/comphelper/seqstream.hxx
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-09-24 14:55:02 +0200
committerMatúš Kukan <matus.kukan@collabora.com>2014-10-23 11:53:14 +0200
commitb7266ddb2f580a2ed3c558d1996b5e2760023145 (patch)
treea2a130ee1dc29c1b07497c499dd3ac3afd6a371b /include/comphelper/seqstream.hxx
parent5c8ea6d943ef37d73069288f9ef7dbd374721a71 (diff)
FastSerializer: Buffer output and write it only at the end
Use OSequenceOutputStream class to concatenate strings in a Sequence<sal_Int8> buffer. And write data to file only at the end. The design is a bit fragile, since all FSHelpers need to be destroyed before calling FilterBase::commitStorage(). Otherwise data is not written. Change-Id: I26b02335ef36011bfcda17484b560811d18c7657
Diffstat (limited to 'include/comphelper/seqstream.hxx')
-rw-r--r--include/comphelper/seqstream.hxx18
1 files changed, 8 insertions, 10 deletions
diff --git a/include/comphelper/seqstream.hxx b/include/comphelper/seqstream.hxx
index d5729955000c..d4f301cdd1d8 100644
--- a/include/comphelper/seqstream.hxx
+++ b/include/comphelper/seqstream.hxx
@@ -74,27 +74,23 @@ public:
private:
inline sal_Int32 avail();
};
-typedef ::cppu::WeakImplHelper1< ::com::sun::star::io::XOutputStream > OSequenceOutputStream_Base;
-class OSequenceOutputStream : public OSequenceOutputStream_Base
+class COMPHELPER_DLLPUBLIC OSequenceOutputStream :
+ public ::cppu::WeakImplHelper1< ::com::sun::star::io::XOutputStream >
{
protected:
::com::sun::star::uno::Sequence< sal_Int8 >& m_rSequence;
double m_nResizeFactor;
sal_Int32 m_nMinimumResize;
sal_Int32 m_nMaximumResize;
+ /** the size of the virtual stream. This is not the size of the sequence,
+ but the number of bytes written into the stream at a given moment.
+ */
sal_Int32 m_nSize;
- // the size of the virtual stream. This is not the size of the sequence, but the number of bytes written
- // into the stream at a given moment.
-
- bool m_bConnected;
- // closeOutput has been called ?
+ bool m_bConnected; ///< closeOutput has been called ?
::osl::Mutex m_aMutex;
-protected:
- virtual ~OSequenceOutputStream() { if (m_bConnected) closeOutput(); }
-
public:
/** constructs the object. Everything written into the stream through the XOutputStream methods will be forwarded
to the sequence, reallocating it if necessary. Writing will start at offset 0 within the sequence.
@@ -118,6 +114,8 @@ public:
sal_Int32 _nMaximumResize = -1
);
+ virtual ~OSequenceOutputStream() { if (m_bConnected) closeOutput(); }
+
/// same as XOutputStream::writeBytes (as expected :)
virtual void SAL_CALL writeBytes( const ::com::sun::star::uno::Sequence< sal_Int8 >& aData ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
/// this is a dummy in this implementation, no buffering is used