From 53caa6e87cf6d2af37047737d21b4f4f4a907f7d Mon Sep 17 00:00:00 2001 From: RĂ¼diger Timm Date: Mon, 31 Jan 2005 14:28:41 +0000 Subject: INTEGRATION: CWS sdksample (1.4.14); FILE MERGED 2004/11/02 17:14:05 jsc 1.4.14.4: RESYNC: (1.5-1.6); FILE MERGED 2004/08/12 07:19:56 jsc 1.4.14.3: RESYNC: (1.4-1.5); FILE MERGED 2004/07/07 09:52:50 jsc 1.4.14.2: #i30954# adjusted to genrate dependent types fro cppu 2004/07/05 11:01:53 jsc 1.4.14.1: #i30954# use registry keys directly instead of typenames --- codemaker/source/cppumaker/cppumaker.cxx | 115 +++++++++++++++++++++++-------- 1 file changed, 86 insertions(+), 29 deletions(-) diff --git a/codemaker/source/cppumaker/cppumaker.cxx b/codemaker/source/cppumaker/cppumaker.cxx index 96d14f8234d8..ef2f9535c51a 100644 --- a/codemaker/source/cppumaker/cppumaker.cxx +++ b/codemaker/source/cppumaker/cppumaker.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cppumaker.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: rt $ $Date: 2004-10-28 16:19:27 $ + * last change: $Author: rt $ $Date: 2005-01-31 15:28:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -81,6 +81,16 @@ void failed(rtl::OString const & typeName, CppuOptions * options) { exit(99); } +void produce( + RegistryKey& rTypeKey, bool bIsExtraType, TypeManager const & typeMgr, + codemaker::GeneratedTypeSet & generated, CppuOptions * options) +{ + if (!produceType(rTypeKey, bIsExtraType, typeMgr, generated, options)) { + OString typeName = typeMgr.getTypeName(rTypeKey); + failed(typeName, options); + } +} + void produce( rtl::OString const & typeName, TypeManager const & typeMgr, codemaker::GeneratedTypeSet & generated, CppuOptions * options) @@ -90,35 +100,82 @@ void produce( } } -void produceAllTypes( - rtl::OString const & typeName, TypeManager const & typeMgr, - codemaker::GeneratedTypeSet & generated, CppuOptions * pOptions, - bool fullScope) +void produceAllTypes(RegistryKey& rTypeKey, bool bIsExtraType, + TypeManager const & typeMgr, + codemaker::GeneratedTypeSet & generated, + CppuOptions* pOptions, + sal_Bool bFullScope) + throw( CannotDumpException ) { - produce(typeName, typeMgr, generated, pOptions); + OString typeName = typeMgr.getTypeName(rTypeKey); - RegistryKey typeKey = typeMgr.getTypeKey(typeName); - RegistryKeyNames subKeys; + produce(rTypeKey, bIsExtraType, typeMgr, generated, pOptions); - if (typeKey.getKeyNames(OUString(), subKeys)) { - failed(typeName, pOptions); - } + RegistryKeyList typeKeys = typeMgr.getTypeKeys(typeName); + RegistryKeyList::const_iterator iter = typeKeys.begin(); + RegistryKey key, subKey; + RegistryKeyArray subKeys; - OString tmpName; - for (sal_uInt32 i=0; i < subKeys.getLength(); i++) + while (iter != typeKeys.end()) { - tmpName = OUStringToOString(subKeys.getElement(i), RTL_TEXTENCODING_UTF8); + key = (*iter).first; + + if (!(*iter).second && !key.openSubKeys(OUString(), subKeys)) + { + for (sal_uInt32 i = 0; i < subKeys.getLength(); i++) + { + subKey = subKeys.getElement(i); + if (bFullScope) + { + produceAllTypes(subKey, (*iter).second, typeMgr, + generated, pOptions, true); + } else + { + produce(subKey, (*iter).second, + typeMgr, generated, pOptions); + } + } + } + + ++iter; + } +} + +void produceAllTypes(const OString& typeName, + TypeManager const & typeMgr, + codemaker::GeneratedTypeSet & generated, + CppuOptions* pOptions, + sal_Bool bFullScope) + throw( CannotDumpException ) +{ + produce(typeName, typeMgr, generated, pOptions); - if (pOptions->isValid("-B")) - tmpName = tmpName.copy(tmpName.indexOf('/', 1) + 1); - else - tmpName = tmpName.copy(1); + RegistryKeyList typeKeys = typeMgr.getTypeKeys(typeName); + RegistryKeyList::const_iterator iter = typeKeys.begin(); + RegistryKey key, subKey; + RegistryKeyArray subKeys; - if (fullScope) { - produceAllTypes(tmpName, typeMgr, generated, pOptions, true); - } else { - produce(tmpName, typeMgr, generated, pOptions); + while (iter != typeKeys.end()) + { + key = (*iter).first; + if (!(*iter).second && !key.openSubKeys(OUString(), subKeys)) + { + for (sal_uInt32 i = 0; i < subKeys.getLength(); i++) + { + subKey = subKeys.getElement(i); + if (bFullScope) + { + produceAllTypes(subKey, (*iter).second, typeMgr, + generated, pOptions, true); + } else + { + produce(subKey, (*iter).second, + typeMgr, generated, pOptions); + } + } } + + ++iter; } } @@ -171,7 +228,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) tmpName = typeName.copy( nPos != -1 ? nPos+1 : 0 ); if (tmpName == "*") { - // produce this type and his scope, but the scope is not recursively generated. + // produce this type and his scope if (typeName.equals("*")) { tmpName = "/"; @@ -183,14 +240,15 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) else tmpName.replace('.', '/'); } + // related to task #116780# the scope is recursively + // generated. bFullScope = true produceAllTypes( - tmpName, typeMgr, generated, &options, false); + tmpName, typeMgr, generated, &options, true); } else { // produce only this type produce( - typeName.replace('.', '/'), typeMgr, generated, - &options); + typeName.replace('.', '/'), typeMgr, generated, &options); } } while( nIndex != -1 ); } else @@ -201,8 +259,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) // C++ header files generated for the following UNO types are included // in header files in cppu/inc/com/sun/star/uno (Any.hxx, Reference.hxx, // Type.h), so it seems best to always generate those C++ header files: - produce( - "com/sun/star/uno/RuntimeException", typeMgr, generated, &options); + produce("com/sun/star/uno/RuntimeException", typeMgr, generated, &options); produce("com/sun/star/uno/TypeClass", typeMgr, generated, &options); produce("com/sun/star/uno/XInterface", typeMgr, generated, &options); } -- cgit