summaryrefslogtreecommitdiff
path: root/idl
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-02-05 11:17:17 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-02-07 06:51:15 +0000
commit375cc8d2bed2689571b41a8d5d80dcf58440e6e6 (patch)
treecfe474c942bf147d1a17a358b37ee8f3a8ac0bfd /idl
parent8beb3e713febf588de8dff00890b223e41f4654a (diff)
convert SVTOKEN_ENUM to scoped enum
Change-Id: Ibff607f988007728acbae96d51cbb30fd49848f6 Reviewed-on: https://gerrit.libreoffice.org/22147 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'idl')
-rw-r--r--idl/inc/lex.hxx60
-rw-r--r--idl/source/cmptools/lex.cxx40
2 files changed, 40 insertions, 60 deletions
diff --git a/idl/inc/lex.hxx b/idl/inc/lex.hxx
index d9a09182635a..a8138c835f44 100644
--- a/idl/inc/lex.hxx
+++ b/idl/inc/lex.hxx
@@ -26,18 +26,18 @@
#include <vector>
#include <memory>
-enum SVTOKEN_ENUM { SVTOKEN_EMPTY, SVTOKEN_COMMENT,
- SVTOKEN_INTEGER, SVTOKEN_STRING,
- SVTOKEN_BOOL, SVTOKEN_IDENTIFIER,
- SVTOKEN_CHAR, SVTOKEN_RTTIBASE,
- SVTOKEN_EOF, SVTOKEN_HASHID };
+enum class SVTOKENTYPE { Empty, Comment,
+ Integer, String,
+ Bool, Identifier,
+ Char, RttiBase,
+ EndOfFile, HashId };
class SvToken
{
friend class SvTokenStream;
sal_uLong nLine, nColumn;
- SVTOKEN_ENUM nType;
- OString aString;
+ SVTOKENTYPE nType;
+ OString aString;
union
{
sal_uLong nLong;
@@ -48,11 +48,6 @@ friend class SvTokenStream;
public:
SvToken();
SvToken( const SvToken & rObj );
- SvToken( sal_uLong n );
- SvToken( SVTOKEN_ENUM nTypeP, bool b );
- SvToken( char c );
- SvToken( SVTOKEN_ENUM nTypeP, const OString& rStr );
- SvToken( SVTOKEN_ENUM nTypeP );
SvToken & operator = ( const SvToken & rObj );
@@ -64,20 +59,20 @@ public:
void SetColumn( sal_uLong nColumnP ) { nColumn = nColumnP; }
sal_uLong GetColumn() const { return nColumn; }
- bool IsEmpty() const { return nType == SVTOKEN_EMPTY; }
- bool IsComment() const { return nType == SVTOKEN_COMMENT; }
- bool IsInteger() const { return nType == SVTOKEN_INTEGER; }
- bool IsString() const { return nType == SVTOKEN_STRING; }
- bool IsBool() const { return nType == SVTOKEN_BOOL; }
+ bool IsEmpty() const { return nType == SVTOKENTYPE::Empty; }
+ bool IsComment() const { return nType == SVTOKENTYPE::Comment; }
+ bool IsInteger() const { return nType == SVTOKENTYPE::Integer; }
+ bool IsString() const { return nType == SVTOKENTYPE::String; }
+ bool IsBool() const { return nType == SVTOKENTYPE::Bool; }
bool IsIdentifierHash() const
- { return nType == SVTOKEN_HASHID; }
+ { return nType == SVTOKENTYPE::HashId; }
bool IsIdentifier() const
{
- return nType == SVTOKEN_IDENTIFIER
- || nType == SVTOKEN_HASHID;
+ return nType == SVTOKENTYPE::Identifier
+ || nType == SVTOKENTYPE::HashId;
}
- bool IsChar() const { return nType == SVTOKEN_CHAR; }
- bool IsEof() const { return nType == SVTOKEN_EOF; }
+ bool IsChar() const { return nType == SVTOKENTYPE::Char; }
+ bool IsEof() const { return nType == SVTOKENTYPE::EndOfFile; }
const OString& GetString() const
{
@@ -90,9 +85,9 @@ public:
char GetChar() const { return cChar; }
void SetHash( SvStringHashEntry * pHashP )
- { pHash = pHashP; nType = SVTOKEN_HASHID; }
+ { pHash = pHashP; nType = SVTOKENTYPE::HashId; }
bool HasHash() const
- { return nType == SVTOKEN_HASHID; }
+ { return nType == SVTOKENTYPE::HashId; }
bool Is( SvStringHashEntry * pEntry ) const
{ return IsIdentifierHash() && pHash == pEntry; }
};
@@ -100,25 +95,10 @@ public:
inline SvToken::SvToken()
: nLine(0)
, nColumn(0)
- , nType( SVTOKEN_EMPTY )
+ , nType( SVTOKENTYPE::Empty )
{
}
-inline SvToken::SvToken( sal_uLong n )
- : nType( SVTOKEN_INTEGER ), nLong( n ) {}
-
-inline SvToken::SvToken( SVTOKEN_ENUM nTypeP, bool b )
- : nType( nTypeP ), bBool( b ) {}
-
-inline SvToken::SvToken( char c )
- : nType( SVTOKEN_CHAR ), cChar( c ) {}
-
-inline SvToken::SvToken( SVTOKEN_ENUM nTypeP, const OString& rStr )
- : nType( nTypeP ), aString( rStr ) {}
-
-inline SvToken::SvToken( SVTOKEN_ENUM nTypeP )
-: nType( nTypeP ) {}
-
class SvTokenStream
{
sal_uLong nLine, nColumn;
diff --git a/idl/source/cmptools/lex.cxx b/idl/source/cmptools/lex.cxx
index 85575113fda3..a4ef530d6084 100644
--- a/idl/source/cmptools/lex.cxx
+++ b/idl/source/cmptools/lex.cxx
@@ -30,31 +30,31 @@ OString SvToken::GetTokenAsString() const
OString aStr;
switch( nType )
{
- case SVTOKEN_EMPTY:
+ case SVTOKENTYPE::Empty:
break;
- case SVTOKEN_COMMENT:
+ case SVTOKENTYPE::Comment:
aStr = aString;
break;
- case SVTOKEN_INTEGER:
+ case SVTOKENTYPE::Integer:
aStr = OString::number(nLong);
break;
- case SVTOKEN_STRING:
+ case SVTOKENTYPE::String:
aStr = aString;
break;
- case SVTOKEN_BOOL:
+ case SVTOKENTYPE::Bool:
aStr = bBool ? "TRUE" : "FALSE";
break;
- case SVTOKEN_IDENTIFIER:
+ case SVTOKENTYPE::Identifier:
aStr = aString;
break;
- case SVTOKEN_CHAR:
+ case SVTOKENTYPE::Char:
aStr = OString(cChar);
break;
- case SVTOKEN_RTTIBASE:
+ case SVTOKENTYPE::RttiBase:
aStr = "RTTIBASE";
break;
- case SVTOKEN_EOF:
- case SVTOKEN_HASHID:
+ case SVTOKENTYPE::EndOfFile:
+ case SVTOKENTYPE::HashId:
break;
}
@@ -240,7 +240,7 @@ bool SvTokenStream::MakeToken( SvToken & rToken )
c = GetFastNextChar();
}
c = GetNextChar();
- rToken.nType = SVTOKEN_COMMENT;
+ rToken.nType = SVTOKENTYPE::Comment;
}
else if( '*' == c )
{
@@ -264,12 +264,12 @@ bool SvTokenStream::MakeToken( SvToken & rToken )
if( IsEof() || ( SVSTREAM_OK != rInStream.GetError() ) )
return false;
c = GetNextChar();
- rToken.nType = SVTOKEN_COMMENT;
+ rToken.nType = SVTOKENTYPE::Comment;
CalcColumn();
}
else
{
- rToken.nType = SVTOKEN_CHAR;
+ rToken.nType = SVTOKENTYPE::Char;
rToken.cChar = (char)c1;
}
}
@@ -311,12 +311,12 @@ bool SvTokenStream::MakeToken( SvToken & rToken )
}
if( IsEof() || ( SVSTREAM_OK != rInStream.GetError() ) )
return false;
- rToken.nType = SVTOKEN_STRING;
+ rToken.nType = SVTOKENTYPE::String;
rToken.aString = aStr.makeStringAndClear();
}
else if( isdigit( c ) )
{
- rToken.nType = SVTOKEN_INTEGER;
+ rToken.nType = SVTOKENTYPE::Integer;
rToken.nLong = GetNumber();
}
@@ -331,12 +331,12 @@ bool SvTokenStream::MakeToken( SvToken & rToken )
OString aStr = aBuf.makeStringAndClear();
if( aStr.equalsIgnoreAsciiCase( aStrTrue ) )
{
- rToken.nType = SVTOKEN_BOOL;
+ rToken.nType = SVTOKENTYPE::Bool;
rToken.bBool = true;
}
else if( aStr.equalsIgnoreAsciiCase( aStrFalse ) )
{
- rToken.nType = SVTOKEN_BOOL;
+ rToken.nType = SVTOKENTYPE::Bool;
rToken.bBool = false;
}
else
@@ -346,18 +346,18 @@ bool SvTokenStream::MakeToken( SvToken & rToken )
rToken.SetHash( GetIdlApp().pHashTable->Get( nHashId ) );
else
{
- rToken.nType = SVTOKEN_IDENTIFIER;
+ rToken.nType = SVTOKENTYPE::Identifier;
rToken.aString = aStr;
}
}
}
else if( IsEof() )
{
- rToken.nType = SVTOKEN_EOF;
+ rToken.nType = SVTOKENTYPE::EndOfFile;
}
else
{
- rToken.nType = SVTOKEN_CHAR;
+ rToken.nType = SVTOKENTYPE::Char;
rToken.cChar = (char)c;
c = GetFastNextChar();
}