codemaker/source/codemaker/typemanager.cxx |    1 
 codemaker/source/cppumaker/cpputype.cxx    |   46 +++++++++++++----------------
 2 files changed, 23 insertions(+), 24 deletions(-)

New commits:
commit 4b73d334a9c5d8ae1fe16b2cc04100b9f333595a
Author: Stephan Bergmann <sberg...@redhat.com>
Date:   Mon Apr 15 10:38:01 2013 +0200

    Further adapt CppuType::dumpCppuGetType to using unoidl/ instead of 
registry/
    
    Change-Id: Ib46d7b8934f63d88ea953707fa1fbfb51c524efd

diff --git a/codemaker/source/codemaker/typemanager.cxx 
b/codemaker/source/codemaker/typemanager.cxx
index e07b553..5116aba 100644
--- a/codemaker/source/codemaker/typemanager.cxx
+++ b/codemaker/source/codemaker/typemanager.cxx
@@ -492,6 +492,7 @@ codemaker::UnoType::Sort TypeManager::decompose(
         case codemaker::UnoType::SORT_ANY:
         case codemaker::UnoType::SORT_ENUM_TYPE:
         case codemaker::UnoType::SORT_PLAIN_STRUCT_TYPE:
+        case codemaker::UnoType::SORT_EXCEPTION_TYPE:
         case codemaker::UnoType::SORT_INTERFACE_TYPE:
             if (nucleus != 0) {
                 *nucleus = n;
diff --git a/codemaker/source/cppumaker/cpputype.cxx 
b/codemaker/source/cppumaker/cpputype.cxx
index 446e1f9..7540c02 100755
--- a/codemaker/source/cppumaker/cpputype.cxx
+++ b/codemaker/source/cppumaker/cpputype.cxx
@@ -162,7 +162,8 @@ public:
 
     OUString getTypeClass(OUString const & name, bool cStyle = false);
 
-    void dumpCppuGetType(FileStream & out, OUString const & name);
+    void dumpCppuGetType(
+        FileStream & out, OUString const & name, OUString const * ownName = 0);
 
     sal_uInt32 getInheritedMemberCount();
 
@@ -799,8 +800,15 @@ void CppuType::dumpType(
     }
 }
 
-void CppuType::dumpCppuGetType(FileStream & out, OUString const & name) {
-    switch (m_typeMgr->getSort(resolveOuterTypedefs(name))) {
+void CppuType::dumpCppuGetType(
+    FileStream & out, OUString const & name, OUString const * ownName)
+{
+    //TODO: What are these calls good for?
+    OUString nucleus;
+    sal_Int32 rank;
+    codemaker::UnoType::Sort sort = m_typeMgr->decompose(
+        name, true, &nucleus, &rank, 0, 0);
+    switch (rank == 0 ? sort : codemaker::UnoType::SORT_SEQUENCE_TYPE) {
     case codemaker::UnoType::SORT_VOID:
     case codemaker::UnoType::SORT_BOOLEAN:
     case codemaker::UnoType::SORT_BYTE:
@@ -823,10 +831,16 @@ void CppuType::dumpCppuGetType(FileStream & out, OUString 
const & name) {
     case codemaker::UnoType::SORT_INSTANTIATED_POLYMORPHIC_STRUCT_TYPE:
     case codemaker::UnoType::SORT_EXCEPTION_TYPE:
     case codemaker::UnoType::SORT_INTERFACE_TYPE:
-        out << indent() << "::cppu::UnoType< ";
-        dumpType(out, name, false, false, false, true);
-        out << " >::get();\n";
+        // Take care of recursion like struct S { sequence<S> x; }:
+        if (ownName == 0 || nucleus != *ownName) {
+            out << indent() << "::cppu::UnoType< ";
+            dumpType(out, name, false, false, false, true);
+            out << " >::get();\n";
+        }
         break;
+    case codemaker::UnoType::SORT_TYPEDEF:
+        assert(false); // this cannot happen
+        // fall through
     default:
         throw CannotDumpException(
             "unexpected entity \"" + name
@@ -1984,15 +1998,7 @@ void 
PlainStructType::dumpComprehensiveGetCppuType(FileStream & out) {
                     i->type, static_cast< sal_uInt32 >(types.size()))).
             second)
         {
-            if ((codemaker::UnoType::getSort(u2b(i->type))
-                 == codemaker::UnoType::SORT_COMPLEX)
-                && b2u(codemaker::UnoType::decompose(u2b(i->type))) != name_)
-                    // take care of recursion like struct S { sequence<S> x; };
-            {
-                out << indent() << "::cppu::UnoType< ";
-                dumpType(out, i->type, false, false, false, true);
-                out << " >::get();\n";
-            }
+            dumpCppuGetType(out, i->type, &name_);
             // For typedefs, use the resolved type name, as there will be no
             // information available about the typedef itself at runtime (the
             // above getCppuType call will make available information about the
@@ -2488,15 +2494,7 @@ void 
PolyStructType::dumpComprehensiveGetCppuType(FileStream & out) {
                            i->type, static_cast< sal_uInt32 >(types.size()))).
                    second)
         {
-            if ((codemaker::UnoType::getSort(u2b(i->type))
-                 == codemaker::UnoType::SORT_COMPLEX)
-                && b2u(codemaker::UnoType::decompose(u2b(i->type))) != name_)
-                    // take care of recursion like struct S { sequence<S> x; };
-            {
-                out << indent() << "::cppu::UnoType< ";
-                dumpType(out, i->type, false, false, false, true);
-                out << " >::get();\n";
-            }
+            dumpCppuGetType(out, i->type, &name_);
             // For typedefs, use the resolved type name, as there will be no
             // information available about the typedef itself at runtime (the
             // above getCppuType call will make available information about the
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to