Skip to content

Commit 8d8c67d

Browse files
committed
Bind the tag kind (struct, class, enum) of a type
Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent 81493b5 commit 8d8c67d

File tree

19 files changed

+245
-25
lines changed

19 files changed

+245
-25
lines changed

src/AST/Class.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ public enum AccessSpecifier
1414
Internal
1515
}
1616

17+
public enum TagKind
18+
{
19+
Struct,
20+
Interface,
21+
Union,
22+
Class,
23+
Enum
24+
}
25+
1726
// A C++ access specifier declaration.
1827
public class AccessSpecifierDecl : Declaration
1928
{
@@ -86,6 +95,8 @@ public class Class : DeclarationContext
8695
// True if the type is to be treated as a union.
8796
public bool IsUnion;
8897

98+
public TagKind TagKind { get; set; }
99+
89100
// True if the class is final / sealed.
90101
public bool IsFinal { get; set; }
91102

src/CppParser/AST.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,7 @@ Class::Class()
740740
, isExternCContext(false)
741741
, isInjected(false)
742742
, layout(0)
743+
, tagKind(TagKind::Struct)
743744
{
744745
}
745746

src/CppParser/Bindings/CLI/Decl.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3692,6 +3692,16 @@ void CppSharp::Parser::AST::Class::IsInjected::set(bool value)
36923692
((struct ::CppSharp::CppParser::AST::Class*)NativePtr)->isInjected = value;
36933693
}
36943694

3695+
CppSharp::Parser::AST::TagKind CppSharp::Parser::AST::Class::TagKind::get()
3696+
{
3697+
return (CppSharp::Parser::AST::TagKind)((struct ::CppSharp::CppParser::AST::Class*)NativePtr)->tagKind;
3698+
}
3699+
3700+
void CppSharp::Parser::AST::Class::TagKind::set(CppSharp::Parser::AST::TagKind value)
3701+
{
3702+
((struct ::CppSharp::CppParser::AST::Class*)NativePtr)->tagKind = (enum ::CppSharp::CppParser::AST::TagKind)value;
3703+
}
3704+
36953705
CppSharp::Parser::AST::ClassLayout^ CppSharp::Parser::AST::Class::Layout::get()
36963706
{
36973707
return (((struct ::CppSharp::CppParser::AST::Class*)NativePtr)->layout == nullptr) ? nullptr : gcnew ::CppSharp::Parser::AST::ClassLayout((struct ::CppSharp::CppParser::AST::ClassLayout*)((struct ::CppSharp::CppParser::AST::Class*)NativePtr)->layout);

src/CppParser/Bindings/CLI/Decl.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ namespace CppSharp
2828
enum class RecordArgABI;
2929
enum class RefQualifierKind;
3030
enum class StatementClassObsolete;
31+
enum class TagKind;
3132
enum class TemplateSpecializationKind;
3233
enum class VTableComponentKind;
3334
ref class ASTContext;
@@ -240,6 +241,15 @@ namespace CppSharp
240241
RValue = 2
241242
};
242243

244+
public enum class TagKind
245+
{
246+
Struct = 0,
247+
Interface = 1,
248+
Union = 2,
249+
Class = 3,
250+
Enum = 4
251+
};
252+
243253
public enum class CppAbi
244254
{
245255
Itanium = 0,
@@ -1841,6 +1851,12 @@ namespace CppSharp
18411851
void set(bool);
18421852
}
18431853

1854+
property CppSharp::Parser::AST::TagKind TagKind
1855+
{
1856+
CppSharp::Parser::AST::TagKind get();
1857+
void set(CppSharp::Parser::AST::TagKind);
1858+
}
1859+
18441860
property CppSharp::Parser::AST::ClassLayout^ Layout
18451861
{
18461862
CppSharp::Parser::AST::ClassLayout^ get();

src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser-symbols.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ CppSharp::CppParser::AST::InlineContentComment& (CppSharp::CppParser::AST::Inlin
1313
extern "C" void c__N_CppSharp_N_CppParser_N_AST_S_ParagraphComment_ParagraphComment___1__N_CppSharp_N_CppParser_N_AST_S_ParagraphComment(void* __instance, const CppSharp::CppParser::AST::ParagraphComment& _0) { ::new (__instance) CppSharp::CppParser::AST::ParagraphComment(_0); }
1414
CppSharp::CppParser::AST::ParagraphComment& (CppSharp::CppParser::AST::ParagraphComment::*_5)(const CppSharp::CppParser::AST::ParagraphComment&) = &CppSharp::CppParser::AST::ParagraphComment::operator=;
1515
CppSharp::CppParser::AST::BlockCommandComment::Argument& (CppSharp::CppParser::AST::BlockCommandComment::Argument::*_6)(const CppSharp::CppParser::AST::BlockCommandComment::Argument&) = &CppSharp::CppParser::AST::BlockCommandComment::Argument::operator=;
16-
extern "C" void c__N_CppSharp_N_CppParser_N_AST_S_BlockCommandComment_S_Argument__Argument(CppSharp::CppParser::AST::BlockCommandComment::Argument*__instance) { __instance->~Argument(); }
1716
extern "C" void c__N_CppSharp_N_CppParser_N_AST_S_BlockCommandComment_BlockCommandComment___1__N_CppSharp_N_CppParser_N_AST_S_BlockCommandComment(void* __instance, const CppSharp::CppParser::AST::BlockCommandComment& _0) { ::new (__instance) CppSharp::CppParser::AST::BlockCommandComment(_0); }
1817
CppSharp::CppParser::AST::BlockCommandComment& (CppSharp::CppParser::AST::BlockCommandComment::*_7)(const CppSharp::CppParser::AST::BlockCommandComment&) = &CppSharp::CppParser::AST::BlockCommandComment::operator=;
1918
extern "C" void c__N_CppSharp_N_CppParser_N_AST_S_ParamCommandComment_ParamCommandComment___1__N_CppSharp_N_CppParser_N_AST_S_ParamCommandComment(void* __instance, const CppSharp::CppParser::AST::ParamCommandComment& _0) { ::new (__instance) CppSharp::CppParser::AST::ParamCommandComment(_0); }
@@ -31,7 +30,6 @@ extern "C" void c__N_CppSharp_N_CppParser_N_AST_S_VerbatimLineComment_VerbatimLi
3130
CppSharp::CppParser::AST::VerbatimLineComment& (CppSharp::CppParser::AST::VerbatimLineComment::*_12)(CppSharp::CppParser::AST::VerbatimLineComment&&) = &CppSharp::CppParser::AST::VerbatimLineComment::operator=;
3231
extern "C" void c__N_CppSharp_N_CppParser_N_AST_S_VerbatimLineComment__VerbatimLineComment(CppSharp::CppParser::AST::VerbatimLineComment*__instance) { __instance->~VerbatimLineComment(); }
3332
CppSharp::CppParser::AST::InlineCommandComment::Argument& (CppSharp::CppParser::AST::InlineCommandComment::Argument::*_13)(const CppSharp::CppParser::AST::InlineCommandComment::Argument&) = &CppSharp::CppParser::AST::InlineCommandComment::Argument::operator=;
34-
extern "C" void c__N_CppSharp_N_CppParser_N_AST_S_InlineCommandComment_S_Argument__Argument(CppSharp::CppParser::AST::InlineCommandComment::Argument*__instance) { __instance->~Argument(); }
3533
extern "C" void c__N_CppSharp_N_CppParser_N_AST_S_InlineCommandComment_InlineCommandComment___1__N_CppSharp_N_CppParser_N_AST_S_InlineCommandComment(void* __instance, const CppSharp::CppParser::AST::InlineCommandComment& _0) { ::new (__instance) CppSharp::CppParser::AST::InlineCommandComment(_0); }
3634
CppSharp::CppParser::AST::InlineCommandComment& (CppSharp::CppParser::AST::InlineCommandComment::*_14)(CppSharp::CppParser::AST::InlineCommandComment&&) = &CppSharp::CppParser::AST::InlineCommandComment::operator=;
3735
extern "C" void c__N_CppSharp_N_CppParser_N_AST_S_InlineCommandComment__InlineCommandComment(CppSharp::CppParser::AST::InlineCommandComment*__instance) { __instance->~InlineCommandComment(); }
@@ -377,6 +375,5 @@ CppSharp::CppParser::CppParserOptions& (CppSharp::CppParser::CppParserOptions::*
377375
extern "C" void c__N_CppSharp_N_CppParser_S_LinkerOptions_LinkerOptions___1__N_CppSharp_N_CppParser_S_LinkerOptions(void* __instance, const CppSharp::CppParser::LinkerOptions& _0) { ::new (__instance) CppSharp::CppParser::LinkerOptions(_0); }
378376
CppSharp::CppParser::LinkerOptions& (CppSharp::CppParser::LinkerOptions::*_241)(const CppSharp::CppParser::LinkerOptions&) = &CppSharp::CppParser::LinkerOptions::operator=;
379377
CppSharp::CppParser::ParserDiagnostic& (CppSharp::CppParser::ParserDiagnostic::*_242)(const CppSharp::CppParser::ParserDiagnostic&) = &CppSharp::CppParser::ParserDiagnostic::operator=;
380-
extern "C" void c__N_CppSharp_N_CppParser_S_ParserDiagnostic__ParserDiagnostic(CppSharp::CppParser::ParserDiagnostic*__instance) { __instance->~ParserDiagnostic(); }
381378
CppSharp::CppParser::ParserResult& (CppSharp::CppParser::ParserResult::*_243)(const CppSharp::CppParser::ParserResult&) = &CppSharp::CppParser::ParserResult::operator=;
382379
CppSharp::CppParser::ClangParser& (CppSharp::CppParser::ClangParser::*_244)(CppSharp::CppParser::ClangParser&&) = &CppSharp::CppParser::ClangParser::operator=;

src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6154,6 +6154,15 @@ public enum RefQualifierKind
61546154
RValue = 2
61556155
}
61566156

6157+
public enum TagKind
6158+
{
6159+
Struct = 0,
6160+
Interface = 1,
6161+
Union = 2,
6162+
Class = 3,
6163+
Enum = 4
6164+
}
6165+
61576166
public enum CppAbi
61586167
{
61596168
Itanium = 0,
@@ -11499,7 +11508,7 @@ public uint BasesCount
1149911508

1150011509
public unsafe partial class Class : global::CppSharp.Parser.AST.DeclarationContext, IDisposable
1150111510
{
11502-
[StructLayout(LayoutKind.Sequential, Size = 304)]
11511+
[StructLayout(LayoutKind.Sequential, Size = 308)]
1150311512
public new partial struct __Internal
1150411513
{
1150511514
internal global::CppSharp.Parser.AST.DeclarationKind kind;
@@ -11549,6 +11558,7 @@ public unsafe partial class Class : global::CppSharp.Parser.AST.DeclarationConte
1154911558
internal byte hasNonTrivialDestructor;
1155011559
internal byte isExternCContext;
1155111560
internal byte isInjected;
11561+
internal global::CppSharp.Parser.AST.TagKind tagKind;
1155211562
internal __IntPtr layout;
1155311563

1155411564
[SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST5ClassC2Ev", CallingConvention = __CallingConvention.Cdecl)]
@@ -11900,6 +11910,19 @@ public bool IsInjected
1190011910
}
1190111911
}
1190211912

11913+
public global::CppSharp.Parser.AST.TagKind TagKind
11914+
{
11915+
get
11916+
{
11917+
return ((__Internal*)__Instance)->tagKind;
11918+
}
11919+
11920+
set
11921+
{
11922+
((__Internal*)__Instance)->tagKind = value;
11923+
}
11924+
}
11925+
1190311926
public global::CppSharp.Parser.AST.ClassLayout Layout
1190411927
{
1190511928
get
@@ -13100,7 +13123,7 @@ public uint SpecializationsCount
1310013123

1310113124
public unsafe partial class ClassTemplateSpecialization : global::CppSharp.Parser.AST.Class, IDisposable
1310213125
{
13103-
[StructLayout(LayoutKind.Sequential, Size = 324)]
13126+
[StructLayout(LayoutKind.Sequential, Size = 328)]
1310413127
public new partial struct __Internal
1310513128
{
1310613129
internal global::CppSharp.Parser.AST.DeclarationKind kind;
@@ -13150,6 +13173,7 @@ public unsafe partial class ClassTemplateSpecialization : global::CppSharp.Parse
1315013173
internal byte hasNonTrivialDestructor;
1315113174
internal byte isExternCContext;
1315213175
internal byte isInjected;
13176+
internal global::CppSharp.Parser.AST.TagKind tagKind;
1315313177
internal __IntPtr layout;
1315413178
internal __IntPtr templatedDecl;
1315513179
internal global::Std.Vector.__Internalc__N_std_N___1_S_vector____N_CppSharp_N_CppParser_N_AST_S_TemplateArgument___N_std_N___1_S_allocator__S0_ Arguments;
@@ -13313,7 +13337,7 @@ public uint ArgumentsCount
1331313337

1331413338
public unsafe partial class ClassTemplatePartialSpecialization : global::CppSharp.Parser.AST.ClassTemplateSpecialization, IDisposable
1331513339
{
13316-
[StructLayout(LayoutKind.Sequential, Size = 324)]
13340+
[StructLayout(LayoutKind.Sequential, Size = 328)]
1331713341
public new partial struct __Internal
1331813342
{
1331913343
internal global::CppSharp.Parser.AST.DeclarationKind kind;
@@ -13363,6 +13387,7 @@ public unsafe partial class ClassTemplatePartialSpecialization : global::CppShar
1336313387
internal byte hasNonTrivialDestructor;
1336413388
internal byte isExternCContext;
1336513389
internal byte isInjected;
13390+
internal global::CppSharp.Parser.AST.TagKind tagKind;
1336613391
internal __IntPtr layout;
1336713392
internal __IntPtr templatedDecl;
1336813393
internal global::Std.Vector.__Internalc__N_std_N___1_S_vector____N_CppSharp_N_CppParser_N_AST_S_TemplateArgument___N_std_N___1_S_allocator__S0_ Arguments;

src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser-symbols.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ CppSharp::CppParser::AST::InlineContentComment& (CppSharp::CppParser::AST::Inlin
1313
extern "C" __declspec(dllexport) void c__N_CppSharp_N_CppParser_N_AST_S_ParagraphComment_ParagraphComment___1__N_CppSharp_N_CppParser_N_AST_S_ParagraphComment(void* __instance, const CppSharp::CppParser::AST::ParagraphComment& _0) { ::new (__instance) CppSharp::CppParser::AST::ParagraphComment(_0); }
1414
CppSharp::CppParser::AST::ParagraphComment& (CppSharp::CppParser::AST::ParagraphComment::*_5)(const CppSharp::CppParser::AST::ParagraphComment&) = &CppSharp::CppParser::AST::ParagraphComment::operator=;
1515
CppSharp::CppParser::AST::BlockCommandComment::Argument& (CppSharp::CppParser::AST::BlockCommandComment::Argument::*_6)(const CppSharp::CppParser::AST::BlockCommandComment::Argument&) = &CppSharp::CppParser::AST::BlockCommandComment::Argument::operator=;
16-
extern "C" __declspec(dllexport) void c__N_CppSharp_N_CppParser_N_AST_S_BlockCommandComment_S_Argument__Argument(CppSharp::CppParser::AST::BlockCommandComment::Argument*__instance) { __instance->~Argument(); }
1716
extern "C" __declspec(dllexport) void c__N_CppSharp_N_CppParser_N_AST_S_BlockCommandComment_BlockCommandComment___1__N_CppSharp_N_CppParser_N_AST_S_BlockCommandComment(void* __instance, const CppSharp::CppParser::AST::BlockCommandComment& _0) { ::new (__instance) CppSharp::CppParser::AST::BlockCommandComment(_0); }
1817
CppSharp::CppParser::AST::BlockCommandComment& (CppSharp::CppParser::AST::BlockCommandComment::*_7)(const CppSharp::CppParser::AST::BlockCommandComment&) = &CppSharp::CppParser::AST::BlockCommandComment::operator=;
1918
extern "C" __declspec(dllexport) void c__N_CppSharp_N_CppParser_N_AST_S_ParamCommandComment_ParamCommandComment___1__N_CppSharp_N_CppParser_N_AST_S_ParamCommandComment(void* __instance, const CppSharp::CppParser::AST::ParamCommandComment& _0) { ::new (__instance) CppSharp::CppParser::AST::ParamCommandComment(_0); }
@@ -31,7 +30,6 @@ extern "C" __declspec(dllexport) void c__N_CppSharp_N_CppParser_N_AST_S_Verbatim
3130
CppSharp::CppParser::AST::VerbatimLineComment& (CppSharp::CppParser::AST::VerbatimLineComment::*_12)(CppSharp::CppParser::AST::VerbatimLineComment&&) = &CppSharp::CppParser::AST::VerbatimLineComment::operator=;
3231
extern "C" __declspec(dllexport) void c__N_CppSharp_N_CppParser_N_AST_S_VerbatimLineComment__VerbatimLineComment(CppSharp::CppParser::AST::VerbatimLineComment*__instance) { __instance->~VerbatimLineComment(); }
3332
CppSharp::CppParser::AST::InlineCommandComment::Argument& (CppSharp::CppParser::AST::InlineCommandComment::Argument::*_13)(const CppSharp::CppParser::AST::InlineCommandComment::Argument&) = &CppSharp::CppParser::AST::InlineCommandComment::Argument::operator=;
34-
extern "C" __declspec(dllexport) void c__N_CppSharp_N_CppParser_N_AST_S_InlineCommandComment_S_Argument__Argument(CppSharp::CppParser::AST::InlineCommandComment::Argument*__instance) { __instance->~Argument(); }
3533
extern "C" __declspec(dllexport) void c__N_CppSharp_N_CppParser_N_AST_S_InlineCommandComment_InlineCommandComment___1__N_CppSharp_N_CppParser_N_AST_S_InlineCommandComment(void* __instance, const CppSharp::CppParser::AST::InlineCommandComment& _0) { ::new (__instance) CppSharp::CppParser::AST::InlineCommandComment(_0); }
3634
CppSharp::CppParser::AST::InlineCommandComment& (CppSharp::CppParser::AST::InlineCommandComment::*_14)(CppSharp::CppParser::AST::InlineCommandComment&&) = &CppSharp::CppParser::AST::InlineCommandComment::operator=;
3735
extern "C" __declspec(dllexport) void c__N_CppSharp_N_CppParser_N_AST_S_InlineCommandComment__InlineCommandComment(CppSharp::CppParser::AST::InlineCommandComment*__instance) { __instance->~InlineCommandComment(); }
@@ -377,6 +375,5 @@ CppSharp::CppParser::CppParserOptions& (CppSharp::CppParser::CppParserOptions::*
377375
extern "C" __declspec(dllexport) void c__N_CppSharp_N_CppParser_S_LinkerOptions_LinkerOptions___1__N_CppSharp_N_CppParser_S_LinkerOptions(void* __instance, const CppSharp::CppParser::LinkerOptions& _0) { ::new (__instance) CppSharp::CppParser::LinkerOptions(_0); }
378376
CppSharp::CppParser::LinkerOptions& (CppSharp::CppParser::LinkerOptions::*_241)(const CppSharp::CppParser::LinkerOptions&) = &CppSharp::CppParser::LinkerOptions::operator=;
379377
CppSharp::CppParser::ParserDiagnostic& (CppSharp::CppParser::ParserDiagnostic::*_242)(const CppSharp::CppParser::ParserDiagnostic&) = &CppSharp::CppParser::ParserDiagnostic::operator=;
380-
extern "C" __declspec(dllexport) void c__N_CppSharp_N_CppParser_S_ParserDiagnostic__ParserDiagnostic(CppSharp::CppParser::ParserDiagnostic*__instance) { __instance->~ParserDiagnostic(); }
381378
CppSharp::CppParser::ParserResult& (CppSharp::CppParser::ParserResult::*_243)(const CppSharp::CppParser::ParserResult&) = &CppSharp::CppParser::ParserResult::operator=;
382379
CppSharp::CppParser::ClangParser& (CppSharp::CppParser::ClangParser::*_244)(CppSharp::CppParser::ClangParser&&) = &CppSharp::CppParser::ClangParser::operator=;

0 commit comments

Comments
 (0)