From 692aeca75781619cb05c923dc466521169507a83 Mon Sep 17 00:00:00 2001 From: Zihan Chen Date: Sun, 26 Jul 2020 23:09:24 -0700 Subject: [PATCH] ... --- Cpp.md | 1 - Tools/CppDoc/DocIndex/Main.cpp | 3 + .../Source/ExportReflectableTypes.cpp | 42 +- Tools/CppDoc/UnitTest_ExecuteCases/Main.cpp | 2 - Tools/Demos/Gaclib/Reflection.xml | 1 + Tools/Demos/_Test/Reflection.xml | 1192 ++++++++--------- 6 files changed, 640 insertions(+), 601 deletions(-) create mode 100644 Tools/Demos/Gaclib/Reflection.xml diff --git a/Cpp.md b/Cpp.md index 5f3082465..d788cd7cc 100644 --- a/Cpp.md +++ b/Cpp.md @@ -32,7 +32,6 @@ - [ ] Fix signature for Curry. - [ ] Refine document comment - [ ] Generate `C++ name -> ` file, so that `
` could have hyper-links to document pages - - [ ] Automatically generate `registered types` list - [ ] VlppParser - [ ] Fix document for `ParsingTable` - [ ] Add `header:` in codegen so that generated files have license comment diff --git a/Tools/CppDoc/DocIndex/Main.cpp b/Tools/CppDoc/DocIndex/Main.cpp index 8e92c77d8..844ccf736 100644 --- a/Tools/CppDoc/DocIndex/Main.cpp +++ b/Tools/CppDoc/DocIndex/Main.cpp @@ -1,4 +1,5 @@ #include +#include /*********************************************************************** Main @@ -69,6 +70,8 @@ int main() folderFragment, folderReference ); + + ExportReflectableTypes(folderOutput); } return 0; diff --git a/Tools/CppDoc/Reflection/Source/ExportReflectableTypes.cpp b/Tools/CppDoc/Reflection/Source/ExportReflectableTypes.cpp index 94171fbb4..07ccf2076 100644 --- a/Tools/CppDoc/Reflection/Source/ExportReflectableTypes.cpp +++ b/Tools/CppDoc/Reflection/Source/ExportReflectableTypes.cpp @@ -39,18 +39,56 @@ void LogTypes(Ptr xmlRoot, const WString& projectName, SortedListGetTypeDescriptor(i); WString tdName = td->GetTypeName(); + WString cppName = CppGetFullName(td); + if (loaded.Contains(tdName)) continue; loaded.Add(tdName); auto xmlType = MakePtr(); - xmlType->name.value = L"type"; xmlProject->subNodes.Add(xmlType); + + switch (td->GetTypeDescriptorFlags()) + { + case TypeDescriptorFlags::Object: + xmlType->name.value = L"Object"; + break; + case TypeDescriptorFlags::IDescriptable: + xmlType->name.value = L"IDescriptable"; + break; + case TypeDescriptorFlags::Class: + xmlType->name.value = L"Class"; + break; + case TypeDescriptorFlags::Interface: + xmlType->name.value = L"Interface"; + break; + case TypeDescriptorFlags::Primitive: + xmlType->name.value = L"Primitive"; + break; + case TypeDescriptorFlags::Struct: + xmlType->name.value = L"Struct"; + break; + case TypeDescriptorFlags::FlagEnum: + xmlType->name.value = L"FlagEnum"; + break; + case TypeDescriptorFlags::NormalEnum: + xmlType->name.value = L"NormalEnum"; + break; + default: + xmlType->name.value = L"Undefined"; + } + { auto attr = MakePtr(); - attr->name.value = L"registered"; + attr->name.value = L"name"; attr->value.value = tdName; xmlType->attributes.Add(attr); } + { + auto attr = MakePtr(); + attr->name.value = L"cpp"; + attr->value.value = cppName; + xmlType->attributes.Add(attr); + } } } diff --git a/Tools/CppDoc/UnitTest_ExecuteCases/Main.cpp b/Tools/CppDoc/UnitTest_ExecuteCases/Main.cpp index 945ad16c9..dd3891948 100644 --- a/Tools/CppDoc/UnitTest_ExecuteCases/Main.cpp +++ b/Tools/CppDoc/UnitTest_ExecuteCases/Main.cpp @@ -19,7 +19,6 @@ int main() preprocessedFiles.Add(File(L"../UnitTest_Cases/TypePrinter.i")); preprocessedFiles.Add(File(L"../UnitTest_Cases/STL.i")); -#if 0 Console::WriteLine(L"Cleaning ..."); FOREACH(File, file, preprocessedFiles) { @@ -81,7 +80,6 @@ int main() folderReference ); } -#endif { Folder folderOutput(L"../../Demos/_Test"); diff --git a/Tools/Demos/Gaclib/Reflection.xml b/Tools/Demos/Gaclib/Reflection.xml new file mode 100644 index 000000000..688834583 --- /dev/null +++ b/Tools/Demos/Gaclib/Reflection.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Tools/Demos/_Test/Reflection.xml b/Tools/Demos/_Test/Reflection.xml index 1431ce1b1..bdd36fcdd 100644 --- a/Tools/Demos/_Test/Reflection.xml +++ b/Tools/Demos/_Test/Reflection.xml @@ -1,610 +1,610 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + \ No newline at end of file