summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-02-14 12:53:43 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-02-14 14:22:24 +0200
commit52305b662033ebbac6e09aa66622f7eef2bfccae (patch)
treed25c90e302557323ca821a45b3c13513752e2aa9 /svtools
parent5a5940858e1f860101c5cb74921e44f2917b37c8 (diff)
convert SvParserState to scoped enum
and drop unused WAITFORDATA enumerator Change-Id: I658802d88a19dcc2d378456375810454e7426447
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/svhtml/parhtml.cxx28
-rw-r--r--svtools/source/svrtf/parrtf.cxx28
-rw-r--r--svtools/source/svrtf/svparser.cxx28
3 files changed, 40 insertions, 44 deletions
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index c09ecc59c58c..9df8ceaa796e 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -273,7 +273,7 @@ HTMLParser::~HTMLParser()
SvParserState HTMLParser::CallParser()
{
- eState = SVPAR_WORKING;
+ eState = SvParserState::Working;
nNextCh = GetNextChar();
SaveState( 0 );
@@ -282,7 +282,7 @@ SvParserState HTMLParser::CallParser()
AddFirstRef();
Continue( 0 );
- if( SVPAR_PENDING != eState )
+ if( SvParserState::Pending != eState )
ReleaseRef(); // Parser not needed anymore
return eState;
@@ -607,7 +607,7 @@ int HTMLParser::ScanText( const sal_Unicode cBreak )
if( cChar )
sTmpBuffer.appendUtf32( cChar );
}
- else if( SVPAR_PENDING==eState && '>'!=cBreak )
+ else if( SvParserState::Pending==eState && '>'!=cBreak )
{
// Restart with '&', the remainder is returned as
// text token.
@@ -1080,7 +1080,7 @@ int HTMLParser::GetNextToken_()
if( !IsParserWorking() )
{
- if( SVPAR_PENDING == eState )
+ if( SvParserState::Pending == eState )
bReadNextChar = bReadNextCharSave;
break;
}
@@ -1188,7 +1188,7 @@ int HTMLParser::GetNextToken_()
break;
}
}
- if( SVPAR_PENDING == eState )
+ if( SvParserState::Pending == eState )
bReadNextChar = bReadNextCharSave;
}
else
@@ -1212,7 +1212,7 @@ int HTMLParser::GetNextToken_()
bNextCh = false;
break;
}
- if( SVPAR_PENDING == eState )
+ if( SvParserState::Pending == eState )
bReadNextChar = bReadNextCharSave;
aToken.clear();
}
@@ -1299,7 +1299,7 @@ int HTMLParser::GetNextToken_()
case sal_Unicode(EOF):
if( rInput.IsEof() )
{
- eState = SVPAR_ACCEPTED;
+ eState = SvParserState::Accepted;
nRet = nNextCh;
}
else
@@ -1346,28 +1346,28 @@ scan_text:
bNextCh = 0 == aToken.getLength();
// the text should be processed
- if( !bNextCh && eState == SVPAR_PENDING )
+ if( !bNextCh && eState == SvParserState::Pending )
{
- eState = SVPAR_WORKING;
+ eState = SvParserState::Working;
bReadNextChar = true;
}
break;
}
- if( bNextCh && SVPAR_WORKING == eState )
+ if( bNextCh && SvParserState::Working == eState )
{
nNextCh = GetNextChar();
- if( SVPAR_PENDING == eState && nRet && HTML_TEXTTOKEN != nRet )
+ if( SvParserState::Pending == eState && nRet && HTML_TEXTTOKEN != nRet )
{
bReadNextChar = true;
- eState = SVPAR_WORKING;
+ eState = SvParserState::Working;
}
}
- } while( !nRet && SVPAR_WORKING == eState );
+ } while( !nRet && SvParserState::Working == eState );
- if( SVPAR_PENDING == eState )
+ if( SvParserState::Pending == eState )
nRet = -1; // s.th. invalid
return nRet;
diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx
index d65868cf396b..b822146f8b2d 100644
--- a/svtools/source/svrtf/parrtf.cxx
+++ b/svtools/source/svrtf/parrtf.cxx
@@ -208,10 +208,10 @@ int SvRTFParser::GetNextToken_()
break;
}
}
- else if( SVPAR_PENDING != eState )
+ else if( SvParserState::Pending != eState )
{
// Bug 34631 - "\ " read on - Blank as character
- // eState = SVPAR_ERROR;
+ // eState = SvParserState::Error;
bNextCh = false;
}
break;
@@ -220,7 +220,7 @@ int SvRTFParser::GetNextToken_()
break;
case sal_Unicode(EOF):
- eState = SVPAR_ACCEPTED;
+ eState = SvParserState::Accepted;
nRet = nNextCh;
break;
@@ -278,7 +278,7 @@ int SvRTFParser::GetNextToken_()
if( bNextCh )
nNextCh = GetNextChar();
- } while( !nRet && SVPAR_WORKING == eState );
+ } while( !nRet && SvParserState::Working == eState );
return nRet;
}
@@ -467,7 +467,7 @@ void SvRTFParser::ScanText()
break;
case sal_Unicode(EOF):
- eState = SVPAR_ERROR;
+ eState = SvParserState::Error;
SAL_FALLTHROUGH;
case '{':
case '}':
@@ -547,8 +547,8 @@ _inSkipGroup++;
}
} while (sal_Unicode(EOF) != nNextCh && IsParserWorking());
- if( SVPAR_PENDING != eState && '}' != nNextCh )
- eState = SVPAR_ERROR;
+ if( SvParserState::Pending != eState && '}' != nNextCh )
+ eState = SvParserState::Error;
_inSkipGroup--;
}
@@ -561,7 +561,7 @@ SvParserState SvRTFParser::CallParser()
sal_Char cFirstCh;
nNextChPos = rInput.Tell();
rInput.ReadChar( cFirstCh ); nNextCh = cFirstCh;
- eState = SVPAR_WORKING;
+ eState = SvParserState::Working;
nOpenBrakets = 0;
SetSrcEncoding( eCodeSet = RTL_TEXTENCODING_MS_1252 );
@@ -570,11 +570,11 @@ SvParserState SvRTFParser::CallParser()
{
AddFirstRef();
Continue( 0 );
- if( SVPAR_PENDING != eState )
+ if( SvParserState::Pending != eState )
ReleaseRef(); // now parser is not needed anymore
}
else
- eState = SVPAR_ERROR;
+ eState = SvParserState::Error;
return eState;
}
@@ -595,7 +595,7 @@ void SvRTFParser::Continue( int nToken )
case '}':
if( nOpenBrakets )
goto NEXTTOKEN;
- eState = SVPAR_ACCEPTED;
+ eState = SvParserState::Accepted;
break;
case '{':
@@ -611,7 +611,7 @@ void SvRTFParser::Continue( int nToken )
ReadUnknownData();
nToken = GetNextToken();
if( '}' != nToken )
- eState = SVPAR_ERROR;
+ eState = SvParserState::Error;
break; // move to next token!!
}
}
@@ -646,8 +646,8 @@ NEXTTOKEN:
// continue with new token!
nToken = GetNextToken();
}
- if( SVPAR_ACCEPTED == eState && 0 < nOpenBrakets )
- eState = SVPAR_ERROR;
+ if( SvParserState::Accepted == eState && 0 < nOpenBrakets )
+ eState = SvParserState::Error;
}
void SvRTFParser::SetEncoding( rtl_TextEncoding eEnc )
diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx
index 0540e172be10..f7bb5a8551f8 100644
--- a/svtools/source/svrtf/svparser.cxx
+++ b/svtools/source/svrtf/svparser.cxx
@@ -67,7 +67,7 @@ SvParser::SvParser( SvStream& rIn, sal_uInt8 nStackSize )
, pImplData( nullptr )
, nTokenValue( 0 )
, bTokenHasValue( false )
- , eState( SVPAR_NOTSTARTED )
+ , eState( SvParserState::NotStarted )
, eSrcEnc( RTL_TEXTENCODING_DONTKNOW )
, nNextChPos(0)
, nNextCh(0)
@@ -77,7 +77,7 @@ SvParser::SvParser( SvStream& rIn, sal_uInt8 nStackSize )
, nTokenStackSize( nStackSize )
, nTokenStackPos( 0 )
{
- eState = SVPAR_NOTSTARTED;
+ eState = SvParserState::NotStarted;
if( nTokenStackSize < 3 )
nTokenStackSize = 3;
pTokenStack = new TokenStackType[ nTokenStackSize ];
@@ -397,7 +397,7 @@ sal_uInt32 SvParser::GetNextChar()
{
if( ERRCODE_IO_PENDING == rInput.GetError() )
{
- eState = SVPAR_PENDING;
+ eState = SvParserState::Pending;
return c;
}
else
@@ -426,7 +426,7 @@ int SvParser::GetNextToken()
bTokenHasValue = false;
nRet = GetNextToken_();
- if( SVPAR_PENDING == eState )
+ if( SvParserState::Pending == eState )
return nRet;
}
@@ -444,15 +444,15 @@ int SvParser::GetNextToken()
nRet = pTokenStackPos->nTokenId;
}
// no, now push actual value on stack
- else if( SVPAR_WORKING == eState )
+ else if( SvParserState::Working == eState )
{
pTokenStackPos->sToken = aToken;
pTokenStackPos->nTokenValue = nTokenValue;
pTokenStackPos->bTokenHasValue = bTokenHasValue;
pTokenStackPos->nTokenId = nRet;
}
- else if( SVPAR_ACCEPTED != eState && SVPAR_PENDING != eState )
- eState = SVPAR_ERROR; // an error occurred
+ else if( SvParserState::Accepted != eState && SvParserState::Pending != eState )
+ eState = SvParserState::Error; // an error occurred
return nRet;
}
@@ -618,8 +618,8 @@ IMPL_LINK_NOARG( SvParser, NewDataRead, LinkParamNone*, void )
{
switch( eState )
{
- case SVPAR_PENDING:
- eState = SVPAR_WORKING;
+ case SvParserState::Pending:
+ eState = SvParserState::Working;
RestoreState();
Continue( pImplData->nToken );
@@ -627,16 +627,12 @@ IMPL_LINK_NOARG( SvParser, NewDataRead, LinkParamNone*, void )
if( ERRCODE_IO_PENDING == rInput.GetError() )
rInput.ResetError();
- if( SVPAR_PENDING != eState )
+ if( SvParserState::Pending != eState )
ReleaseRef(); // ready otherwise!
break;
- case SVPAR_WAITFORDATA:
- eState = SVPAR_WORKING;
- break;
-
- case SVPAR_NOTSTARTED:
- case SVPAR_WORKING:
+ case SvParserState::NotStarted:
+ case SvParserState::Working:
break;
default: