From f0345a6617e2458000210fb6edafccf5a04eca61 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Fri, 10 Apr 2015 11:30:55 +0200 Subject: Add function for retrieving the name of a token. --- src/core/common/Token.hpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/core/common/Token.hpp') diff --git a/src/core/common/Token.hpp b/src/core/common/Token.hpp index ad36e14..ccbc84b 100644 --- a/src/core/common/Token.hpp +++ b/src/core/common/Token.hpp @@ -189,6 +189,22 @@ struct Token { */ static bool isSpecial(TokenId id) {return id > Tokens::MaxTokenId; } + /** + * Returns the name of the token -- which is either its content or the name + * of the special token (if it is one). + * + * @return the human readable name of this token instance. + */ + std::string name() const; + + /** + * Returns the name of the special token or an empty string if it is not a + * special token. + * + * @param id + */ + static const char* specialName(TokenId id); + /** * The getLocation function allows the tokens to be directly passed as * parameter to Logger or LoggableException instances. -- cgit v1.2.3