diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-05-15 13:59:59 +0200 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-05-16 10:35:37 +0200 |
commit | 750fe9560b50e96beae79affa6a9a9791fce919c (patch) | |
tree | a8b79f71aefaad92a634d19b749349d7682047c0 | |
parent | c87c6166f7c6318367a4d34ecf8ff0c78189c71c (diff) |
sw: prefix members in SwAttrHandler::SwAttrStack
Change-Id: I64c4bfa709b6cd12793efba1d9773731fb66939d
Reviewed-on: https://gerrit.libreoffice.org/54369
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
-rw-r--r-- | sw/source/core/text/atrhndl.hxx | 17 | ||||
-rw-r--r-- | sw/source/core/text/atrstck.cxx | 54 |
2 files changed, 36 insertions, 35 deletions
diff --git a/sw/source/core/text/atrhndl.hxx b/sw/source/core/text/atrhndl.hxx index 23975bc71e04..2949206d9a22 100644 --- a/sw/source/core/text/atrhndl.hxx +++ b/sw/source/core/text/atrhndl.hxx @@ -45,22 +45,23 @@ private: class SwAttrStack { private: - SwTextAttr* pInitialArray[ INITIAL_NUM_ATTR ]; - SwTextAttr** pArray; - sal_uInt16 nCount; // number of elements on stack - sal_uInt16 nSize; // number of positions in Array + SwTextAttr* m_pInitialArray[ INITIAL_NUM_ATTR ]; + SwTextAttr** m_pArray; + sal_uInt16 m_nCount; // number of elements on stack + sal_uInt16 m_nSize; // number of positions in Array public: // Ctor, Dtor inline SwAttrStack(); ~SwAttrStack() { - if ( nSize > INITIAL_NUM_ATTR ) delete [] pArray; } + if (m_nSize > INITIAL_NUM_ATTR) delete [] m_pArray; + } // reset stack - void Reset() { nCount = 0; }; + void Reset() { m_nCount = 0; }; // insert on top - void Push( const SwTextAttr& rAttr ) { Insert( rAttr, nCount ); }; + void Push( const SwTextAttr& rAttr ) { Insert(rAttr, m_nCount); }; // insert at specified position, take care for not inserting behind // the value returned by Count() void Insert( const SwTextAttr& rAttr, const sal_uInt16 nPos ); @@ -72,7 +73,7 @@ private: const SwTextAttr* Top() const; // number of elements on stack - sal_uInt16 Count() const { return nCount; }; + sal_uInt16 Count() const { return m_nCount; }; // returns position of rAttr on Stack if found, otherwise USHRT_MAX // can be used for Remove of an attribute diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx index a252302b743a..ee43d211bd79 100644 --- a/sw/source/core/text/atrstck.cxx +++ b/sw/source/core/text/atrstck.cxx @@ -265,76 +265,76 @@ static bool lcl_ChgHyperLinkColor( const SwTextAttr& rAttr, } inline SwAttrHandler::SwAttrStack::SwAttrStack() - : nCount( 0 ), nSize( INITIAL_NUM_ATTR ) + : m_nCount( 0 ), m_nSize( INITIAL_NUM_ATTR ) { - pArray = pInitialArray; + m_pArray = m_pInitialArray; } void SwAttrHandler::SwAttrStack::Insert( const SwTextAttr& rAttr, const sal_uInt16 nPos ) { // do we still have enough space? - if ( nCount >= nSize ) + if (m_nCount >= m_nSize) { // we are still in our initial array - if ( INITIAL_NUM_ATTR == nSize ) + if (INITIAL_NUM_ATTR == m_nSize) { - nSize += STACK_INCREMENT; - pArray = new SwTextAttr*[ nSize ]; + m_nSize += STACK_INCREMENT; + m_pArray = new SwTextAttr*[ m_nSize ]; // copy from pInitArray to new Array - memcpy( pArray, pInitialArray, + memcpy( m_pArray, m_pInitialArray, INITIAL_NUM_ATTR * sizeof(SwTextAttr*) ); } // we are in new memory else { - nSize += STACK_INCREMENT; - SwTextAttr** pTmpArray = new SwTextAttr*[ nSize ]; - // copy from pArray to new Array - memcpy( pTmpArray, pArray, nCount * sizeof(SwTextAttr*) ); + m_nSize += STACK_INCREMENT; + SwTextAttr** pTmpArray = new SwTextAttr*[ m_nSize ]; + // copy from m_pArray to new Array + memcpy( pTmpArray, m_pArray, m_nCount * sizeof(SwTextAttr*) ); // free old array - delete [] pArray; - pArray = pTmpArray; + delete [] m_pArray; + m_pArray = pTmpArray; } } - OSL_ENSURE( nPos <= nCount, "wrong position for insert operation"); + OSL_ENSURE(nPos <= m_nCount, "wrong position for insert operation"); - if ( nPos < nCount ) - memmove( pArray + nPos + 1, pArray + nPos, - ( nCount - nPos ) * sizeof(SwTextAttr*) + if (nPos < m_nCount) + memmove( m_pArray + nPos + 1, m_pArray + nPos, + (m_nCount - nPos) * sizeof(SwTextAttr*) ); - pArray[ nPos ] = const_cast<SwTextAttr*>(&rAttr); + m_pArray[ nPos ] = const_cast<SwTextAttr*>(&rAttr); - nCount++; + m_nCount++; } void SwAttrHandler::SwAttrStack::Remove( const SwTextAttr& rAttr ) { sal_uInt16 nPos = Pos( rAttr ); - if ( nPos < nCount ) + if (nPos < m_nCount) { - memmove( pArray + nPos, pArray + nPos + 1, - ( nCount - 1 - nPos ) * sizeof(SwTextAttr*) + memmove( m_pArray + nPos, m_pArray + nPos + 1, + (m_nCount - 1 - nPos) * sizeof(SwTextAttr*) ); - nCount--; + m_nCount--; } } const SwTextAttr* SwAttrHandler::SwAttrStack::Top() const { - return nCount ? pArray[ nCount - 1 ] : nullptr; + return m_nCount ? m_pArray[ m_nCount - 1 ] : nullptr; } sal_uInt16 SwAttrHandler::SwAttrStack::Pos( const SwTextAttr& rAttr ) const { - if ( ! nCount ) + if ( ! m_nCount ) // empty stack return USHRT_MAX; - for ( sal_uInt16 nIdx = nCount; nIdx > 0; ) + for (sal_uInt16 nIdx = m_nCount; nIdx > 0;) { - if ( &rAttr == pArray[ --nIdx ] ) + if (&rAttr == m_pArray[ --nIdx ]) return nIdx; } |