From: Daniel Karbach Date: Sun, 26 Aug 2012 14:33:14 +0000 (+0200) Subject: made tokenizer and token constructors explicit X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=996552758ec3bc748081b65b26b4a61bcd619324;p=l2e.git made tokenizer and token constructors explicit --- diff --git a/src/loader/Tokenizer.cpp b/src/loader/Tokenizer.cpp index 5f74d74..76a3a14 100644 --- a/src/loader/Tokenizer.cpp +++ b/src/loader/Tokenizer.cpp @@ -47,7 +47,7 @@ Tokenizer::Token Tokenizer::ReadToken() { case Token::COMMA: case Token::BRACKET_OPEN: case Token::BRACKET_CLOSE: - return (Token::Type) c; + return Token ((Token::Type) c); case '+': case '-': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': diff --git a/src/loader/Tokenizer.h b/src/loader/Tokenizer.h index 7a776a4..15eadf8 100644 --- a/src/loader/Tokenizer.h +++ b/src/loader/Tokenizer.h @@ -17,7 +17,7 @@ namespace loader { class Tokenizer { public: - Tokenizer(std::istream &in) : in(in), isPutback(false) { } + explicit Tokenizer(std::istream &in) : in(in), isPutback(false) { } ~Tokenizer() { } private: Tokenizer(const Tokenizer &); @@ -47,7 +47,7 @@ public: }; Token() : type(UNKNOWN), number(0) { } - Token(Type t) : type(t), number(0) { } + explicit Token(Type t) : type(t), number(0) { } Type type; std::string str; @@ -114,7 +114,7 @@ inline const char *TokenTypeToString(Tokenizer::Token::Type t) { } } -std::ostream &operator <<(std::ostream &out, Tokenizer::Token::Type t) { +inline std::ostream &operator <<(std::ostream &out, Tokenizer::Token::Type t) { out << TokenTypeToString(t); return out; }