Kaydet (Commit) a2762333 authored tarafından Takeshi Abe's avatar Takeshi Abe Kaydeden (comit) Caolán McNamara

fdo#75757: remove inheritance to std::vector

from ApiTokenVector.

Change-Id: Ie924e0e01db74b925a7f6063f8ce7fd952d04381
Reviewed-on: https://gerrit.libreoffice.org/11290Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 247f87bc
......@@ -263,11 +263,28 @@ typedef ::com::sun::star::uno::Sequence< ApiToken > ApiTokenSequence;
typedef ::com::sun::star::beans::Pair< ::com::sun::star::table::CellAddress, sal_Bool > ApiSpecialTokenInfo;
/** A vector of formula tokens with additional convenience functions. */
class ApiTokenVector : public ::std::vector< ApiToken >
class ApiTokenVector
{
public:
explicit ApiTokenVector();
ApiToken& operator[]( size_t i ) { return mvTokens[i]; }
size_t size() const { return mvTokens.size(); }
ApiToken& back() { return mvTokens.back(); }
const ApiToken& back() const { return mvTokens.back(); }
void clear() { mvTokens.clear(); }
void pop_back() { mvTokens.pop_back(); }
void push_back( const ApiToken& rToken ) { mvTokens.push_back( rToken ); }
void reserve( size_t n ) { mvTokens.reserve( n ); }
void resize( size_t n ) { mvTokens.resize( n ); }
/** Appends a new token with the passed op-code, returns its data field. */
::com::sun::star::uno::Any&
append( sal_Int32 nOpCode );
......@@ -275,6 +292,12 @@ public:
/** Appends a new token with the passed op-code and data. */
template< typename Type >
inline void append( sal_Int32 nOpCode, const Type& rData ) { append( nOpCode ) <<= rData; }
/** Converts to a sequence. */
ApiTokenSequence toSequence() const;
private:
::std::vector< ApiToken > mvTokens;
};
// Token sequence iterator ====================================================
......
......@@ -145,14 +145,20 @@ void BinComplexRef2d::readBiff8Data( BiffInputStream& rStrm, bool bRelativeAsOff
// token vector, sequence =====================================================
ApiTokenVector::ApiTokenVector()
: mvTokens()
{
}
Any& ApiTokenVector::append( sal_Int32 nOpCode )
{
resize( size() + 1 );
back().OpCode = nOpCode;
return back().Data;
mvTokens.resize( mvTokens.size() + 1 );
mvTokens.back().OpCode = nOpCode;
return mvTokens.back().Data;
}
ApiTokenSequence ApiTokenVector::toSequence() const
{
return ContainerHelper::vectorToSequence( mvTokens );
}
// token sequence iterator ====================================================
......
......@@ -69,7 +69,7 @@ ApiTokenSequence FormulaFinalizer::finalizeTokenArray( const ApiTokenSequence& r
const ApiToken* pToken = rTokens.getConstArray();
processTokens( pToken, pToken + rTokens.getLength() );
}
return ContainerHelper::vectorToSequence( maTokens );
return maTokens.toSequence();
}
const FunctionInfo* FormulaFinalizer::resolveBadFuncName( const OUString& ) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment