From 2d527f0fc23ddc28505d2e46477d63ef29e08227 Mon Sep 17 00:00:00 2001 From: Duy-Nguyen Ta Date: Thu, 24 Nov 2016 19:24:25 -0500 Subject: [PATCH] unfinished attempt to add typedef for matlab wrapper --- wrap/Module.cpp | 2 ++ wrap/TypeAttributesTable.cpp | 7 +++++++ wrap/TypeAttributesTable.h | 2 ++ 3 files changed, 11 insertions(+) diff --git a/wrap/Module.cpp b/wrap/Module.cpp index 65620ede5..9a39cdd33 100644 --- a/wrap/Module.cpp +++ b/wrap/Module.cpp @@ -242,6 +242,8 @@ void Module::parseMarkup(const std::string& data) { // Create type attributes table and check validity typeAttributes.addClasses(expandedClasses); typeAttributes.addForwardDeclarations(forward_declarations); + for (const TypedefPair p: typedefs) + typeAttributes.addType(p.newType); // add Eigen types as template arguments are also checked ? vector eigen; eigen.push_back(ForwardDeclaration("Vector")); diff --git a/wrap/TypeAttributesTable.cpp b/wrap/TypeAttributesTable.cpp index f98e9b760..18c034776 100644 --- a/wrap/TypeAttributesTable.cpp +++ b/wrap/TypeAttributesTable.cpp @@ -42,6 +42,13 @@ const TypeAttributes& TypeAttributesTable::attributes(const string& key) const { } } +/* ************************************************************************* */ +void TypeAttributesTable::addType(const Qualified& cls) { + if (!table_.insert(make_pair(cls.qualifiedName("::"), TypeAttributes(false))) + .second) + throw DuplicateDefinition("types " + cls.qualifiedName("::")); +} + /* ************************************************************************* */ void TypeAttributesTable::addClasses(const vector& classes) { for(const Class& cls: classes) { diff --git a/wrap/TypeAttributesTable.h b/wrap/TypeAttributesTable.h index 9b1c2acbc..a48fecb3c 100644 --- a/wrap/TypeAttributesTable.h +++ b/wrap/TypeAttributesTable.h @@ -28,6 +28,7 @@ namespace wrap { // Forward declarations +class Qualified; class Class; /** Attributes about valid classes, both for classes defined in this module and @@ -57,6 +58,7 @@ public: } void addClasses(const std::vector& classes); + void addType(const Qualified& types); void addForwardDeclarations( const std::vector& forwardDecls);