starmath/inc/parse.hxx | 5 +++-- starmath/source/parse.cxx | 16 ++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-)
New commits: commit ce3c818e8977561e6fbf11fe62997f29ae918521 Author: Takeshi Abe <[email protected]> Date: Thu Sep 24 13:12:36 2015 +0900 starmath: tdf#93240 replace boost::ptr_vector with std::vector<std::unique_ptr> Change-Id: I72f96b08273c73cbd11c7796c34a45b262325209 Reviewed-on: https://gerrit.libreoffice.org/18820 Reviewed-by: Michael Stahl <[email protected]> Tested-by: Michael Stahl <[email protected]> diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index f44f379..0ae01ef 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -20,8 +20,9 @@ #define INCLUDED_STARMATH_INC_PARSE_HXX #include <vcl/svapp.hxx> +#include <memory> #include <set> -#include <boost/ptr_container/ptr_vector.hpp> +#include <vector> #include "types.hxx" #include "token.hxx" @@ -33,7 +34,7 @@ class SmParser OUString m_aBufferString; SmToken m_aCurToken; SmNodeStack m_aNodeStack; - boost::ptr_vector< SmErrorDesc > m_aErrDescList; + std::vector<std::unique_ptr<SmErrorDesc>> m_aErrDescList; int m_nCurError; LanguageType m_nLang; sal_Int32 m_nBufferIndex, diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 47ad4c6..0c0de52 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -2417,7 +2417,7 @@ SmNode *SmParser::ParseExpression(const OUString &rBuffer) size_t SmParser::AddError(SmParseError Type, SmNode *pNode) { - SmErrorDesc *pErrDesc = new SmErrorDesc; + std::unique_ptr<SmErrorDesc> pErrDesc(new SmErrorDesc); pErrDesc->m_eType = Type; pErrDesc->m_pNode = pNode; @@ -2445,7 +2445,7 @@ size_t SmParser::AddError(SmParseError Type, SmNode *pNode) } pErrDesc->m_aText += SM_RESSTR(nRID); - m_aErrDescList.push_back( pErrDesc ); + m_aErrDescList.push_back(std::move(pErrDesc)); return m_aErrDescList.size()-1; } @@ -2454,11 +2454,11 @@ size_t SmParser::AddError(SmParseError Type, SmNode *pNode) const SmErrorDesc *SmParser::NextError() { if ( !m_aErrDescList.empty() ) - if (m_nCurError > 0) return &m_aErrDescList[ --m_nCurError ]; + if (m_nCurError > 0) return m_aErrDescList[ --m_nCurError ].get(); else { m_nCurError = 0; - return &m_aErrDescList[ m_nCurError ]; + return m_aErrDescList[ m_nCurError ].get(); } else return NULL; } @@ -2467,11 +2467,11 @@ const SmErrorDesc *SmParser::NextError() const SmErrorDesc *SmParser::PrevError() { if ( !m_aErrDescList.empty() ) - if (m_nCurError < (int) (m_aErrDescList.size() - 1)) return &m_aErrDescList[ ++m_nCurError ]; + if (m_nCurError < (int) (m_aErrDescList.size() - 1)) return m_aErrDescList[ ++m_nCurError ].get(); else { m_nCurError = (int) (m_aErrDescList.size() - 1); - return &m_aErrDescList[ m_nCurError ]; + return m_aErrDescList[ m_nCurError ].get(); } else return NULL; } @@ -2480,10 +2480,10 @@ const SmErrorDesc *SmParser::PrevError() const SmErrorDesc *SmParser::GetError(size_t i) { if ( i < m_aErrDescList.size() ) - return &m_aErrDescList[ i ]; + return m_aErrDescList[ i ].get(); if ( (size_t)m_nCurError < m_aErrDescList.size() ) - return &m_aErrDescList[ m_nCurError ]; + return m_aErrDescList[ m_nCurError ].get(); return NULL; } _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
