Token: inline some functions

This commit is contained in:
Benjamin Kramer 2009-08-22 22:10:03 +02:00
parent 0d6b6e840d
commit 18696679e3
2 changed files with 15 additions and 90 deletions

View File

@ -488,21 +488,6 @@ bool Token::Match(const Token *tok, const char pattern[], unsigned int varid)
return true; return true;
} }
bool Token::isName() const
{
return _isName;
}
bool Token::isNumber() const
{
return _isNumber;
}
bool Token::isBoolean() const
{
return _isBoolean;
}
bool Token::isStandardType() const bool Token::isStandardType() const
{ {
bool ret = false; bool ret = false;
@ -524,36 +509,6 @@ const Token *Token::findmatch(const Token *tok, const char pattern[], unsigned i
return 0; return 0;
} }
unsigned int Token::varId() const
{
return _varId;
}
void Token::varId(unsigned int id)
{
_varId = id;
}
Token *Token::next() const
{
return _next;
}
void Token::next(Token *next)
{
_next = next;
}
Token *Token::previous() const
{
return _previous;
}
void Token::previous(Token *previous)
{
_previous = previous;
}
void Token::insertToken(const char str[]) void Token::insertToken(const char str[])
{ {
Token *newToken = new Token; Token *newToken = new Token;
@ -581,36 +536,6 @@ void Token::eraseTokens(Token *begin, const Token *end)
} }
} }
unsigned int Token::fileIndex() const
{
return _fileIndex;
}
void Token::fileIndex(unsigned int fileIndex)
{
_fileIndex = fileIndex;
}
unsigned int Token::linenr() const
{
return _linenr;
}
void Token::linenr(unsigned int linenr)
{
_linenr = linenr;
}
void Token::link(Token *link)
{
_link = link;
}
Token *Token::link() const
{
return _link;
}
void Token::createMutualLinks(Token *begin, Token *end) void Token::createMutualLinks(Token *begin, Token *end)
{ {
assert(begin != NULL); assert(begin != NULL);

View File

@ -117,9 +117,9 @@ public:
*/ */
static bool Match(const Token *tok, const char pattern[], unsigned int varid = 0); static bool Match(const Token *tok, const char pattern[], unsigned int varid = 0);
bool isName() const; bool isName() const { return _isName; }
bool isNumber() const; bool isNumber() const { return _isNumber; }
bool isBoolean() const; bool isBoolean() const { return _isBoolean; }
bool isStandardType() const; bool isStandardType() const;
static const Token *findmatch(const Token *tok, const char pattern[], unsigned int varId = 0); static const Token *findmatch(const Token *tok, const char pattern[], unsigned int varId = 0);
@ -139,13 +139,13 @@ public:
*/ */
static int multiCompare(const char *haystack, const char *needle); static int multiCompare(const char *haystack, const char *needle);
unsigned int linenr() const; unsigned int linenr() const { return _linenr; }
void linenr(unsigned int linenr); void linenr(unsigned int linenr) { _linenr = linenr; }
unsigned int fileIndex() const; unsigned int fileIndex() const { return _fileIndex; }
void fileIndex(unsigned int fileIndex); void fileIndex(unsigned int fileIndex) { _fileIndex = fileIndex; }
Token *next() const; Token *next() const { return _next; }
/** /**
@ -164,11 +164,11 @@ public:
*/ */
void insertToken(const char str[]); void insertToken(const char str[]);
Token *previous() const; Token *previous() const { return _previous; }
unsigned int varId() const; unsigned int varId() const { return _varId; }
void varId(unsigned int id); void varId(unsigned int id) { _varId = id; }
/** /**
* For debugging purposes, prints token and all tokens * For debugging purposes, prints token and all tokens
@ -202,7 +202,7 @@ public:
* @param link The token where this token should link * @param link The token where this token should link
* to. * to.
*/ */
void link(Token *link); void link(Token *link) { _link = link; }
/** /**
* Return token where this token links to. * Return token where this token links to.
@ -211,7 +211,7 @@ public:
* *
* @return The token where this token links to. * @return The token where this token links to.
*/ */
Token *link() const; Token *link() const { return _link; }
/** /**
* Links two elements against each other. * Links two elements against each other.
@ -219,8 +219,8 @@ public:
static void createMutualLinks(Token *begin, Token *end); static void createMutualLinks(Token *begin, Token *end);
private: private:
void next(Token *next); void next(Token *next) { _next = next; }
void previous(Token *previous); void previous(Token *previous) { _previous = previous; }
/** /**
* Works almost like strcmp() except returns only 0 or 1 and * Works almost like strcmp() except returns only 0 or 1 and