diff options
author | Noel Grandin <noel@peralex.com> | 2014-01-08 08:48:26 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-01-10 13:26:24 +0000 |
commit | b69864f3f8c9be2e1f28f4b422074d2040b084a0 (patch) | |
tree | 93d51bc91257472198beffccb92188ceee61667d /svtools | |
parent | de84529b55f5b295b089043a7119d6b0d8b92408 (diff) |
re-write SvStream operator<< to non-overloaded methods
This is the actual re-write.
Use a clang rewriter to rewrite SvStream::operator<< to methods
like WriteuInt32.
Note that the rewriter is not perfect, and I hand-tweaked the output.
In particular, I had to adjust places doing things like
(*this) << 1;
Change-Id: I5923eda3f4ebaa8b452b6ef109e726e116235a2a
Reviewed-on: https://gerrit.libreoffice.org/7342
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/graphic/grfattr.cxx | 16 | ||||
-rw-r--r-- | svtools/source/graphic/grfmgr.cxx | 3 | ||||
-rw-r--r-- | svtools/source/misc/imap3.cxx | 2 | ||||
-rw-r--r-- | svtools/source/misc/templatefoldercache.cxx | 20 | ||||
-rw-r--r-- | svtools/source/misc/transfer.cxx | 14 |
5 files changed, 29 insertions, 26 deletions
diff --git a/svtools/source/graphic/grfattr.cxx b/svtools/source/graphic/grfattr.cxx index 33234ed7d5bb..fb19ddcb6300 100644 --- a/svtools/source/graphic/grfattr.cxx +++ b/svtools/source/graphic/grfattr.cxx @@ -105,14 +105,16 @@ SvStream& operator<<( SvStream& rOStm, const GraphicAttr& rAttr ) VersionCompat aCompat( rOStm, STREAM_WRITE, 2 ); const sal_uInt32 nTmp32 = 0; - rOStm << nTmp32 << nTmp32 << rAttr.mfGamma << rAttr.mnMirrFlags << rAttr.mnRotate10; - rOStm << rAttr.mnContPercent << rAttr.mnLumPercent << rAttr.mnRPercent << rAttr.mnGPercent << rAttr.mnBPercent; - rOStm << rAttr.mbInvert << rAttr.mcTransparency << (sal_uInt16) rAttr.meDrawMode; + rOStm.WriteUInt32( nTmp32 ).WriteUInt32( nTmp32 ); + rOStm << rAttr.mfGamma; + rOStm.WriteUInt32( rAttr.mnMirrFlags ).WriteUInt16( rAttr.mnRotate10 ); + rOStm.WriteInt16( rAttr.mnContPercent ).WriteInt16( rAttr.mnLumPercent ).WriteInt16( rAttr.mnRPercent ).WriteInt16( rAttr.mnGPercent ).WriteInt16( rAttr.mnBPercent ); + rOStm.WriteUChar( rAttr.mbInvert ).WriteUChar( rAttr.mcTransparency ).WriteUInt16( (sal_uInt16) rAttr.meDrawMode ); //#fdo39428 SvStream no longer supports operator<<(long) - rOStm << sal::static_int_cast<sal_Int32>(rAttr.mnLeftCrop) - << sal::static_int_cast<sal_Int32>(rAttr.mnTopCrop) - << sal::static_int_cast<sal_Int32>(rAttr.mnRightCrop) - << sal::static_int_cast<sal_Int32>(rAttr.mnBottomCrop); + rOStm.WriteInt32( sal::static_int_cast<sal_Int32>(rAttr.mnLeftCrop) ) + .WriteInt32( sal::static_int_cast<sal_Int32>(rAttr.mnTopCrop) ) + .WriteInt32( sal::static_int_cast<sal_Int32>(rAttr.mnRightCrop) ) + .WriteInt32( sal::static_int_cast<sal_Int32>(rAttr.mnBottomCrop) ); return rOStm; } diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index 17805e4b4c9d..8325c3b8d93a 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -1134,7 +1134,8 @@ SvStream& operator<<( SvStream& rOStm, const GraphicObject& rGraphicObj ) VersionCompat aCompat( rOStm, STREAM_WRITE, 1 ); const sal_Bool bLink = rGraphicObj.HasLink(); - rOStm << rGraphicObj.GetGraphic() << rGraphicObj.GetAttr() << bLink; + rOStm << rGraphicObj.GetGraphic() << rGraphicObj.GetAttr(); + rOStm.WriteUChar( bLink ); if( bLink ) write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rOStm, rGraphicObj.GetLink(), RTL_TEXTENCODING_UTF8); diff --git a/svtools/source/misc/imap3.cxx b/svtools/source/misc/imap3.cxx index 7ee8fcb98de6..aecafea392fa 100644 --- a/svtools/source/misc/imap3.cxx +++ b/svtools/source/misc/imap3.cxx @@ -68,7 +68,7 @@ IMapCompat::~IMapCompat() const sal_uLong nEndPos = pRWStm->Tell(); pRWStm->Seek( nCompatPos ); - *pRWStm << (sal_uInt32) ( nEndPos - nTotalSize ); + pRWStm->WriteUInt32( (sal_uInt32) ( nEndPos - nTotalSize ) ); pRWStm->Seek( nEndPos ); } else diff --git a/svtools/source/misc/templatefoldercache.cxx b/svtools/source/misc/templatefoldercache.cxx index f7e64fe1aa81..a1a7b29a7139 100644 --- a/svtools/source/misc/templatefoldercache.cxx +++ b/svtools/source/misc/templatefoldercache.cxx @@ -59,14 +59,14 @@ namespace svt SvStream& operator << ( SvStream& _rStorage, const util::DateTime& _rDate ) { sal_uInt16 hundredthSeconds = static_cast< sal_uInt16 >( _rDate.NanoSeconds / Time::nanoPerCenti ); - _rStorage << hundredthSeconds; + _rStorage.WriteUInt16( hundredthSeconds ); - _rStorage << _rDate.Seconds; - _rStorage << _rDate.Minutes; - _rStorage << _rDate.Hours; - _rStorage << _rDate.Day; - _rStorage << _rDate.Month; - _rStorage << _rDate.Year; + _rStorage.WriteUInt16( _rDate.Seconds ); + _rStorage.WriteUInt16( _rDate.Minutes ); + _rStorage.WriteUInt16( _rDate.Hours ); + _rStorage.WriteUInt16( _rDate.Day ); + _rStorage.WriteUInt16( _rDate.Month ); + _rStorage.WriteInt16( _rDate.Year ); return _rStorage; } @@ -357,7 +357,7 @@ namespace svt // store the info about the children // the number - m_rStorage << (sal_Int32)_rContent.size(); + m_rStorage.WriteInt32( (sal_Int32)_rContent.size() ); // their URLs ( the local name is not enough, since URL might be not a hierarchical one, "expand:" for example ) ::std::for_each( _rContent.getSubContents().begin(), @@ -559,11 +559,11 @@ namespace svt if ( m_bValidCurrentState && openCacheStream( sal_False ) ) { - *m_pCacheStream << getMagicNumber(); + m_pCacheStream->WriteInt32( getMagicNumber() ); // store the template root folders // the size - *m_pCacheStream << (sal_Int32)m_aCurrentState.size(); + m_pCacheStream->WriteInt32( (sal_Int32)m_aCurrentState.size() ); // the complete URLs ::std::for_each( m_aCurrentState.begin(), diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 3e3693dc6f40..f4006c6517ee 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -121,20 +121,20 @@ SvStream& operator<<( SvStream& rOStm, const TransferableObjectDescriptor& rObjD rOStm.SeekRel( 4 ); rOStm << rObjDesc.maClassName; - rOStm << nViewAspect; + rOStm.WriteUInt32( nViewAspect ); //#fdo39428 Remove SvStream operator<<(long) - rOStm << sal::static_int_cast<sal_Int32>(rObjDesc.maSize.Width()); - rOStm << sal::static_int_cast<sal_Int32>(rObjDesc.maSize.Height()); - rOStm << sal::static_int_cast<sal_Int32>(rObjDesc.maDragStartPos.X()); - rOStm << sal::static_int_cast<sal_Int32>(rObjDesc.maDragStartPos.Y()); + rOStm.WriteInt32( sal::static_int_cast<sal_Int32>(rObjDesc.maSize.Width()) ); + rOStm.WriteInt32( sal::static_int_cast<sal_Int32>(rObjDesc.maSize.Height()) ); + rOStm.WriteInt32( sal::static_int_cast<sal_Int32>(rObjDesc.maDragStartPos.X()) ); + rOStm.WriteInt32( sal::static_int_cast<sal_Int32>(rObjDesc.maDragStartPos.Y()) ); rOStm.WriteUniOrByteString( rObjDesc.maTypeName, osl_getThreadTextEncoding() ); rOStm.WriteUniOrByteString( rObjDesc.maDisplayName, osl_getThreadTextEncoding() ); - rOStm << nSig1 << nSig2; + rOStm.WriteUInt32( nSig1 ).WriteUInt32( nSig2 ); const sal_uInt32 nLastPos = rOStm.Tell(); rOStm.Seek( nFirstPos ); - rOStm << ( nLastPos - nFirstPos ); + rOStm.WriteUInt32( nLastPos - nFirstPos ); rOStm.Seek( nLastPos ); return rOStm; |