This is an automated email from the ASF dual-hosted git repository. mseidel pushed a commit to branch AOO42X in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO42X by this push: new 4363417e1f Cleanup, removed whitespace 4363417e1f is described below commit 4363417e1f72babac49873e7406bded8bc3b2a15 Author: mseidel <msei...@apache.org> AuthorDate: Fri Sep 27 15:02:30 2024 +0200 Cleanup, removed whitespace (cherry picked from commit 87af7fed3e8276d44742177b3ab07bd3610bd7b3) --- .../source/bonobowrappermaker/corbamaker.cxx | 78 ++- .../source/bonobowrappermaker/corbaoptions.cxx | 64 ++- .../source/bonobowrappermaker/corbatype.cxx | 559 ++++++++++----------- 3 files changed, 347 insertions(+), 354 deletions(-) diff --git a/main/codemaker/source/bonobowrappermaker/corbamaker.cxx b/main/codemaker/source/bonobowrappermaker/corbamaker.cxx index c6f189ae94..52abb5c261 100644 --- a/main/codemaker/source/bonobowrappermaker/corbamaker.cxx +++ b/main/codemaker/source/bonobowrappermaker/corbamaker.cxx @@ -1,6 +1,5 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,19 +7,18 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_codemaker.hxx" @@ -37,7 +35,7 @@ using namespace rtl; sal_Bool produceAllTypes(const OString& typeName, - TypeManager& typeMgr, + TypeManager& typeMgr, TypeDependency& typeDependencies, CorbaOptions* pOptions, sal_Bool bFullScope, @@ -49,18 +47,18 @@ sal_Bool produceAllTypes(const OString& typeName, { if (!produceType(typeName, typeMgr, typeDependencies, pOptions, o, pAllreadyDumped, generatedConversion)) { - fprintf(stderr, "%s ERROR: %s\n", - pOptions->getProgramName().getStr(), + fprintf(stderr, "%s ERROR: %s\n", + pOptions->getProgramName().getStr(), OString("cannot dump Type '" + typeName + "'").getStr()); exit(99); } RegistryKey typeKey = typeMgr.getTypeKey(typeName); RegistryKeyNames subKeys; - + if (typeKey.getKeyNames(OUString(), subKeys)) return sal_False; - + OString tmpName; for (sal_uInt32 i=0; i < subKeys.getLength(); i++) { @@ -81,15 +79,15 @@ sal_Bool produceAllTypes(const OString& typeName, return sal_False; } } - - return sal_True; + + return sal_True; } SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { CorbaOptions options; - try + try { if (!options.initOptions(argc, argv)) { @@ -104,7 +102,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) RegistryTypeManager typeMgr; TypeDependency typeDependencies; - + if (!typeMgr.init(!options.isValid("-T"), options.getInputFiles())) { fprintf(stderr, "%s : init registries failed, check your registry files.\n", options.getProgramName().getStr()); @@ -116,51 +114,51 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) typeMgr.setBase(options.getOption("-B")); } - try + try { TypeSet generatedConversion; FileStream cppFile; OString outPath; if (options.isValid("-O")) outPath = options.getOption("-O"); - + cppFile.open(outPath); - + if(!cppFile.isValid()) { OString message("cannot open "); message += outPath + " for writing"; throw CannotDumpException(message); } - + if (options.isValid("-H")) { OString corbaHeader = options.getOption("-H"); - + cppFile << "#include <" << corbaHeader << ">\n\n"; - + CorbaType::dumpDefaultHxxIncludes(cppFile); cppFile << "\n"; } - + if (options.isValid("-T")) { OString tOption(options.getOption("-T")); OString typeName, tmpName; sal_Bool ret = sal_False; - sal_Int32 nIndex = 0; + sal_Int32 nIndex = 0; do { typeName = tOption.getToken(0, ';', nIndex); - - sal_Int32 nPos = typeName.lastIndexOf( '.' ); - tmpName = typeName.copy( nPos != -1 ? nPos+1 : 0 ); + + sal_Int32 nPos = typeName.lastIndexOf( '.' ); + 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, but the scope is not recursively generated. if (typeName.equals("*")) { tmpName = "/"; @@ -181,8 +179,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) if (!ret) { - fprintf(stderr, "%s ERROR: %s\n", - options.getProgramName().getStr(), + fprintf(stderr, "%s ERROR: %s\n", + options.getProgramName().getStr(), OString("cannot dump Type '" + typeName + "'").getStr()); exit(99); } @@ -192,27 +190,27 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) // produce all types if (!produceAllTypes("/", typeMgr, typeDependencies, &options, sal_True, cppFile, NULL, &generatedConversion)) { - fprintf(stderr, "%s ERROR: %s\n", - options.getProgramName().getStr(), + fprintf(stderr, "%s ERROR: %s\n", + options.getProgramName().getStr(), "an error occurs while dumping all types."); exit(99); } } - + cppFile << "namespace bonobobridge {\n" - << "const ConversionInfo* get_conversion_functions() {\n" + << "const ConversionInfo* get_conversion_functions() {\n" << " static ConversionInfo allFunctions[" << generatedConversion.size()+1<< "] = {\n"; - + for (TypeSet::iterator iter = generatedConversion.begin(); iter != generatedConversion.end(); iter++) { cppFile << " {\"" << (*iter).getStr() << "\"" - << ", &TC_" << (*iter).replace('/','_').getStr() << "_struct" + << ", &TC_" << (*iter).replace('/','_').getStr() << "_struct" << ", sizeof(" << (*iter).replace('/','_').getStr() << ")" << ", convert_b2u_" << (*iter).replace('/','_').getStr() << ", convert_u2b_" << (*iter).replace('/','_').getStr() << " },\n"; - } - + } + cppFile << " {NULL, NULL, 0 , NULL, NULL} };\n" << " return allFunctions;\n" << "}\n" @@ -222,8 +220,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) } catch( CannotDumpException& e) { - fprintf(stderr, "%s ERROR: %s\n", - options.getProgramName().getStr(), + fprintf(stderr, "%s ERROR: %s\n", + options.getProgramName().getStr(), e.m_message.getStr()); exit(99); } @@ -231,4 +229,4 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) return 0; } - +/* vim: set noet sw=4 ts=4: */ diff --git a/main/codemaker/source/bonobowrappermaker/corbaoptions.cxx b/main/codemaker/source/bonobowrappermaker/corbaoptions.cxx index 571cd53aaf..92257d43e8 100644 --- a/main/codemaker/source/bonobowrappermaker/corbaoptions.cxx +++ b/main/codemaker/source/bonobowrappermaker/corbaoptions.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,29 +7,27 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_codemaker.hxx" -#include <stdio.h> +#include <stdio.h> #include "corbaoptions.hxx" using namespace rtl; -sal_Bool CorbaOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile) +sal_Bool CorbaOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile) throw( IllegalArgument ) { sal_Bool ret = sal_True; @@ -38,7 +36,7 @@ sal_Bool CorbaOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile) if (!bCmdFile) { bCmdFile = sal_True; - + m_program = av[0]; if (ac < 2) @@ -74,14 +72,14 @@ sal_Bool CorbaOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile) { tmp += " your input '" + OString(av[i+1]) + "'"; } - + throw IllegalArgument(tmp); } } else { s = av[i] + 2; } - + m_options["-O"] = OString(s); break; case 'H': @@ -98,14 +96,14 @@ sal_Bool CorbaOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile) { tmp += " your input '" + OString(av[i+1]) + "'"; } - + throw IllegalArgument(tmp); } } else { s = av[i] + 2; } - + m_options["-H"] = OString(s); break; case 'B': @@ -122,14 +120,14 @@ sal_Bool CorbaOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile) { tmp += " your input '" + OString(av[i+1]) + "'"; } - + throw IllegalArgument(tmp); } } else { s = av[i] + 2; } - + m_options["-B"] = OString(s); break; case 'T': @@ -146,14 +144,14 @@ sal_Bool CorbaOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile) { tmp += " your input '" + OString(av[i+1]) + "'"; } - + throw IllegalArgument(tmp); } } else { s = av[i] + 2; } - + if (m_options.count("-T") > 0) { OString tmp(m_options["-T"]); @@ -175,20 +173,20 @@ sal_Bool CorbaOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile) throw IllegalArgument(tmp); } - + m_options["-G"] = OString(""); break; default: throw IllegalArgument("the option is unknown" + OString(av[i])); - break; + break; } } else { if (av[i][0] == '@') { FILE* cmdFile = fopen(av[i]+1, "r"); - if( cmdFile == NULL ) - { + if( cmdFile == NULL ) + { fprintf(stderr, "%s", prepareHelp().getStr()); ret = sal_False; } else @@ -203,24 +201,24 @@ sal_Bool CorbaOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile) rargc++; } fclose(cmdFile); - + ret = initOptions(rargc, rargv, bCmdFile); - - for (long i=0; i < rargc; i++) + + for (long i=0; i < rargc; i++) { free(rargv[i]); } - } + } } else { m_inputFiles.push_back(av[i]); - } + } } } printf("-T: %s\n", m_options["-T"].getStr()); - return ret; -} + return ret; +} OString CorbaOptions::prepareHelp() { @@ -231,21 +229,21 @@ OString CorbaOptions::prepareHelp() help += " -T<name> = name specifies a type or a list of types. The output for this\n"; help += " [t1;...] type is generated. If no '-T' option is specified,\n"; help += " then output for all types is generated.\n"; - help += " Example: 'com.sun.star.uno.XInterface' is a valid type.\n"; + help += " Example: 'com.sun.star.uno.XInterface' is a valid type.\n"; help += " -B<name> = name specifies the base node. All types are searched under this\n"; help += " node. Default is the root '/' of the registry files.\n"; help += " -G = generate only target files which does not exists.\n"; help += " -H<header> = include CORBA generated <header>.\n"; help += prepareVersion(); - + return help; -} +} OString CorbaOptions::prepareVersion() { OString version(m_program); version += m_program + " Version 2.0\n\n"; return version; -} +} - +/* vim: set noet sw=4 ts=4: */ diff --git a/main/codemaker/source/bonobowrappermaker/corbatype.cxx b/main/codemaker/source/bonobowrappermaker/corbatype.cxx index 7df00b6161..4a02336161 100644 --- a/main/codemaker/source/bonobowrappermaker/corbatype.cxx +++ b/main/codemaker/source/bonobowrappermaker/corbatype.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,20 +7,18 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_codemaker.hxx" @@ -37,14 +35,13 @@ using namespace rtl; - //************************************************************************* // CorbaType //************************************************************************* CorbaType::CorbaType(TypeReader& typeReader, const OString& typeName, - const TypeManager& typeMgr, - const TypeDependency& typeDependencies, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, TypeSet* generatedConversions) : m_inheritedMemberCount(0) , m_indentLength(0) @@ -55,13 +52,13 @@ CorbaType::CorbaType(TypeReader& typeReader, , m_generatedConversions(generatedConversions) { sal_Int32 i = typeName.lastIndexOf('/'); - m_name = typeName.copy( i != -1 ? i+1 : 0 ); + m_name = typeName.copy( i != -1 ? i+1 : 0 ); } CorbaType::~CorbaType() { - -} + +} sal_Bool CorbaType::isNestedTypeByName(const ::rtl::OString& type) { @@ -85,14 +82,14 @@ sal_Bool CorbaType::dump(CorbaOptions* pOptions, FileStream& o, TypeSet* allread ret = dumpConversionFunctions(o, allreadyDumped); - return ret; + return ret; } sal_Bool CorbaType::dumpDependedTypes(CorbaOptions* pOptions, FileStream& o, TypeSet* allreadyDumped) throw( CannotDumpException ) { sal_Bool ret = sal_True; - + TypeUsingSet usingSet(m_dependencies.getDependencies(m_typeName)); TypeUsingSet::const_iterator iter = usingSet.begin(); @@ -103,7 +100,7 @@ sal_Bool CorbaType::dumpDependedTypes(CorbaOptions* pOptions, FileStream& o, Typ typeName = (*iter).m_type; if ((index = typeName.lastIndexOf(']')) > 0) typeName = typeName.copy(index + 1); - + if ( getUnoBaseType(typeName).isEmpty() ) { if (!produceType(typeName, @@ -112,23 +109,23 @@ sal_Bool CorbaType::dumpDependedTypes(CorbaOptions* pOptions, FileStream& o, Typ pOptions, o, allreadyDumped, m_generatedConversions)) { - fprintf(stderr, "%s ERROR: %s\n", - pOptions->getProgramName().getStr(), + fprintf(stderr, "%s ERROR: %s\n", + pOptions->getProgramName().getStr(), OString("cannot dump Type '" + typeName + "'").getStr()); exit(99); } } ++iter; - } + } - return ret; + return ret; } sal_Bool CorbaType::dumpConversionFunctions(FileStream& o, TypeSet* allreadyDumped) throw( CannotDumpException ) { if (m_typeName.lastIndexOf(']') < 0) - { + { dumpInclude(o, allreadyDumped, m_typeName, "hpp", sal_False); dumpDepIncludes(o, allreadyDumped, m_typeName, "hpp"); @@ -143,43 +140,43 @@ void CorbaType::dumpDefaultHxxIncludes(FileStream& o) { o << "#ifndef _OSL_MUTEX_HXX_\n" << "#include <osl/mutex.hxx>\n" - << "#endif\n\n"; + << "#endif\n\n"; o << "#ifndef _RTL_USTRING_HXX_\n" << "#include <rtl/ustring.hxx>\n" - << "#endif\n\n"; + << "#endif\n\n"; o << "#ifndef _COM_SUN_STAR_UNO_TYPE_HXX_\n" << "#include <com/sun/star/uno/Type.hxx>\n" - << "#endif\n"; + << "#endif\n"; o << "#ifndef _COM_SUN_STAR_UNO_ANY_HXX_\n" << "#include <com/sun/star/uno/Any.hxx>\n" - << "#endif\n"; + << "#endif\n"; o << "#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_\n" << "#include <com/sun/star/uno/Reference.hxx>\n" - << "#endif\n"; + << "#endif\n"; o << "#ifndef _COM_SUN_STAR_UNO_XINTERFACE_HPP_\n" << "#include <com/sun/star/uno/XInterface.hpp>\n" - << "#endif\n"; + << "#endif\n"; o << "#ifndef _BONOBO_NULLINTERFACE_HPP_\n" << "#include <Bonobo/NullInterface.hpp>\n" - << "#endif\n"; + << "#endif\n"; o << "#ifndef _COM_SUN_STAR_UNO_EXCEPTION_HPP_\n" << "#include <com/sun/star/uno/Exception.hpp>\n" - << "#endif\n"; + << "#endif\n"; o << "#ifndef _COM_SUN_STAR_UNO_RUNTIMEEXCEPTION_HPP_\n" << "#include <com/sun/star/uno/RuntimeException.hpp>\n" - << "#endif\n"; + << "#endif\n"; o << "#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_\n" << "#include <com/sun/star/uno/Sequence.hxx>\n" - << "#endif\n"; + << "#endif\n"; } @@ -197,45 +194,45 @@ void CorbaType::dumpInclude(FileStream& o, TypeSet* allreadyDumped, const OStrin !realTypeName.equals("com/sun/star/uno/RuntimeException")) { TypeSet::const_iterator iter = allreadyDumped->find(realTypeName); - + if (iter == allreadyDumped->end()) { allreadyDumped->insert(realTypeName); sal_uInt32 length = 3+ m_typeName.getLength() + strlen(prefix); - - if (bExtended) + + if (bExtended) length += m_name.getLength() + 1; - + OStringBuffer tmpBuf(length); - + tmpBuf.append('_'); tmpBuf.append(typeName); - tmpBuf.append('_'); + tmpBuf.append('_'); if (bExtended) { tmpBuf.append(m_name); - tmpBuf.append('_'); + tmpBuf.append('_'); } tmpBuf.append(prefix); - tmpBuf.append('_'); - + tmpBuf.append('_'); + OString tmp(tmpBuf.makeStringAndClear().replace('/', '_').toAsciiUpperCase()); - + length = 1 + typeName.getLength() + strlen(prefix); if (bExtended) length += m_name.getLength() + 1; - + tmpBuf.ensureCapacity(length); tmpBuf.append(typeName); if (bExtended) { - tmpBuf.append('/'); + tmpBuf.append('/'); tmpBuf.append(m_name); } - tmpBuf.append('.'); + tmpBuf.append('.'); tmpBuf.append(prefix); - + o << "#ifndef " << tmp << "\n#include <"; if (bCaseSensitive) { @@ -282,9 +279,9 @@ void CorbaType::dumpInclude(FileStream& o, TypeSet* allreadyDumped, const OStrin for (sal_uInt32 i = 0; i < nestedTypeNames.getLength(); i++) { OString nTypeName(OUStringToOString(nestedTypeNames.getElement(i), RTL_TEXTENCODING_UTF8)); - + nTypeName = checkRealBaseType(nTypeName.copy(5)); - + if (BT_INVALID == isBaseType(nTypeName)) { allreadyDumped->insert(nTypeName); @@ -299,7 +296,7 @@ void CorbaType::dumpInclude(FileStream& o, TypeSet* allreadyDumped, const OStrin } else { - realTypeName = ""; + realTypeName = ""; } } while ( !realTypeName.isEmpty() ); @@ -307,12 +304,12 @@ void CorbaType::dumpInclude(FileStream& o, TypeSet* allreadyDumped, const OStrin o << "}; // namespace bonobobridge\n"; } } -} +} void CorbaType::dumpDepIncludes(FileStream& o, TypeSet* allreadyDumped, const OString& typeName, sal_Char* prefix) { TypeUsingSet usingSet(m_dependencies.getDependencies(typeName)); - + TypeUsingSet::const_iterator iter = usingSet.begin(); OString sPrefix(OString(prefix).toAsciiUpperCase()); @@ -340,7 +337,7 @@ void CorbaType::dumpDepIncludes(FileStream& o, TypeSet* allreadyDumped, const OS { bSequenceDumped = sal_True; } - + if ( getUnoBaseType(relType).isEmpty() && m_typeName != relType) { @@ -351,7 +348,7 @@ void CorbaType::dumpDepIncludes(FileStream& o, TypeSet* allreadyDumped, const OS { bInterfaceDumped = sal_True; } - + if (!((*iter).m_use & TYPEUSE_SUPER)) { o << "\n"; @@ -367,35 +364,35 @@ void CorbaType::dumpDepIncludes(FileStream& o, TypeSet* allreadyDumped, const OS { dumpInclude(o, allreadyDumped, relType, prefix); } - } + } } ++iter; - } -} + } +} void CorbaType::dumpNameSpace(FileStream& o, sal_Bool bOpen, sal_Bool bFull, const OString& type) { OString typeName(type); - sal_Bool bOneLine = sal_True; + sal_Bool bOneLine = sal_True; if ( typeName.isEmpty() ) { typeName = m_typeName; bOneLine = sal_False; } - + if (typeName == "/") return; if (typeName.indexOf( '/' ) == -1 && !bFull) - return; - + return; + if (!bFull) - typeName = typeName.copy( 0, typeName.lastIndexOf( '/' ) ); - + typeName = typeName.copy( 0, typeName.lastIndexOf( '/' ) ); + if (bOpen) { - sal_Int32 nIndex = 0; - do + sal_Int32 nIndex = 0; + do { o << "namespace " << typeName.getToken(0, '/', nIndex); if (bOneLine) @@ -405,18 +402,18 @@ void CorbaType::dumpNameSpace(FileStream& o, sal_Bool bOpen, sal_Bool bFull, con } while( nIndex != -1 ); } else { - sal_Int32 nPos = 0; - do - { - nPos = typeName.lastIndexOf( '/' ); - o << "}"; - if( bOneLine ) - o << " "; - else - o << " // " << typeName.copy( nPos+1 ) << "\n"; - if( nPos != -1 ) - typeName = typeName.copy( 0, nPos ); - } while( nPos != -1 ); + sal_Int32 nPos = 0; + do + { + nPos = typeName.lastIndexOf( '/' ); + o << "}"; + if( bOneLine ) + o << " "; + else + o << " // " << typeName.copy( nPos+1 ) << "\n"; + if( nPos != -1 ) + typeName = typeName.copy( 0, nPos ); + } while( nPos != -1 ); } } @@ -424,18 +421,18 @@ void CorbaType::dumpNameSpace(FileStream& o, sal_Bool bOpen, sal_Bool bFull, con sal_uInt32 CorbaType::getMemberCount() { sal_uInt32 count = m_reader.getMethodCount(); - + sal_uInt32 fieldCount = m_reader.getFieldCount(); RTFieldAccess access = RT_ACCESS_INVALID; for (sal_uInt16 i=0; i < fieldCount; i++) { access = m_reader.getFieldAccess(i); - + if (access != RT_ACCESS_CONST && access != RT_ACCESS_INVALID) count++; - } + } return count; -} +} sal_uInt32 CorbaType::checkInheritedMemberCount(const TypeReader* pReader) { @@ -453,7 +450,7 @@ sal_uInt32 CorbaType::checkInheritedMemberCount(const TypeReader* pReader) TypeReader aSuperReader(m_typeMgr.getTypeReader(superType)); if ( aSuperReader.isValid() ) { - count = checkInheritedMemberCount(&aSuperReader); + count = checkInheritedMemberCount(&aSuperReader); } } @@ -465,24 +462,24 @@ sal_uInt32 CorbaType::checkInheritedMemberCount(const TypeReader* pReader) for (sal_uInt16 i=0; i < fieldCount; i++) { access = pReader->getFieldAccess(i); - + if (access != RT_ACCESS_CONST && access != RT_ACCESS_INVALID) count++; - } + } } return count; -} +} sal_uInt32 CorbaType::getInheritedMemberCount() { if (m_inheritedMemberCount == 0) { - m_inheritedMemberCount = checkInheritedMemberCount(0); + m_inheritedMemberCount = checkInheritedMemberCount(0); } - + return m_inheritedMemberCount; -} +} OString CorbaType::getTypeClass(const OString& type, sal_Bool bCStyle) { @@ -564,9 +561,9 @@ OString CorbaType::getTypeClass(const OString& type, sal_Bool bCStyle) } break; } - + return bCStyle ? "typelib_TypeClass_UNKNOWN" : "::com::sun::star::uno::TypeClass_UNKNOWN"; -} +} OString CorbaType::printUnoType(const OString& type, sal_Bool bConst, sal_Bool bRef, sal_Bool bNative) throw( CannotDumpException ) @@ -575,7 +572,7 @@ OString CorbaType::printUnoType(const OString& type, sal_Bool bConst, sal_Bool b OString sType(checkRealBaseType(type, sal_True)); sal_uInt32 index = sType.lastIndexOf(']'); sal_uInt32 seqNum = (index > 0 ? ((index+1) / 2) : 0); - + OString relType = (index > 0 ? (sType).copy(index+1) : type); RTTypeClass typeClass = m_typeMgr.getTypeClass(relType); @@ -587,7 +584,7 @@ OString CorbaType::printUnoType(const OString& type, sal_Bool bConst, sal_Bool b { ret.append("::com::sun::star::uno::Sequence< "); } - + switch (typeClass) { case RT_TYPE_INTERFACE: @@ -621,15 +618,15 @@ OString CorbaType::printUnoType(const OString& type, sal_Bool bConst, sal_Bool b if (bRef) ret.append("&"); return ret.makeStringAndClear(); -} +} -void CorbaType::dumpUnoType(FileStream& o, const OString& type, +void CorbaType::dumpUnoType(FileStream& o, const OString& type, sal_Bool bConst, sal_Bool bRef, sal_Bool bNative) throw( CannotDumpException ) { OString ret = printUnoType(type, bConst, bRef, bNative); o << ret; -} +} OString CorbaType::printCorbaType(const OString& type, sal_Bool bConst, sal_Bool bRef) throw( CannotDumpException ) @@ -640,7 +637,7 @@ OString CorbaType::printCorbaType(const OString& type, sal_Bool bConst, sal_Bool sal_uInt32 index = sType.lastIndexOf(']'); sal_uInt32 seqNum = (index > 0 ? ((index+1) / 2) : 0); - + OString relType = (index > 0 ? (sType).copy(index+1) : type); RTTypeClass typeClass = m_typeMgr.getTypeClass(relType); @@ -665,7 +662,7 @@ OString CorbaType::printCorbaType(const OString& type, sal_Bool bConst, sal_Bool { ret.append("CORBA_sequence_"); } - + switch (typeClass) { case RT_TYPE_INTERFACE: @@ -687,11 +684,11 @@ OString CorbaType::printCorbaType(const OString& type, sal_Bool bConst, sal_Bool ret.append(relType.replace('/', '_')); break; } - + if (bRef) ret.append("&"); - + return ret.makeStringAndClear(); -} +} sal_Bool CorbaType::isPassedAsPointer(const OString& type) { @@ -701,7 +698,7 @@ sal_Bool CorbaType::isPassedAsPointer(const OString& type) sal_Int32 index = sType.lastIndexOf(']'); sal_Int32 seqNum = (index > 0 ? ((index+1) / 2) : 0); - + OString relType = (index > 0 ? (sType).copy(index+1) : type); if (index > 0) @@ -715,7 +712,7 @@ sal_Bool CorbaType::isPassedAsPointer(const OString& type) fakeTest = "_faked_array_"+sType; TypeReader fakeTestReader = m_typeMgr.getTypeReader(fakeTest); - + if (fakeTestReader.isValid()) ret = sal_False; else @@ -742,7 +739,7 @@ sal_Bool CorbaType::isPassedAsPointer(const OString& type) break; } } - + return ret; } @@ -775,7 +772,7 @@ sal_Bool CorbaType::isArray(const OString& type) sal_Int32 index = sType.lastIndexOf(']'); sal_Int32 seqNum = (index > 0 ? ((index+1) / 2) : 0); - + OString relType = (index > 0 ? (sType).copy(index+1) : type); if (index > 0) @@ -789,11 +786,11 @@ sal_Bool CorbaType::isArray(const OString& type) fakeTest = "_faked_array_"+sType; TypeReader fakeTestReader = m_typeMgr.getTypeReader(fakeTest); - + if (fakeTestReader.isValid()) ret = sal_True; } - + return ret; } @@ -805,7 +802,7 @@ OString CorbaType::printCorbaParameter(const OString& type, sal_Bool bOut) OString sType(type); sal_Int32 index = sType.lastIndexOf(']'); sal_Int32 seqNum = (index > 0 ? ((index+1) / 2) : 0); - + OString relType = (index > 0 ? (sType).copy(index+1) : type); RTTypeClass typeClass = m_typeMgr.getTypeClass(relType); @@ -855,15 +852,15 @@ OString CorbaType::printCorbaParameter(const OString& type, sal_Bool bOut) } return ret.makeStringAndClear(); -} +} -void CorbaType::dumpCorbaType(FileStream& o, const OString& type, +void CorbaType::dumpCorbaType(FileStream& o, const OString& type, sal_Bool bConst, sal_Bool bRef) throw( CannotDumpException ) { OString ret = printCorbaType(type, bConst, bRef); o << ret; -} +} OString CorbaType::getUnoBaseType(const OString& type) { @@ -901,7 +898,7 @@ OString CorbaType::getUnoBaseType(const OString& type) return "sal_uInt64"; return OString(); -} +} OString CorbaType::getCorbaBaseType(const OString& type) { @@ -939,7 +936,7 @@ OString CorbaType::getCorbaBaseType(const OString& type) return "CORBA_unsigned_long_long"; return OString(); -} +} void CorbaType::dumpTypeInit(FileStream& o, const OString& typeName) @@ -947,7 +944,7 @@ void CorbaType::dumpTypeInit(FileStream& o, const OString& typeName) OString type(checkSpecialCorbaType(typeName)); BASETYPE baseType = isBaseType(type); - + switch (baseType) { case BT_BOOLEAN: @@ -966,7 +963,7 @@ void CorbaType::dumpTypeInit(FileStream& o, const OString& typeName) dumpUnoType(o, type); o << ")" << "0)"; return; - } + } RTTypeClass typeClass = m_typeMgr.getTypeClass(type); @@ -977,10 +974,10 @@ void CorbaType::dumpTypeInit(FileStream& o, const OString& typeName) if (aReaderLoader.isLoaded()) { TypeReader reader(m_typeMgr.getTypeReader(type)); - + if ( reader.isValid() ) { - sal_Int32 nPos = type.lastIndexOf( '/' ); + sal_Int32 nPos = type.lastIndexOf( '/' ); o << "(" << shortScopedName("", type, sal_False) << "::" << type.copy( nPos != -1 ? nPos+1 : 0 ) << "_" << reader.getFieldName(0) << ")"; @@ -988,9 +985,9 @@ void CorbaType::dumpTypeInit(FileStream& o, const OString& typeName) } } } - - o << "()"; -} + + o << "()"; +} BASETYPE CorbaType::isBaseType(const OString& type) { @@ -1022,28 +1019,28 @@ BASETYPE CorbaType::isBaseType(const OString& type) return BT_UNSIGNED_SHORT; if (type.equals("unsigned hyper")) return BT_UNSIGNED_HYPER; - + return BT_INVALID; -} +} OString CorbaType::typeToIdentifier(const OString& type) { sal_uInt32 index = type.lastIndexOf(']'); sal_uInt32 seqNum = (index > 0 ? ((index+1) / 2) : 0); - + OString relType = (index > 0 ? ((OString)type).copy(index+1) : type); OString sIdentifier; - + while( seqNum > 0 ) { sIdentifier += OString("seq"); if ( --seqNum == 0 ) { - sIdentifier += OString("_"); + sIdentifier += OString("_"); } } - + if ( isBaseType(relType) ) { sIdentifier += relType.replace(' ', '_'); @@ -1052,9 +1049,9 @@ OString CorbaType::typeToIdentifier(const OString& type) sIdentifier += relType.replace('/', '_'); } - + return sIdentifier; -} +} OString CorbaType::checkSpecialCorbaType(const OString& type) { @@ -1075,7 +1072,7 @@ OString CorbaType::checkSpecialCorbaType(const OString& type) if (reader.isValid()) { typeClass = reader.getTypeClass(); - + if (typeClass == RT_TYPE_TYPEDEF) baseType = reader.getSuperTypeName(); else @@ -1083,9 +1080,9 @@ OString CorbaType::checkSpecialCorbaType(const OString& type) } else break; } - + return baseType; -} +} OString CorbaType::checkRealBaseType(const OString& type, sal_Bool bResolveTypeOnly) { @@ -1100,20 +1097,20 @@ OString CorbaType::checkRealBaseType(const OString& type, sal_Bool bResolveTypeO RTTypeClass typeClass; sal_Bool mustBeChecked = (m_typeMgr.getTypeClass(baseType) == RT_TYPE_TYPEDEF); TypeReader reader; - + while (mustBeChecked) { reader = m_typeMgr.getTypeReader(baseType); - + if (reader.isValid()) { typeClass = reader.getTypeClass(); - + if (typeClass == RT_TYPE_TYPEDEF) { baseType = reader.getSuperTypeName(); index = baseType.lastIndexOf(']'); - if (index > 0) + if (index > 0) { seqPrefix += baseType.copy(0, index+1); baseType = baseType.copy(index+1); @@ -1123,26 +1120,26 @@ OString CorbaType::checkRealBaseType(const OString& type, sal_Bool bResolveTypeO } else break; } - + if ( bResolveTypeOnly ) baseType = seqPrefix + baseType; - + return baseType; -} +} void CorbaType::inc(sal_uInt32 num) { - m_indentLength += num; -} + m_indentLength += num; +} void CorbaType::dec(sal_uInt32 num) { if (m_indentLength - num < 0) m_indentLength = 0; else - m_indentLength -= num; -} + m_indentLength -= num; +} OString CorbaType::indent() { @@ -1153,7 +1150,7 @@ OString CorbaType::indent() tmp.append(' '); } return tmp.makeStringAndClear(); -} +} OString CorbaType::indent(sal_uInt32 num) { @@ -1164,33 +1161,33 @@ OString CorbaType::indent(sal_uInt32 num) tmp.append(' '); } return tmp.makeStringAndClear(); -} +} //************************************************************************* // InterfaceType //************************************************************************* InterfaceType::InterfaceType(TypeReader& typeReader, const OString& typeName, - const TypeManager& typeMgr, - const TypeDependency& typeDependencies, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, TypeSet* generatedConversions) : CorbaType(typeReader, typeName, typeMgr, typeDependencies, generatedConversions) { - m_inheritedMemberCount = 0; + m_inheritedMemberCount = 0; m_hasAttributes = sal_False; m_hasMethods = sal_False; } InterfaceType::~InterfaceType() { - + } void InterfaceType::dumpUnoMethods(FileStream& o, sal_Bool bDeclOnly, sal_Bool bDelegateToSuper) { OString superName(m_reader.getSuperTypeName()); - if (bDeclOnly && + if (bDeclOnly && !superName.equals("Bonobo/NullInterface") && !superName.equals("com/sun/star/uno/XInterface")) { @@ -1203,7 +1200,7 @@ void InterfaceType::dumpUnoMethods(FileStream& o, sal_Bool bDeclOnly, sal_Bool b sal_uInt32 methodCount = m_reader.getMethodCount(); sal_Bool first=sal_True; - OString methodName, returnType, paramType, paramName; + OString methodName, returnType, paramType, paramName; sal_uInt32 paramCount = 0; sal_uInt32 excCount = 0; RTMethodMode methodMode = RT_MODE_INVALID; @@ -1223,13 +1220,13 @@ void InterfaceType::dumpUnoMethods(FileStream& o, sal_Bool bDeclOnly, sal_Bool b if ( methodName.equals("acquire") || methodName.equals("release") ) bWithRunTimeExcp = sal_False; - + if (first) { first = sal_False; o << "\n" << indent() << "// Methods\n"; - } - + } + o << indent(); if (bDeclOnly) o << "virtual "; @@ -1250,7 +1247,7 @@ void InterfaceType::dumpUnoMethods(FileStream& o, sal_Bool bDeclOnly, sal_Bool b paramName = m_reader.getMethodParamName(i, j); paramType = m_reader.getMethodParamType(i, j); paramMode = m_reader.getMethodParamMode(i, j); - + switch (paramMode) { case RT_PARAM_IN: @@ -1273,15 +1270,15 @@ void InterfaceType::dumpUnoMethods(FileStream& o, sal_Bool bDeclOnly, sal_Bool b bConst = sal_False; bRef = sal_True; break; - } - - dumpUnoType(o, paramType, bConst, bRef); + } + + dumpUnoType(o, paramType, bConst, bRef); o << " " << paramName; - + if (j+1 < paramCount) o << ", "; } o << " )"; - + o << " throw("; OString excpName; for (j=0; j < excCount; j++) @@ -1292,10 +1289,10 @@ void InterfaceType::dumpUnoMethods(FileStream& o, sal_Bool bDeclOnly, sal_Bool b if (bWithRunTimeExcp) o << ", "; } - + if ( bWithRunTimeExcp ) { - o << " ::com::sun::star::uno::RuntimeException"; + o << " ::com::sun::star::uno::RuntimeException"; } if (bDeclOnly && bDelegateToSuper) @@ -1487,7 +1484,7 @@ void InterfaceType::dumpUnoMethods(FileStream& o, sal_Bool bDeclOnly, sal_Bool b else o << " );\n"; } -} +} void InterfaceType::dumpCorbaMethods(FileStream& o, sal_Bool bDeclOnly) { @@ -1495,7 +1492,7 @@ void InterfaceType::dumpCorbaMethods(FileStream& o, sal_Bool bDeclOnly) sal_uInt32 methodCount = m_reader.getMethodCount(); - OString methodName, returnType, paramType, paramName; + OString methodName, returnType, paramType, paramName; sal_uInt32 paramCount = 0; sal_uInt32 excCount = 0; RTMethodMode methodMode = RT_MODE_INVALID; @@ -1541,7 +1538,7 @@ void InterfaceType::dumpCorbaMethods(FileStream& o, sal_Bool bDeclOnly) { if (paramMode == RT_PARAM_OUT) o << "**"; - else + else o << "*"; } else @@ -1550,7 +1547,7 @@ void InterfaceType::dumpCorbaMethods(FileStream& o, sal_Bool bDeclOnly) o << "*"; } - + o << " " << paramName << ", "; } @@ -1651,7 +1648,7 @@ void InterfaceType::dumpCorbaMethods(FileStream& o, sal_Bool bDeclOnly) preBuffer.append("*"); preBuffer.append(paramName); preBuffer.append(", ((bonobobridge::UNO_POA_com_sun_star_uno_XInterface*)_servant)->pThis->getBridge());\n"); - + postBuffer.append(" cpp_convert_u2b("); if (isPassedAsPointer(paramType)) postBuffer.append("*"); @@ -1705,7 +1702,7 @@ void InterfaceType::dumpCorbaMethods(FileStream& o, sal_Bool bDeclOnly) o << "}\n"; } } -} +} void InterfaceType::dumpFunctions(FileStream& o) { @@ -1720,7 +1717,7 @@ void InterfaceType::dumpFunctions(FileStream& o) /* bonobo implementation class */ o << "class BonoboWrapper_"; dumpCorbaType(o, m_typeName, sal_False, sal_False); - + OString superName(m_reader.getSuperTypeName()); o << " : public BonoboWrapper< BonoboWrapper_"; dumpCorbaType(o, superName, sal_False, sal_False); @@ -1733,7 +1730,7 @@ void InterfaceType::dumpFunctions(FileStream& o) dumpCorbaType(o, m_typeName, sal_False, sal_False); o << "("; dumpCorbaType(o, m_typeName, sal_False, sal_False); - o << " corbaObject," + o << " corbaObject," << "const vos::ORef<bonobobridge::Bridge>& bridge)\n"; o << " : BonoboWrapper< " @@ -1752,7 +1749,7 @@ void InterfaceType::dumpFunctions(FileStream& o) o << "*)this);\n"; } - o << " }\n"; + o << " }\n"; o << " virtual ~BonoboWrapper_"; dumpCorbaType(o, m_typeName, sal_False, sal_False); @@ -1803,7 +1800,7 @@ void InterfaceType::dumpFunctions(FileStream& o) dumpCorbaType(o, m_typeName, sal_False, sal_False); o << "_epv = {\n"; sal_uInt32 methodCount = m_reader.getMethodCount(); - OString methodName; + OString methodName; o << " NULL,\n"; @@ -1830,7 +1827,7 @@ void InterfaceType::dumpFunctions(FileStream& o) { superName = ""; } - else + else { if (superName.equals("com/sun/star/uno/XInterface")) { @@ -1939,12 +1936,12 @@ void InterfaceType::dumpFunctions(FileStream& o) << " }\n" << " return ret;\n" << "}\n\n"; - + o << "inline sal_Bool bonobobridge::cpp_convert_b2u("; dumpUnoType(o, m_typeName, sal_False, sal_True); o << " u, "; dumpCorbaType(o, m_typeName, sal_True, sal_True); - o << " b, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" + o << " b, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" << " return bridge->convertB2U(&u, &b, ::getCppuType(&u));\n" << "};\n\n"; @@ -1952,7 +1949,7 @@ void InterfaceType::dumpFunctions(FileStream& o) dumpCorbaType(o, m_typeName, sal_False, sal_True); o << " b, "; dumpUnoType(o, m_typeName, sal_True, sal_True); - o << " u, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" + o << " u, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" << " return bridge->convertU2B(&b, &u, ::getCppuType(&u));\n" << "};\n\n"; @@ -1967,22 +1964,22 @@ sal_uInt32 InterfaceType::getMemberCount() sal_uInt32 count = m_reader.getMethodCount(); if (count) - m_hasMethods = sal_True; - + m_hasMethods = sal_True; + sal_uInt32 fieldCount = m_reader.getFieldCount(); RTFieldAccess access = RT_ACCESS_INVALID; for (sal_uInt16 i=0; i < fieldCount; i++) { access = m_reader.getFieldAccess(i); - + if (access != RT_ACCESS_CONST && access != RT_ACCESS_INVALID) { m_hasAttributes = sal_True; count++; } - } + } return count; -} +} sal_uInt32 InterfaceType::checkInheritedMemberCount(const TypeReader* pReader) { @@ -2001,7 +1998,7 @@ sal_uInt32 InterfaceType::checkInheritedMemberCount(const TypeReader* pReader) TypeReader aSuperReader(m_typeMgr.getTypeReader(superType)); if (aSuperReader.isValid()) { - count = checkInheritedMemberCount(&aSuperReader); + count = checkInheritedMemberCount(&aSuperReader); } } @@ -2013,24 +2010,24 @@ sal_uInt32 InterfaceType::checkInheritedMemberCount(const TypeReader* pReader) for (sal_uInt16 i=0; i < fieldCount; i++) { access = pReader->getFieldAccess(i); - + if (access != RT_ACCESS_CONST && access != RT_ACCESS_INVALID) count++; - } + } } return count; -} +} sal_uInt32 InterfaceType::getInheritedMemberCount() { if (m_inheritedMemberCount == 0) { - m_inheritedMemberCount = checkInheritedMemberCount(0); + m_inheritedMemberCount = checkInheritedMemberCount(0); } - + return m_inheritedMemberCount; -} +} @@ -2040,8 +2037,8 @@ sal_uInt32 InterfaceType::getInheritedMemberCount() //************************************************************************* ModuleType::ModuleType(TypeReader& typeReader, const OString& typeName, - const TypeManager& typeMgr, - const TypeDependency& typeDependencies, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, TypeSet* generatedConversions) : CorbaType(typeReader, typeName, typeMgr, typeDependencies, generatedConversions) { @@ -2049,8 +2046,8 @@ ModuleType::ModuleType(TypeReader& typeReader, ModuleType::~ModuleType() { - -} + +} sal_Bool ModuleType::hasConstants() @@ -2061,13 +2058,13 @@ sal_Bool ModuleType::hasConstants() for (sal_uInt16 i=0; i < fieldCount; i++) { access = m_reader.getFieldAccess(i); - + if (access == RT_ACCESS_CONST) return sal_True; } - + return sal_False; -} +} void ModuleType::dumpFunctions(FileStream& o) { @@ -2093,8 +2090,8 @@ sal_Bool ModuleType::dumpConversionFunctions(FileStream& o, TypeSet* allreadyDum //************************************************************************* ConstantsType::ConstantsType(TypeReader& typeReader, const OString& typeName, - const TypeManager& typeMgr, - const TypeDependency& typeDependencies, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, TypeSet* generatedConversions) : ModuleType(typeReader, typeName, typeMgr, typeDependencies, generatedConversions) { @@ -2102,8 +2099,8 @@ ConstantsType::ConstantsType(TypeReader& typeReader, ConstantsType::~ConstantsType() { - -} + +} void ConstantsType::dumpFunctions(FileStream& o) { @@ -2114,8 +2111,8 @@ void ConstantsType::dumpFunctions(FileStream& o) //************************************************************************* StructureType::StructureType(TypeReader& typeReader, const OString& typeName, - const TypeManager& typeMgr, - const TypeDependency& typeDependencies, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, TypeSet* generatedConversions) : CorbaType(typeReader, typeName, typeMgr, typeDependencies, generatedConversions) { @@ -2123,8 +2120,8 @@ StructureType::StructureType(TypeReader& typeReader, StructureType::~StructureType() { - -} + +} void StructureType::dumpFunctions(FileStream& o) { @@ -2146,7 +2143,7 @@ void StructureType::dumpFunctions(FileStream& o) sal_uInt32 fieldCount = m_reader.getFieldCount(); OString fieldName; - OString fieldType; + OString fieldType; sal_uInt16 i=0; sal_Int32 cIndex; OString corbaFieldName; @@ -2186,12 +2183,12 @@ void StructureType::dumpFunctions(FileStream& o) o << " // fix me: no conversion of array types!\n"; else o << " if (ret)\n" - << " ret = bonobobridge::cpp_convert_b2u(" - << "_u." << fieldName.getStr() + << " ret = bonobobridge::cpp_convert_b2u(" + << "_u." << fieldName.getStr() << " , _b." << corbaFieldName.getStr() << ", bridge);\n"; - } - } + } + } o << " return ret;\n" << "}\n\n" << "static sal_Bool convert_u2b_" << m_typeName.replace('/', '_') @@ -2223,7 +2220,7 @@ void StructureType::dumpFunctions(FileStream& o) { fieldName = m_reader.getFieldName(i); fieldType = m_reader.getFieldType(i); - + cIndex = fieldName.indexOf("_reserved_identifier_"); if (cIndex == 0) @@ -2235,11 +2232,11 @@ void StructureType::dumpFunctions(FileStream& o) o << " // fix me: no conversion of array types!\n"; else o << " if (ret)\n" - << " ret = bonobobridge::cpp_convert_u2b(" - << "_b." << corbaFieldName.getStr() + << " ret = bonobobridge::cpp_convert_u2b(" + << "_b." << corbaFieldName.getStr() << ", _u." << fieldName.getStr() << ", bridge);\n"; - } + } } o << " return ret;\n" @@ -2250,16 +2247,16 @@ void StructureType::dumpFunctions(FileStream& o) o << " u , "; dumpCorbaType(o, m_typeName, sal_True, sal_True); o << " b, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" - << " return convert_b2u_" << m_typeName.replace('/', '_') + << " return convert_b2u_" << m_typeName.replace('/', '_') << "(&u, &b, ::getCppuType(&u), bridge);\n" << "};\n\n"; - + o << "inline sal_Bool bonobobridge::cpp_convert_u2b("; dumpCorbaType(o, m_typeName, sal_False, sal_True); o << " b, "; dumpUnoType(o, m_typeName, sal_True, sal_True); - o << " u, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" - << " return convert_u2b_" << m_typeName.replace('/', '_') + o << " u, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" + << " return convert_u2b_" << m_typeName.replace('/', '_') << "(&b, &u, ::getCppuType(&u), bridge);\n" << "};\n\n"; } @@ -2271,7 +2268,7 @@ sal_Bool StructureType::dumpSuperMember(FileStream& o, const OString& superType, if ( !superType.isEmpty() ) { TypeReader aSuperReader(m_typeMgr.getTypeReader(superType)); - + if (aSuperReader.isValid()) { hasMember = dumpSuperMember(o, aSuperReader.getSuperTypeName(), bWithType); @@ -2279,18 +2276,18 @@ sal_Bool StructureType::dumpSuperMember(FileStream& o, const OString& superType, sal_uInt32 fieldCount = aSuperReader.getFieldCount(); RTFieldAccess access = RT_ACCESS_INVALID; OString fieldName; - OString fieldType; + OString fieldType; for (sal_uInt16 i=0; i < fieldCount; i++) { access = aSuperReader.getFieldAccess(i); - + if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID) continue; fieldName = aSuperReader.getFieldName(i); fieldType = aSuperReader.getFieldType(i); - - if (hasMember) + + if (hasMember) { o << ", "; } else @@ -2300,24 +2297,24 @@ sal_Bool StructureType::dumpSuperMember(FileStream& o, const OString& superType, if (bWithType) { - dumpUnoType(o, fieldType, sal_True, sal_True); + dumpUnoType(o, fieldType, sal_True, sal_True); o << " "; - } + } o << "__" << fieldName; } } } - + return hasMember; -} +} //************************************************************************* // ExceptionType //************************************************************************* ExceptionType::ExceptionType(TypeReader& typeReader, const OString& typeName, - const TypeManager& typeMgr, - const TypeDependency& typeDependencies, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, TypeSet* generatedConversions) : CorbaType(typeReader, typeName, typeMgr, typeDependencies, generatedConversions) { @@ -2325,7 +2322,7 @@ ExceptionType::ExceptionType(TypeReader& typeReader, ExceptionType::~ExceptionType() { - + } void ExceptionType::dumpFunctions(FileStream& o) @@ -2354,7 +2351,7 @@ void ExceptionType::dumpFunctions(FileStream& o) sal_uInt32 fieldCount = m_reader.getFieldCount(); OString fieldName; - OString fieldType; + OString fieldType; sal_uInt16 i=0; sal_Int32 cIndex; OString corbaFieldName; @@ -2378,16 +2375,16 @@ void ExceptionType::dumpFunctions(FileStream& o) corbaFieldName = fieldName.copy(OString("_reserved_identifier_").getLength()); else corbaFieldName = fieldName; - + if (isArray(fieldType)) o << " // fix me: no conversion of array types!\n"; else o << " if (ret)\n" - << " ret = bonobobridge::cpp_convert_b2u(" - << "_u." << fieldName.getStr() + << " ret = bonobobridge::cpp_convert_b2u(" + << "_u." << fieldName.getStr() << ", _b." << corbaFieldName.getStr() << ", bridge);\n"; - } + } o << " return ret;\n" << "}\n\n"; @@ -2412,12 +2409,12 @@ void ExceptionType::dumpFunctions(FileStream& o) dumpUnoType(o, superType, sal_False, sal_False); o << "&) _b, bridge);\n"; } - + for (i=0; i < fieldCount; i++) { fieldName = m_reader.getFieldName(i); fieldType = m_reader.getFieldType(i); - + cIndex = fieldName.indexOf("_reserved_identifier_"); if (cIndex == 0) @@ -2429,11 +2426,11 @@ void ExceptionType::dumpFunctions(FileStream& o) o << " // fix me: no conversion of array types!\n"; else o << " if (ret)\n" - << " ret = bonobobridge::cpp_convert_u2b(" - << "_b." << corbaFieldName.getStr() + << " ret = bonobobridge::cpp_convert_u2b(" + << "_b." << corbaFieldName.getStr() << ", _u." << fieldName.getStr() << ", bridge);\n"; - } + } o << " return ret;\n" << "}\n\n"; @@ -2443,16 +2440,16 @@ void ExceptionType::dumpFunctions(FileStream& o) o << " u , "; dumpCorbaType(o, m_typeName, sal_True, sal_True); o << " b, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" - << " return convert_b2u_" << m_typeName.replace('/', '_') + << " return convert_b2u_" << m_typeName.replace('/', '_') << "(&u, &b, ::getCppuType(&u), bridge);\n" << "};\n\n"; - + o << "inline sal_Bool bonobobridge::cpp_convert_u2b("; dumpCorbaType(o, m_typeName, sal_False, sal_True); o << " b, "; dumpUnoType(o, m_typeName, sal_True, sal_True); - o << " u, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" - << " return convert_u2b_" << m_typeName.replace('/', '_') + o << " u, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" + << " return convert_u2b_" << m_typeName.replace('/', '_') << "(&b, &u, ::getCppuType(&u), bridge);\n" << "};\n\n"; } @@ -2466,7 +2463,7 @@ sal_Bool ExceptionType::dumpSuperMember(FileStream& o, const OString& superType, if ( !superType.isEmpty() ) { TypeReader aSuperReader(m_typeMgr.getTypeReader(superType)); - + if (aSuperReader.isValid()) { hasMember = dumpSuperMember(o, aSuperReader.getSuperTypeName(), bWithType); @@ -2474,18 +2471,18 @@ sal_Bool ExceptionType::dumpSuperMember(FileStream& o, const OString& superType, sal_uInt32 fieldCount = aSuperReader.getFieldCount(); RTFieldAccess access = RT_ACCESS_INVALID; OString fieldName; - OString fieldType; + OString fieldType; for (sal_uInt16 i=0; i < fieldCount; i++) { access = aSuperReader.getFieldAccess(i); - + if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID) continue; fieldName = aSuperReader.getFieldName(i); fieldType = aSuperReader.getFieldType(i); - - if (hasMember) + + if (hasMember) { o << ", "; } else @@ -2495,24 +2492,24 @@ sal_Bool ExceptionType::dumpSuperMember(FileStream& o, const OString& superType, if (bWithType) { - dumpUnoType(o, fieldType, sal_True, sal_True); + dumpUnoType(o, fieldType, sal_True, sal_True); o << " "; - } + } o << "__" << fieldName; } } } - + return hasMember; -} +} //************************************************************************* // EnumType //************************************************************************* EnumType::EnumType(TypeReader& typeReader, const OString& typeName, - const TypeManager& typeMgr, - const TypeDependency& typeDependencies, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, TypeSet* generatedConversions) : CorbaType(typeReader, typeName, typeMgr, typeDependencies, generatedConversions) { @@ -2520,7 +2517,7 @@ EnumType::EnumType(TypeReader& typeReader, EnumType::~EnumType() { - + } void EnumType::dumpFunctions(FileStream& o) @@ -2559,16 +2556,16 @@ void EnumType::dumpFunctions(FileStream& o) o << " u , "; dumpCorbaType(o, m_typeName, sal_True, sal_True); o << " b, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" - << " return convert_b2u_" << m_typeName.replace('/', '_') + << " return convert_b2u_" << m_typeName.replace('/', '_') << "(&u, &b, ::getCppuType(&u), bridge);\n" << "};\n\n"; - + o << "inline sal_Bool bonobobridge::cpp_convert_u2b("; dumpCorbaType(o, m_typeName, sal_False, sal_True); o << " b, "; dumpUnoType(o, m_typeName, sal_True, sal_True); - o << " u, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" - << " return convert_u2b_" << m_typeName.replace('/', '_') + o << " u, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" + << " return convert_u2b_" << m_typeName.replace('/', '_') << "(&b, &u, ::getCppuType(&u), bridge);\n" << "};\n\n"; @@ -2581,8 +2578,8 @@ void EnumType::dumpFunctions(FileStream& o) //************************************************************************* TypeDefType::TypeDefType(TypeReader& typeReader, const OString& typeName, - const TypeManager& typeMgr, - const TypeDependency& typeDependencies, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, TypeSet* generatedConversions) : CorbaType(typeReader, typeName, typeMgr, typeDependencies, generatedConversions) { @@ -2590,7 +2587,7 @@ TypeDefType::TypeDefType(TypeReader& typeReader, TypeDefType::~TypeDefType() { - + } void TypeDefType::dumpFunctions(FileStream& o) @@ -2603,10 +2600,10 @@ void TypeDefType::dumpFunctions(FileStream& o) // produceType //************************************************************************* sal_Bool produceType(const OString& typeName, - TypeManager& typeMgr, + TypeManager& typeMgr, TypeDependency& typeDependencies, CorbaOptions* pOptions, - FileStream& o, TypeSet* allreadyDumped, + FileStream& o, TypeSet* allreadyDumped, TypeSet* generatedConversions) throw( CannotDumpException ) { @@ -2614,23 +2611,23 @@ sal_Bool produceType(const OString& typeName, sal_Bool ret = sal_True; if (bNewTypeSet) - allreadyDumped = new TypeSet(); + allreadyDumped = new TypeSet(); if (!typeDependencies.isGenerated(typeName)) { - TypeReader reader(typeMgr.getTypeReader(typeName)); + TypeReader reader(typeMgr.getTypeReader(typeName)); if (!reader.isValid() && !typeName.equals("/")) ret = sal_False; if( ret && !checkTypeDependencies(typeMgr, typeDependencies, typeName)) ret = sal_False; - + if (ret) { RTTypeClass typeClass = reader.getTypeClass(); - + switch (typeClass) { case RT_TYPE_INTERFACE: @@ -2711,7 +2708,7 @@ sal_Bool produceType(const OString& typeName, if (bNewTypeSet) delete allreadyDumped; - + return ret; } @@ -2719,9 +2716,9 @@ sal_Bool produceType(const OString& typeName, // scopedName //************************************************************************* OString scopedName(const OString& scope, const OString& type, - sal_Bool bNoNameSpace) + sal_Bool bNoNameSpace) { - sal_Int32 nPos = type.lastIndexOf( '/' ); + sal_Int32 nPos = type.lastIndexOf( '/' ); if (nPos == -1) return type; @@ -2729,25 +2726,25 @@ OString scopedName(const OString& scope, const OString& type, return type.copy(nPos+1); OStringBuffer tmpBuf(type.getLength()*2); - nPos = 0; - do + nPos = 0; + do { tmpBuf.append("::"); tmpBuf.append(type.getToken(0, '/', nPos)); } while( nPos != -1 ); - + return tmpBuf.makeStringAndClear(); -} +} //************************************************************************* // shortScopedName //************************************************************************* OString shortScopedName(const OString& scope, const OString& type, - sal_Bool bNoNameSpace) + sal_Bool bNoNameSpace) { - sal_Int32 nPos = type.lastIndexOf( '/' ); - if( nPos == -1 ) - return OString(); + sal_Int32 nPos = type.lastIndexOf( '/' ); + if( nPos == -1 ) + return OString(); if (bNoNameSpace) return OString(); @@ -2757,22 +2754,22 @@ OString shortScopedName(const OString& scope, const OString& type, { OString tmpScp(scope.copy(0, scope.lastIndexOf('/'))); OString tmpScp2(type.copy(0, nPos)); - + if (tmpScp == tmpScp2) return OString(); } - OString aScope( type.copy( 0, nPos ) ); + OString aScope( type.copy( 0, nPos ) ); OStringBuffer tmpBuf(aScope.getLength()*2); - - nPos = 0; - do + + nPos = 0; + do { tmpBuf.append("::"); tmpBuf.append(aScope.getToken(0, '/', nPos)); } while( nPos != -1 ); - - return tmpBuf.makeStringAndClear(); -} + return tmpBuf.makeStringAndClear(); +} +/* vim: set noet sw=4 ts=4: */