diff options
author | Joseph Powers <jpowers27@cox.net> | 2010-12-15 05:56:53 -0800 |
---|---|---|
committer | Joseph Powers <jpowers27@cox.net> | 2010-12-15 05:57:48 -0800 |
commit | 335a249c91fb95f68f0ca8bf68e637713a915e06 (patch) | |
tree | 7b2013300c7b8d20cd81e9e90156f962b96bb493 /basic/source/app/mybasic.cxx | |
parent | f51f9bf2e5b56d19d59c535b6acc2996e082f020 (diff) |
Remove DECLARE_LIST( ErrorList, BasicError* ) correctly this time
Diffstat (limited to 'basic/source/app/mybasic.cxx')
-rw-r--r-- | basic/source/app/mybasic.cxx | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/basic/source/app/mybasic.cxx b/basic/source/app/mybasic.cxx index c5ae5e4c4a49..5c165f441058 100644 --- a/basic/source/app/mybasic.cxx +++ b/basic/source/app/mybasic.cxx @@ -79,6 +79,7 @@ SbxBase* MyFactory::Create( UINT16 nSbxId, UINT32 nCr ) MyBasic::MyBasic() : StarBASIC() { nError = 0; + CurrentError = 0; if( !nInst++ ) { AddFactory( &aFac1 ); @@ -161,7 +162,7 @@ SbTextType MyBasic::GetSymbolType( const String &rSymbol, BOOL bWasTTControl ) MyBasic::~MyBasic() { - aErrors.Clear(); + Reset(); if( !--nInst ) { RemoveFactory( &aFac1 ); @@ -172,8 +173,10 @@ MyBasic::~MyBasic() void MyBasic::Reset() { - aErrors.Clear(); + for ( size_t i = 0, n = aErrors.size(); i < n; ++i ) delete aErrors[ i ]; + aErrors.clear(); nError = 0; + CurrentError = 0; } BOOL MyBasic::Compile( SbModule* p ) @@ -182,6 +185,36 @@ BOOL MyBasic::Compile( SbModule* p ) return StarBASIC::Compile( p ); } +BasicError* MyBasic::NextError() +{ + if ( CurrentError < ( aErrors.size() - 1 ) ) + { + ++CurrentError; + return aErrors[ CurrentError ]; + } + return NULL; +} + +BasicError* MyBasic::PrevError() +{ + if ( !aErrors.empty() && CurrentError > 0 ) + { + --CurrentError; + return aErrors[ CurrentError ]; + } + return NULL; +} + +BasicError* MyBasic::FirstError() +{ + if ( !aErrors.empty() ) + { + CurrentError = 0; + return aErrors[ CurrentError ]; + } + return NULL; +} + BOOL MyBasic::ErrorHdl() { AppBasEd* pWin = aBasicApp.pFrame->FindModuleWin( GetActiveModule()->GetName() ); @@ -193,12 +226,13 @@ BOOL MyBasic::ErrorHdl() pWin->ToTop(); if( IsCompilerError() ) { - aErrors.Insert( + aErrors.push_back( new BasicError ( pWin, - 0, StarBASIC::GetErrorText(), GetLine(), GetCol1(), GetCol2() ), - LIST_APPEND ); + 0, StarBASIC::GetErrorText(), GetLine(), GetCol1(), GetCol2() ) + ); nError++; + CurrentError = aErrors.size() - 1; return BOOL( nError < 20 ); // Cancel after 20 errors } else |