added support for new C++11 keywords and features to CppParser and PocoDoc

This commit is contained in:
Guenter Obiltschnig
2012-11-17 10:06:20 +01:00
parent 83fd9e4a29
commit 78c69b9144
7 changed files with 157 additions and 29 deletions

View File

@@ -1,7 +1,7 @@
//
// CppToken.h
//
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/CppToken.h#1 $
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/CppToken.h#2 $
//
// Library: CppParser
// Package: CppParser
@@ -134,7 +134,9 @@ class CppParser_API IdentifierToken: public CppToken
public:
enum Keywords
{
KW_AND = 1,
KW_ALIGNAS = 1,
KW_ALIGNOF,
KW_AND,
KW_AND_EQ,
KW_ASM,
KW_AUTO,
@@ -145,11 +147,15 @@ public:
KW_CASE,
KW_CATCH,
KW_CHAR,
KW_CHAR_16T,
KW_CHAR_32T,
KW_CLASS,
KW_COMPL,
KW_CONST,
KW_CONSTEXPR,
KW_CONST_CAST,
KW_CONTINUE,
KW_DECLTYPE,
KW_DEFAULT,
KW_DELETE,
KW_DO,
@@ -172,8 +178,10 @@ public:
KW_MUTABLE,
KW_NAMESPACE,
KW_NEW,
KW_NOEXCEPT,
KW_NOT,
KW_NOT_EQ,
KW_NULLPTR,
KW_OPERATOR,
KW_OR,
KW_OR_EQ,
@@ -187,11 +195,13 @@ public:
KW_SIGNED,
KW_SIZEOF,
KW_STATIC,
KW_STATIC_ASSERT,
KW_STATIC_CAST,
KW_STRUCT,
KW_SWITCH,
KW_TEMPLATE,
KW_THIS,
KW_THREAD_LOCAL,
KW_THROW,
KW_TRUE,
KW_TRY,

View File

@@ -1,7 +1,7 @@
//
// Function.h
//
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/Function.h#1 $
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/Function.h#2 $
//
// Library: CppParser
// Package: SymbolTable
@@ -58,12 +58,17 @@ class CppParser_API Function: public Decl
public:
enum Flags
{
FN_STATIC = 1, /// The function is static.
FN_VIRTUAL = 2, /// The function is virtual.
FN_INLINE = 4, /// The function is inline.
FN_CONST = 8, /// The function is const.
FN_TEMPLATE = 16, /// The function is a template.
FN_PURE_VIRTUAL = 32 /// The function is pure virtual.
FN_STATIC = 1, /// The function is static.
FN_VIRTUAL = 2, /// The function is virtual.
FN_INLINE = 4, /// The function is inline.
FN_CONST = 8, /// The function is const.
FN_TEMPLATE = 16, /// The function is a template.
FN_PURE_VIRTUAL = 32, /// The function is pure virtual.
FN_FINAL = 64, /// The function is final.
FN_OVERRIDE = 128, /// The function is override.
FN_NOEXCEPT = 256, /// The function is noexcept.
FN_DEFAULT = 512, /// The function is default.
FN_DELETE = 1024 /// The function has been deleted.
};
typedef std::vector<Parameter*> Parameters;
@@ -94,6 +99,21 @@ public:
void makePureVirtual();
/// Sets the FN_PURE_VIRTUAL flag.
void makeFinal();
/// Sets the FN_FINAL flag.
void makeOverride();
/// Sets the FN_OVERRIDE flag.
void makeNoexcept();
/// Sets the FN_NOEXCEPT flag.
void makeDefault();
/// Sets the FN_DEFAULT flag.
void makeDelete();
/// Sets the FN_DELETE flag.
int flags() const;
/// Returns the function's flags.

View File

@@ -1,7 +1,7 @@
//
// Struct.h
//
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/Struct.h#1 $
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/Struct.h#2 $
//
// Library: CppParser
// Package: SymbolTable
@@ -61,7 +61,8 @@ public:
{
FN_TEMPLATE = 1,
FN_INLINE = 2, // when the whole class is inlined in a c++ file
FN_TEMPLATE_SPECIALIZATION = 4
FN_TEMPLATE_SPECIALIZATION = 4,
FN_FINAL = 8
};
struct Base
@@ -115,10 +116,16 @@ public:
void makeInline();
/// Changes the class to a inline class, i.e. definition and implementation are hidden in a cpp file.
void makeFinal();
/// Makes the class final.
bool isInline() const;
/// Returns true if the complete class is inlined in a cpp file.
bool isFinal() const;
/// Returns true if the class is final.
void constructors(Functions& functions) const;
/// Returns all constructors, sorted by their parameter count.
@@ -190,12 +197,24 @@ inline void Struct::makeInline()
}
inline void Struct::makeFinal()
{
_flags |= FN_FINAL;
}
inline bool Struct::isInline() const
{
return (_flags & FN_INLINE) != 0;
}
inline bool Struct::isFinal() const
{
return (_flags & FN_FINAL) != 0;
}
inline bool Struct::isDerived() const
{
return !_bases.empty();