Browse Source

Moved the native AST declarations to their own namespace.

pull/86/head
triton 12 years ago
parent
commit
b3f41256e3
  1. 8
      src/CppParser/AST.cpp
  2. 48
      src/CppParser/AST.h
  3. 6
      src/CppParser/CppParser.h

8
src/CppParser/AST.cpp

@ -27,7 +27,7 @@ static std::vector<T> split(const T & str, const T & delimiters) { @@ -27,7 +27,7 @@ static std::vector<T> split(const T & str, const T & delimiters) {
return v;
}
namespace CppSharp { namespace CppParser {
namespace CppSharp { namespace CppParser { namespace AST {
Declaration* DeclarationContext::FindAnonymous(uint64_t key)
{
@ -51,7 +51,7 @@ DeclarationContext::FindNamespace(const std::vector<std::string>& Namespaces) @@ -51,7 +51,7 @@ DeclarationContext::FindNamespace(const std::vector<std::string>& Namespaces)
auto childNamespace = std::find_if(currentNamespace->Namespaces.begin(),
currentNamespace->Namespaces.end(),
[&](CppSharp::CppParser::Namespace* ns) {
[&](CppSharp::CppParser::AST::Namespace* ns) {
return ns->Name == _namespace;
});
@ -61,7 +61,7 @@ DeclarationContext::FindNamespace(const std::vector<std::string>& Namespaces) @@ -61,7 +61,7 @@ DeclarationContext::FindNamespace(const std::vector<std::string>& Namespaces)
currentNamespace = *childNamespace;
}
return (CppSharp::CppParser::Namespace*) currentNamespace;
return (CppSharp::CppParser::AST::Namespace*) currentNamespace;
}
Namespace* DeclarationContext::FindCreateNamespace(const std::string& Name)
@ -257,4 +257,4 @@ NativeLibrary* Library::FindOrCreateLibrary(const std::string& File) @@ -257,4 +257,4 @@ NativeLibrary* Library::FindOrCreateLibrary(const std::string& File)
return lib;
}
} }
} } }

48
src/CppParser/AST.h

@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
#define CS_API
#endif
namespace CppSharp { namespace CppParser {
namespace CppSharp { namespace CppParser { namespace AST {
// Types
@ -38,7 +38,7 @@ struct CS_API TypeQualifiers @@ -38,7 +38,7 @@ struct CS_API TypeQualifiers
struct CS_API QualifiedType
{
CppSharp::CppParser::Type* Type;
CppSharp::CppParser::AST::Type* Type;
TypeQualifiers Qualifiers;
};
@ -46,7 +46,7 @@ struct Declaration; @@ -46,7 +46,7 @@ struct Declaration;
struct CS_API TagType : public Type
{
CppSharp::CppParser::Declaration* Declaration;
CppSharp::CppParser::AST::Declaration* Declaration;
};
struct CS_API ArrayType : public Type
@ -59,7 +59,7 @@ struct CS_API ArrayType : public Type @@ -59,7 +59,7 @@ struct CS_API ArrayType : public Type
Incomplete
};
CppSharp::CppParser::QualifiedType QualifiedType;
CppSharp::CppParser::AST::QualifiedType QualifiedType;
ArraySize SizeType;
long Size;
};
@ -80,7 +80,7 @@ struct CS_API FunctionType : public Type @@ -80,7 +80,7 @@ struct CS_API FunctionType : public Type
{
QualifiedType ReturnType;
std::vector<Parameter*> Parameters;
CppSharp::CppParser::CallingConvention CallingConvention;
CppSharp::CppParser::AST::CallingConvention CallingConvention;
};
struct CS_API PointerType : public Type
@ -132,7 +132,7 @@ struct CS_API TemplateArgument @@ -132,7 +132,7 @@ struct CS_API TemplateArgument
ArgumentKind Kind;
QualifiedType Type;
CppSharp::CppParser::Declaration* Declaration;
CppSharp::CppParser::AST::Declaration* Declaration;
long Integral;
};
@ -141,7 +141,7 @@ struct Template; @@ -141,7 +141,7 @@ struct Template;
struct CS_API TemplateSpecializationType : public Type
{
std::vector<TemplateArgument> Arguments;
CppSharp::CppParser::Template* Template;
CppSharp::CppParser::AST::Template* Template;
Type* Desugared;
};
@ -165,7 +165,7 @@ struct Class; @@ -165,7 +165,7 @@ struct Class;
struct CS_API InjectedClassNameType : public Type
{
TemplateSpecializationType TemplateSpecialization;
CppSharp::CppParser::Class* Class;
CppSharp::CppParser::AST::Class* Class;
};
struct CS_API DependentNameType : public Type
@ -220,7 +220,7 @@ struct CS_API RawComment @@ -220,7 +220,7 @@ struct CS_API RawComment
RawCommentKind Kind;
std::string Text;
std::string BriefText;
CppSharp::CppParser::FullComment* FullComment;
CppSharp::CppParser::AST::FullComment* FullComment;
};
// Class layouts
@ -241,7 +241,7 @@ struct CS_API VTableComponent @@ -241,7 +241,7 @@ struct CS_API VTableComponent
{
VTableComponentKind Kind;
unsigned Offset;
CppSharp::CppParser::Declaration* Declaration;
CppSharp::CppParser::AST::Declaration* Declaration;
};
struct CS_API VTableLayout
@ -325,9 +325,9 @@ struct CS_API DeclarationContext : public Declaration @@ -325,9 +325,9 @@ struct CS_API DeclarationContext : public Declaration
{
Declaration* FindAnonymous(uint64_t key);
CppSharp::CppParser::Namespace* FindNamespace(const std::string& Name);
CppSharp::CppParser::Namespace* FindNamespace(const std::vector<std::string>&);
CppSharp::CppParser::Namespace* FindCreateNamespace(const std::string& Name);
CppSharp::CppParser::AST::Namespace* FindNamespace(const std::string& Name);
CppSharp::CppParser::AST::Namespace* FindNamespace(const std::vector<std::string>&);
CppSharp::CppParser::AST::Namespace* FindCreateNamespace(const std::string& Name);
Class* CreateClass(std::string Name, bool IsComplete);
Class* FindClass(const std::string& Name);
@ -340,7 +340,7 @@ struct CS_API DeclarationContext : public Declaration @@ -340,7 +340,7 @@ struct CS_API DeclarationContext : public Declaration
TypedefDecl* FindTypedef(const std::string& Name, bool Create = false);
std::vector<CppSharp::CppParser::Namespace*> Namespaces;
std::vector<CppSharp::CppParser::AST::Namespace*> Namespaces;
std::vector<Enumeration*> Enums;
std::vector<Function*> Functions;
std::vector<Class*> Classes;
@ -352,14 +352,14 @@ struct CS_API DeclarationContext : public Declaration @@ -352,14 +352,14 @@ struct CS_API DeclarationContext : public Declaration
struct CS_API TypedefDecl : public Declaration
{
CppSharp::CppParser::QualifiedType QualifiedType;
CppSharp::CppParser::AST::QualifiedType QualifiedType;
};
struct CS_API Parameter : public Declaration
{
Parameter() : IsIndirect(false) {}
CppSharp::CppParser::QualifiedType QualifiedType;
CppSharp::CppParser::AST::QualifiedType QualifiedType;
bool IsIndirect;
bool HasDefaultValue;
};
@ -436,7 +436,7 @@ struct CS_API Function : public Declaration @@ -436,7 +436,7 @@ struct CS_API Function : public Declaration
CXXOperatorKind OperatorKind;
std::string Mangled;
std::string Signature;
CppSharp::CppParser::CallingConvention CallingConvention;
CppSharp::CppParser::AST::CallingConvention CallingConvention;
std::vector<Parameter*> Parameters;
};
@ -477,32 +477,32 @@ struct CS_API Enumeration : public Declaration @@ -477,32 +477,32 @@ struct CS_API Enumeration : public Declaration
};
EnumModifiers Modifiers;
CppSharp::CppParser::Type* Type;
CppSharp::CppParser::BuiltinType* BuiltinType;
CppSharp::CppParser::AST::Type* Type;
CppSharp::CppParser::AST::BuiltinType* BuiltinType;
std::vector<Item> Items;
};
struct CS_API Variable : public Declaration
{
std::string Mangled;
CppSharp::CppParser::QualifiedType QualifiedType;
CppSharp::CppParser::AST::QualifiedType QualifiedType;
};
struct CS_API BaseClassSpecifier
{
AccessSpecifier Access;
bool IsVirtual;
CppSharp::CppParser::Type* Type;
CppSharp::CppParser::AST::Type* Type;
};
struct Class;
struct CS_API Field : public Declaration
{
CppSharp::CppParser::QualifiedType QualifiedType;
CppSharp::CppParser::AST::QualifiedType QualifiedType;
AccessSpecifier Access;
unsigned Offset;
CppSharp::CppParser::Class* Class;
CppSharp::CppParser::AST::Class* Class;
};
@ -598,4 +598,4 @@ struct CS_API Library @@ -598,4 +598,4 @@ struct CS_API Library
std::vector<NativeLibrary*> Libraries;
};
} }
} } }

6
src/CppParser/CppParser.h

@ -11,6 +11,8 @@ @@ -11,6 +11,8 @@
namespace CppSharp { namespace CppParser {
using namespace CppSharp::CppParser::AST;
struct CS_API ParserOptions
{
ParserOptions()
@ -29,7 +31,7 @@ struct CS_API ParserOptions @@ -29,7 +31,7 @@ struct CS_API ParserOptions
// C/C++ header file name.
std::string FileName;
CppSharp::CppParser::Library* Library;
CppSharp::CppParser::AST::Library* Library;
int ToolSetToUse;
std::string TargetTriple;
@ -70,7 +72,7 @@ enum struct ParserResultKind @@ -70,7 +72,7 @@ enum struct ParserResultKind
struct CS_API ParserResult
{
ParserResultKind Kind;
CppSharp::CppParser::Library* Library;
CppSharp::CppParser::AST::Library* Library;
std::vector<ParserDiagnostic> Diagnostics;
};

Loading…
Cancel
Save