From b78146b4db3b31919f133c84db9b23fdb7c8ddf4 Mon Sep 17 00:00:00 2001 From: Matteo Casalin Date: Sat, 28 Dec 2013 22:18:21 +0100 Subject: Use member initialization list in some constructors Change-Id: Ie0c9720966ca42373bec7a1697b72c5a17f49644 --- editeng/source/editeng/editdoc.cxx | 34 ++++++++++---------- editeng/source/editeng/editdoc.hxx | 63 ++++++++++++++++++++++++++------------ 2 files changed, 62 insertions(+), 35 deletions(-) (limited to 'editeng') diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 5cb90b5414b2..dc0a64415c08 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -504,17 +504,17 @@ sal_uInt16 TextPortionList::GetStartPos(size_t nPortion) return nPos; } - ExtraPortionInfo::ExtraPortionInfo() +: nOrgWidth(0) +, nWidthFullCompression(0) +, nPortionOffsetX(0) +, nMaxCompression100thPercent(0) +, nAsianCompressionTypes(0) +, bFirstCharIsRightPunktuation(sal_False) +, bCompressed(sal_False) +, pOrgDXArray(NULL) +, lineBreaksList() { - nOrgWidth = 0; - nWidthFullCompression = 0; - nMaxCompression100thPercent = 0; - nAsianCompressionTypes = 0; - nPortionOffsetX = 0; - bFirstCharIsRightPunktuation = sal_False; - bCompressed = sal_False; - pOrgDXArray = NULL; } ExtraPortionInfo::~ExtraPortionInfo() @@ -1765,16 +1765,16 @@ void ContentNode::DestroyWrongList() mpWrongList.reset(); } -ContentAttribs::ContentAttribs( SfxItemPool& rPool ) : - aAttribSet( rPool, EE_PARA_START, EE_CHAR_END ) +ContentAttribs::ContentAttribs( SfxItemPool& rPool ) +: pStyle(0) +, aAttribSet( rPool, EE_PARA_START, EE_CHAR_END ) { - pStyle = 0; } -ContentAttribs::ContentAttribs( const ContentAttribs& rRef ) : - aAttribSet( rRef.aAttribSet ) +ContentAttribs::ContentAttribs( const ContentAttribs& rRef ) +: pStyle(rRef.pStyle) +, aAttribSet( rRef.aAttribSet ) { - pStyle = rRef.pStyle; } ContentAttribs::~ContentAttribs() @@ -2698,9 +2698,11 @@ struct LessByStart : std::binary_function } CharAttribList::CharAttribList() +: aAttribs() +, aDefFont() +, bHasEmptyAttribs(false) { DBG_CTOR( EE_CharAttribList, 0 ); - bHasEmptyAttribs = sal_False; } CharAttribList::~CharAttribList() diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx index 5fe635ba4bdb..aebbd041a406 100644 --- a/editeng/source/editeng/editdoc.hxx +++ b/editeng/source/editeng/editdoc.hxx @@ -59,9 +59,9 @@ struct EPaM sal_Int32 nPara; sal_Int32 nIndex; - EPaM() { nPara = 0; nIndex = 0; } - EPaM( sal_Int32 nP, sal_Int32 nI ) { nPara = nP; nIndex = nI; } - EPaM( const EPaM& r) { nPara = r.nPara; nIndex = r.nIndex; } + EPaM() : nPara(0), nIndex(0) {} + EPaM( sal_Int32 nP, sal_Int32 nI ) : nPara(nP), nIndex(nI) {} + EPaM( const EPaM& r) : nPara(r.nPara), nIndex(r.nIndex) {} EPaM& operator = ( const EPaM& r ) { nPara = r.nPara; nIndex = r.nIndex; return *this; } inline sal_Bool operator == ( const EPaM& r ) const; inline sal_Bool operator < ( const EPaM& r ) const; @@ -85,10 +85,10 @@ struct ScriptTypePosInfo sal_uInt16 nEndPos; ScriptTypePosInfo( short _Type, sal_uInt16 _Start, sal_uInt16 _End ) + : nScriptType(_Type) + , nStartPos(_Start) + , nEndPos(_End) { - nScriptType = _Type; - nStartPos = _Start; - nEndPos = _End; } }; @@ -101,10 +101,10 @@ struct WritingDirectionInfo sal_uInt16 nEndPos; WritingDirectionInfo( sal_uInt8 _Type, sal_uInt16 _Start, sal_uInt16 _End ) + : nType(_Type) + , nStartPos(_Start) + , nEndPos(_End) { - nType = _Type; - nStartPos = _Start; - nEndPos = _End; } }; @@ -391,16 +391,39 @@ private: sal_Unicode nExtraValue; - TextPortion() { DBG_CTOR( EE_TextPortion, 0 ); - pExtraInfos = NULL; nLen = 0; nKind = PORTIONKIND_TEXT; nExtraValue = 0; nRightToLeft = sal_False;} + TextPortion() + : pExtraInfos( NULL ) + , nLen( 0 ) + , aOutSz() + , nKind( PORTIONKIND_TEXT ) + , nRightToLeft( sal_False ) + , nExtraValue( 0 ) + { + DBG_CTOR( EE_TextPortion, 0 ); + } public: - TextPortion( sal_uInt16 nL ) : aOutSz( -1, -1 ) - { DBG_CTOR( EE_TextPortion, 0 ); - pExtraInfos = NULL; nLen = nL; nKind = PORTIONKIND_TEXT; nExtraValue = 0; nRightToLeft = sal_False;} - TextPortion( const TextPortion& r ) : aOutSz( r.aOutSz ) - { DBG_CTOR( EE_TextPortion, 0 ); - pExtraInfos = NULL; nLen = r.nLen; nKind = r.nKind; nExtraValue = r.nExtraValue; nRightToLeft = r.nRightToLeft; } + TextPortion( sal_uInt16 nL ) + : pExtraInfos( NULL ) + , nLen( nL ) + , aOutSz( -1, -1 ) + , nKind( PORTIONKIND_TEXT ) + , nRightToLeft( sal_False ) + , nExtraValue( 0 ) + { + DBG_CTOR( EE_TextPortion, 0 ); + } + + TextPortion( const TextPortion& r ) + : pExtraInfos( NULL ) + , nLen( r.nLen ) + , aOutSz( r.aOutSz ) + , nKind( r.nKind ) + , nRightToLeft( r.nRightToLeft ) + , nExtraValue( r.nExtraValue ) + { + DBG_CTOR( EE_TextPortion, 0 ); + } ~TextPortion() { DBG_DTOR( EE_TextPortion, 0 ); delete pExtraInfos; } @@ -716,8 +739,10 @@ private: public: DeletedNodeInfo( sal_uIntPtr nInvAdr, sal_Int32 nPos ) - { nInvalidAdressPtr = nInvAdr; - nInvalidParagraph = nPos; } + : nInvalidAdressPtr(nInvAdr) + , nInvalidParagraph(nPos) + { + } sal_uIntPtr GetInvalidAdress() const { return nInvalidAdressPtr; } sal_Int32 GetPosition() const { return nInvalidParagraph; } -- cgit