mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 10:32:57 +01:00
fixes for C++11/14
This commit is contained in:
parent
d39042ba77
commit
450089d5e6
@ -40,7 +40,12 @@ public:
|
||||
typedef std::vector<EnumValue*> Values;
|
||||
typedef Values::const_iterator Iterator;
|
||||
|
||||
Enum(const std::string& name, NameSpace* pNameSpace);
|
||||
enum Flags
|
||||
{
|
||||
ENUM_IS_CLASS = 0x01 // C++11 enum class
|
||||
};
|
||||
|
||||
Enum(const std::string& name, NameSpace* pNameSpace, int flags = 0);
|
||||
/// Creates the Enum.
|
||||
///
|
||||
/// If name is the empty string, an internal name
|
||||
@ -59,6 +64,8 @@ public:
|
||||
Iterator end() const;
|
||||
/// Returns an iterator for iterating over the Enum's EnumValue's.
|
||||
|
||||
int flags() const;
|
||||
|
||||
Symbol::Kind kind() const;
|
||||
std::string toString() const;
|
||||
|
||||
@ -67,10 +74,20 @@ protected:
|
||||
|
||||
private:
|
||||
Values _values;
|
||||
int _flags;
|
||||
static int _count;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline int Enum::flags() const
|
||||
{
|
||||
return _flags;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::CppParser
|
||||
|
||||
|
||||
|
@ -28,8 +28,9 @@ namespace CppParser {
|
||||
int Enum::_count = 0;
|
||||
|
||||
|
||||
Enum::Enum(const std::string& name, NameSpace* pNameSpace):
|
||||
Symbol(processName(name), pNameSpace)
|
||||
Enum::Enum(const std::string& name, NameSpace* pNameSpace, int flags):
|
||||
Symbol(processName(name), pNameSpace),
|
||||
_flags(flags)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -287,6 +287,7 @@ const Token* Parser::parseClass(const Token* pNext, std::string& decl)
|
||||
else
|
||||
syntaxError("class/struct name");
|
||||
pNext = next();
|
||||
|
||||
bool isFinal = false;
|
||||
if (isIdentifier(pNext) && pNext->asString() == "final")
|
||||
{
|
||||
@ -398,6 +399,9 @@ const Token* Parser::parseClassMembers(const Token* pNext, Struct* /*pClass*/)
|
||||
case IdentifierToken::KW_TYPEDEF:
|
||||
pNext = parseTypeDef(pNext);
|
||||
break;
|
||||
case IdentifierToken::KW_USING:
|
||||
pNext = parseUsing(pNext);
|
||||
break;
|
||||
case IdentifierToken::KW_ENUM:
|
||||
pNext = parseEnum(pNext);
|
||||
break;
|
||||
@ -463,6 +467,8 @@ const Token* Parser::parseTemplateArgs(const Token* pNext, std::string& decl)
|
||||
++depth;
|
||||
else if (isOperator(pNext, OperatorToken::OP_GT))
|
||||
--depth;
|
||||
else if (isOperator(pNext, OperatorToken::OP_SHR))
|
||||
depth -= 2;
|
||||
pNext = next();
|
||||
}
|
||||
return pNext;
|
||||
@ -483,6 +489,7 @@ const Token* Parser::parseTypeDef(const Token* pNext)
|
||||
}
|
||||
TypeDef* pTypeDef = new TypeDef(decl, currentNameSpace());
|
||||
addSymbol(pTypeDef, line);
|
||||
|
||||
pNext = next();
|
||||
_pCurrentSymbol = 0;
|
||||
return pNext;
|
||||
@ -762,6 +769,8 @@ const Token* Parser::parseParameters(const Token* pNext, Function* pFunc)
|
||||
++tdepth;
|
||||
else if (isOperator(pNext, OperatorToken::OP_GT))
|
||||
--tdepth;
|
||||
else if (isOperator(pNext, OperatorToken::OP_SHR))
|
||||
tdepth -= 2;
|
||||
pNext = next();
|
||||
}
|
||||
if (isOperator(pNext, OperatorToken::OP_COMMA))
|
||||
@ -795,9 +804,17 @@ const Token* Parser::parseEnum(const Token* pNext)
|
||||
{
|
||||
poco_assert (isKeyword(pNext, IdentifierToken::KW_ENUM));
|
||||
|
||||
int flags = 0;
|
||||
_pCurrentSymbol = 0;
|
||||
int line = _istr.getCurrentLineNumber();
|
||||
pNext = next();
|
||||
|
||||
if (isKeyword(pNext, IdentifierToken::KW_CLASS))
|
||||
{
|
||||
flags = Enum::ENUM_IS_CLASS;
|
||||
pNext = next();
|
||||
}
|
||||
|
||||
std::string name;
|
||||
if (pNext->is(Token::IDENTIFIER_TOKEN))
|
||||
{
|
||||
@ -805,7 +822,7 @@ const Token* Parser::parseEnum(const Token* pNext)
|
||||
pNext = next();
|
||||
}
|
||||
expectOperator(pNext, OperatorToken::OP_OPENBRACE, "{");
|
||||
Enum* pEnum = new Enum(name, currentNameSpace());
|
||||
Enum* pEnum = new Enum(name, currentNameSpace(), flags);
|
||||
addSymbol(pEnum, line);
|
||||
pNext = next();
|
||||
while (pNext->is(Token::IDENTIFIER_TOKEN))
|
||||
|
@ -80,6 +80,7 @@ std::string TypeAlias::baseType() const
|
||||
std::string::size_type pos = 0;
|
||||
while (pos < decl.size() && std::isspace(decl[pos])) pos++;
|
||||
while (pos < decl.size() && decl[pos] != '=') pos++;
|
||||
if (pos < decl.size() && decl[pos] == '=') pos++;
|
||||
decl.erase(0, pos);
|
||||
Poco::trimInPlace(decl);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user