diff options
-rw-r--r-- | unodevtools/inc/unodevtools/options.hxx | 70 | ||||
-rw-r--r-- | unodevtools/inc/unodevtools/typemanager.hxx | 74 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/cppcompskeleton.cxx | 309 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/cpptypemaker.cxx | 273 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/javacompskeleton.cxx | 251 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/javatypemaker.cxx | 431 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/makefile.mk | 68 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/skeletoncommon.cxx | 259 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/skeletoncommon.hxx | 117 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/skeletoncpp.hxx | 81 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/skeletonjava.hxx | 82 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/skeletonmaker.cxx | 92 | ||||
-rw-r--r-- | unodevtools/source/unodevtools/makefile.mk | 69 | ||||
-rw-r--r-- | unodevtools/source/unodevtools/options.cxx | 70 | ||||
-rw-r--r-- | unodevtools/source/unodevtools/typeblob.cxx | 119 | ||||
-rw-r--r-- | unodevtools/source/unodevtools/typemanager.cxx | 70 |
16 files changed, 1291 insertions, 1144 deletions
diff --git a/unodevtools/inc/unodevtools/options.hxx b/unodevtools/inc/unodevtools/options.hxx index b2e4061c91ee..70375856ce05 100644 --- a/unodevtools/inc/unodevtools/options.hxx +++ b/unodevtools/inc/unodevtools/options.hxx @@ -1,68 +1,44 @@ /************************************************************************* * - * $RCSfile: options.hxx,v $ - * - * $Revision: 1.1 $ - * - * last change: $Author: jsc $ $Date: 2005-08-23 08:23:10 $ - * - * The Contents of this file are made available subject to the terms of - * either of the following licenses - * - * - GNU Lesser General Public License Version 2.1 - * - Sun Industry Standards Source License Version 1.1 + * OpenOffice.org - a multi-platform office productivity suite * - * Sun Microsystems Inc., October, 2000 - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2000 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * $RCSfile: options.hxx,v $ * + * $Revision: 1.2 $ * - * Sun Industry Standards Source License Version 1.1 - * ================================================= - * The contents of this file are subject to the Sun Industry Standards - * Source License Version 1.1 (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.openoffice.org/license.html. + * last change: $Author: jsc $ $Date: 2005-09-09 13:50:24 $ * - * Software provided under this License is provided on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, - * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. - * See the License for the specific provisions governing your rights and - * obligations concerning the Software. + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. * - * The Initial Developer of the Original Code is: Sun Microsystems, Inc. * - * Copyright: 2000 by Sun Microsystems, Inc. + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA * - * All Rights Reserved. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. * - * Contributor(s): _______________________________________ + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA * ************************************************************************/ #ifndef _UNODEVTOOLS_OPTIONS_HXX_ #define _UNODEVTOOLS_OPTIONS_HXX_ +#ifndef _RTL_USTRBUF_HXX_ #include <rtl/ustrbuf.hxx> +#endif namespace com { namespace sun { namespace star { namespace uno { class RuntimeException; diff --git a/unodevtools/inc/unodevtools/typemanager.hxx b/unodevtools/inc/unodevtools/typemanager.hxx index a56be9f28d51..af12122482b8 100644 --- a/unodevtools/inc/unodevtools/typemanager.hxx +++ b/unodevtools/inc/unodevtools/typemanager.hxx @@ -1,70 +1,50 @@ /************************************************************************* * - * $RCSfile: typemanager.hxx,v $ - * - * $Revision: 1.1 $ - * - * last change: $Author: jsc $ $Date: 2005-08-23 08:23:22 $ - * - * The Contents of this file are made available subject to the terms of - * either of the following licenses - * - * - GNU Lesser General Public License Version 2.1 - * - Sun Industry Standards Source License Version 1.1 - * - * Sun Microsystems Inc., October, 2000 - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2000 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA + * OpenOffice.org - a multi-platform office productivity suite * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * $RCSfile: typemanager.hxx,v $ * + * $Revision: 1.2 $ * - * Sun Industry Standards Source License Version 1.1 - * ================================================= - * The contents of this file are subject to the Sun Industry Standards - * Source License Version 1.1 (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.openoffice.org/license.html. + * last change: $Author: jsc $ $Date: 2005-09-09 13:50:25 $ * - * Software provided under this License is provided on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, - * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. - * See the License for the specific provisions governing your rights and - * obligations concerning the Software. + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. * - * The Initial Developer of the Original Code is: Sun Microsystems, Inc. * - * Copyright: 2000 by Sun Microsystems, Inc. + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA * - * All Rights Reserved. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. * - * Contributor(s): _______________________________________ + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA * ************************************************************************/ #ifndef _UNODEVTOOLS_TYPEMANAGER_HXX_ #define _UNODEVTOOLS_TYPEMANAGER_HXX_ +#ifndef _REGISTRY_REGISTRY_HXX_ #include <registry/registry.hxx> +#endif +#ifndef _CODEMAKER_TYPEMANAGER_HXX_ #include <codemaker/typemanager.hxx> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMEACCESS_HPP_ #include <com/sun/star/container/XHierarchicalNameAccess.hpp> +#endif #include <hash_map> #include <vector> diff --git a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx index 78a29ad4aa37..180ff8fcfad4 100644 --- a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx +++ b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx @@ -1,74 +1,53 @@ /************************************************************************* * - * $RCSfile: cppcompskeleton.cxx,v $ - * - * $Revision: 1.1 $ - * - * last change: $Author: jsc $ $Date: 2005-08-23 08:29:47 $ - * - * The Contents of this file are made available subject to the terms of - * either of the following licenses - * - * - GNU Lesser General Public License Version 2.1 - * - Sun Industry Standards Source License Version 1.1 - * - * Sun Microsystems Inc., October, 2000 - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2000 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA + * OpenOffice.org - a multi-platform office productivity suite * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * $RCSfile: cppcompskeleton.cxx,v $ * + * $Revision: 1.2 $ * - * Sun Industry Standards Source License Version 1.1 - * ================================================= - * The contents of this file are subject to the Sun Industry Standards - * Source License Version 1.1 (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.openoffice.org/license.html. + * last change: $Author: jsc $ $Date: 2005-09-09 13:50:27 $ * - * Software provided under this License is provided on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, - * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. - * See the License for the specific provisions governing your rights and - * obligations concerning the Software. + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. * - * The Initial Developer of the Original Code is: Sun Microsystems, Inc. * - * Copyright: 2000 by Sun Microsystems, Inc. + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA * - * All Rights Reserved. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. * - * Contributor(s): _______________________________________ + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA * ************************************************************************/ +#include <codemaker/commoncpp.hxx> + #include "skeletoncpp.hxx" +#include <iostream> + +using namespace ::rtl; using namespace ::codemaker::cpp; namespace skeletonmaker { namespace cpp { void generateIncludes(std::ostream & o, - const std::hash_set< rtl::OString, rtl::OStringHash >& interfaces, + const std::hash_set< OString, OStringHash >& interfaces, const StringPairHashMap& properties, - bool attributes, bool propertyhelper, bool serviceobject, + OString propertyhelper, bool serviceobject, bool supportxcomponent) { if (serviceobject) { @@ -82,10 +61,14 @@ void generateIncludes(std::ostream & o, o << "#include <cppuhelper/implbase" << interfaces.size() << ".hxx>\n"; - if (attributes && propertyhelper) - o << "#include <cppuhelper/propertysetmixin.hxx>\n"; + if (propertyhelper.getLength() > 0) { + if (propertyhelper.equals("_")) + o << "#include <cppuhelper/rpopshlp.hxx>\n"; + else + o << "#include <cppuhelper/propertysetmixin.hxx>\n"; + } - std::hash_set< rtl::OString, rtl::OStringHash >::const_iterator iter = interfaces.begin(); + std::hash_set< OString, OStringHash >::const_iterator iter = interfaces.begin(); while (iter != interfaces.end()) { o << "#include <" << ((*iter).replace('.', '/').getStr()) @@ -94,7 +77,7 @@ void generateIncludes(std::ostream & o, } } -short generateNamespace(std::ostream & o, const rtl::OString & implname) +short generateNamespace(std::ostream & o, const OString & implname) { short count=0; sal_Int32 index = implname.lastIndexOf('.'); @@ -114,17 +97,17 @@ short generateNamespace(std::ostream & o, const rtl::OString & implname) } void generateServiceHelper(std::ostream & o, - const rtl::OString & implname, - const std::hash_set< rtl::OString, rtl::OStringHash >& services) + const OString & implname, + const std::hash_set< OString, OStringHash >& services) { - o << "rtl::OUString SAL_CALL _getImplementationName() {\n" + o << "::rtl::OUString SAL_CALL _getImplementationName() {\n" << " return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\n" << " \"" << implname << "\"));\n}\n\n"; o << "css::uno::Sequence< rtl::OUString > SAL_CALL _getSupportedServiceNames()\n{\n" << " css::uno::Sequence< rtl::OUString > s(" << services.size() << ");\n"; - std::hash_set< rtl::OString, rtl::OStringHash >::const_iterator iter = services.begin(); + std::hash_set< OString, OStringHash >::const_iterator iter = services.begin(); short i=0; while (iter != services.end()) { o << " s[" << i++ << "] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\n" @@ -134,7 +117,7 @@ void generateServiceHelper(std::ostream & o, o << " return s;\n}\n\n"; } -void generateCreateFunction(std::ostream & o, const rtl::OString & classname) +void generateCreateFunction(std::ostream & o, const OString & classname) { o << "css::uno::Reference< css::uno::XInterface > SAL_CALL _create(\n" << " css::uno::Reference< css::uno::XComponentContext > const & context)\n" @@ -143,7 +126,7 @@ void generateCreateFunction(std::ostream & o, const rtl::OString & classname) << classname << "(context));\n}\n\n"; } -void generateCompFunctions(std::ostream & o, const rtl::OString & nmspace) +void generateCompFunctions(std::ostream & o, const OString & nmspace) { o << "static struct cppu::ImplementationEntry entries[] = {\n" << " { &" << nmspace << "_create, &" @@ -167,27 +150,35 @@ void generateCompFunctions(std::ostream & o, const rtl::OString & nmspace) << "serviceManager, registryKey, entries);\n}\n"; } -void generateClassDefinition(std::ostream& o, +OString generateClassDefinition(std::ostream& o, ProgramOptions const & options, TypeManager const & manager, - const rtl::OString & classname, - const std::hash_set< rtl::OString, rtl::OStringHash >& interfaces, + const OString & classname, + const std::hash_set< OString, OStringHash >& interfaces, const StringPairHashMap& properties, - const rtl::OString& propertyhelper, bool supportxcomponent) + const StringPairHashMap& attributes, + const std::hash_set< OString, OStringHash >& propinterfaces, + const OString& propertyhelper, bool supportxcomponent) { + OStringBuffer parentname(64); o << "class " << classname << ":\n"; - if (propertyhelper.getLength() > 0) - o << " public cppuhelper::PropertySetMixin< " + if (propertyhelper.getLength() > 1) + o << " public cppu::PropertySetMixin< " << scopedCppName(propertyhelper, false, true) << " >,\n"; if (!interfaces.empty()) { - if (supportxcomponent) + if (supportxcomponent) { + parentname.append("cppu::WeakComponentImplHelper"); + parentname.append(static_cast<sal_Int32>(interfaces.size())); o << " private cppu::BaseMutex,\n" << " public cppu::WeakComponentImplHelper" << interfaces.size() << "<"; - else + } else { + parentname.append("cppu::WeakImplHelper"); + parentname.append(static_cast<sal_Int32>(interfaces.size())); o << " public cppu::WeakImplHelper" << interfaces.size() << "<"; - std::hash_set< rtl::OString, rtl::OStringHash >::const_iterator iter = + } + std::hash_set< OString, OStringHash >::const_iterator iter = interfaces.begin(); while (iter != interfaces.end()) { o << "\n " << scopedCppName(*iter, false, true); @@ -202,7 +193,34 @@ void generateClassDefinition(std::ostream& o, << " explicit " << classname << "(" << "css::uno::Reference< css::uno::XComponentContext > const & context);\n\n"; - std::hash_set< rtl::OString, rtl::OStringHash >::const_iterator iter = + // overload queryInterface + if (propertyhelper.getLength() > 0) { + o << " /* ::com::sun::star::uno::XInterface */\n" + " virtual css::uno::Any SAL_CALL queryInterface(" + "css::uno::Type const & type) throw (" + "css::uno::RuntimeException);\n"; + + OStringBuffer buffer(256); + buffer.append(parentname); + buffer.append("< "); + std::hash_set< OString, OStringHash >::const_iterator iter = + interfaces.begin(); + while (iter != interfaces.end()) { + buffer.append(scopedCppName(*iter, false, true)); + iter++; + if (iter != interfaces.end()) + buffer.append(", "); + else + buffer.append(" >"); + } + OString parent(buffer.makeStringAndClear()); + o << " virtual void SAL_CALL acquire() throw ()\n { " + << parent << "::acquire(); }\n"; + o << " virtual void SAL_CALL release() throw ()\n { " + << parent << "::release(); }\n\n"; + } + + std::hash_set< OString, OStringHash >::const_iterator iter = interfaces.begin(); codemaker::GeneratedTypeSet generated; while (iter != interfaces.end()) { @@ -230,6 +248,15 @@ void generateClassDefinition(std::ostream& o, o << " m_" << iter->first << ";\n"; iter++; } + } else if (!attributes.empty()) { + StringPairHashMap::const_iterator iter = attributes.begin(); + while (iter != attributes.end()) { + o << " "; + printType(o, options, manager, iter->second.first.replace('.','/'), + 1, false, false); + o << " m_" << iter->first << ";\n"; + iter++; + } } o << "};\n\n"; @@ -240,7 +267,7 @@ void generateClassDefinition(std::ostream& o, << "(css::uno::Reference< css::uno::XComponentContext > const & context) :\n"; if (supportxcomponent) { o << " cppu::WeakComponentImplHelper" << interfaces.size() << "<"; - std::hash_set< rtl::OString, rtl::OStringHash >::const_iterator iter = + std::hash_set< OString, OStringHash >::const_iterator iter = interfaces.begin(); while (iter != interfaces.end()) { o << "\n " << scopedCppName(*iter, false, true); @@ -251,18 +278,39 @@ void generateClassDefinition(std::ostream& o, o << ">(m_mutex),\n"; } } - if (propertyhelper.getLength() > 0) - o << " cppuhelper::PropertySetMixin< " + if (propertyhelper.getLength() > 0) { + o << " cppu::PropertySetMixin< " << scopedCppName(propertyhelper, false, true) << " >(\n" - << " context, static_cast< Implements >(\n " - << "IMPLEMENTS_PROPERTY_SET | IMPLEMENTS_FAST_PROPERTY_SET " - << "| IMPLEMENTS_PROPERTY_ACCESS)),\n"; + << " context, static_cast< Implements >(\n "; + OStringBuffer buffer(128); + if (propinterfaces.find("com/sun/star/beans/XPropertySet") + != propinterfaces.end()) + buffer.append("IMPLEMENTS_PROPERTY_SET"); + if (propinterfaces.find("com/sun/star/beans/XFastPropertySet") + != propinterfaces.end()) { + if (buffer.getLength() > 0) + buffer.append(" | IMPLEMENTS_FAST_PROPERTY_SET"); + else + buffer.append("IMPLEMENTS_FAST_PROPERTY_SET"); + } + if (propinterfaces.find("com/sun/star/beans/XPropertyAccess") + != propinterfaces.end()) { + if (buffer.getLength() > 0) + buffer.append(" | IMPLEMENTS_PROPERTY_ACCESS"); + else + buffer.append("IMPLEMENTS_PROPERTY_ACCESS"); + } + o << buffer.makeStringAndClear() + << "), css::uno::Sequence< ::rtl::OUString >()),\n"; + } o << " m_xContext(context)\n{}\n\n"; + + return parentname.makeStringAndClear(); } void generateXServiceInfoBodies(std::ostream& o, - const rtl::OString & classname) + const OString & classname) { o << "/* com.sun.star.uno.XServiceInfo */\n" << "rtl::OUString SAL_CALL " << classname << "getImplementationName() " @@ -287,11 +335,12 @@ void generateXServiceInfoBodies(std::ostream& o, void generateMethodBodies(std::ostream& o, ProgramOptions const & options, TypeManager const & manager, - const rtl::OString & classname, - const std::hash_set< rtl::OString, rtl::OStringHash >& interfaces) + const OString & classname, + const std::hash_set< OString, OStringHash >& interfaces, + bool usepropertymixin) { - rtl::OString name(classname.concat("::")); - std::hash_set< rtl::OString, rtl::OStringHash >::const_iterator iter = + OString name(classname.concat("::")); + std::hash_set< OString, OStringHash >::const_iterator iter = interfaces.begin(); codemaker::GeneratedTypeSet generated; while (iter != interfaces.end()) { @@ -300,31 +349,82 @@ void generateMethodBodies(std::ostream& o, } else { typereg::Reader reader(manager.getTypeReader((*iter).replace('.','/'))); printMethods(o, options, manager, reader, generated, "_", - name, "", true, true); + name, "", true, true, usepropertymixin); } iter++; } } +void generateQueryInterface(std::ostream& o, + ProgramOptions const & options, + TypeManager const & manager, + const std::hash_set< OString, OStringHash >& interfaces, + OString const & parentname, + OString const & classname, + OString const & propertyhelper) +{ + if (propertyhelper.getLength() == 0) + return; + + o << "css::uno::Any " << classname + << "::queryInterface(css::uno::Type const & type) throw (" + "css::uno::RuntimeException)\n{\n "; + + if (propertyhelper.getLength() == 0) + o << "return "; + else + o << "css::uno::Any a("; + + o << parentname << "<"; + std::hash_set< OString, OStringHash >::const_iterator iter = + interfaces.begin(); + while (iter != interfaces.end()) { + o << "\n " << scopedCppName(*iter, false, true); + iter++; + if (iter != interfaces.end()) + o << ","; + else + o << ">"; + } + + if (propertyhelper.getLength() == 0) { + o << "::queryInterface(type);\n"; + } else { + o << "::queryInterface(type));\n"; + o << " return a.hasValue() ? a\n : ("; + if (propertyhelper.equals("_")) { + o << "cppu::OPropertySetHelper::queryInterface(type));\n"; + } else { + o << "cppu::PropertySetMixin<\n "; + printType(o, options, manager, propertyhelper.replace('.', '/'), + 0, false, false); + o << " >::queryInterface(\n type));\n"; + } + } + o << "}\n\n"; +} + void generateSkeleton(ProgramOptions const & options, - TypeManager const & manager, - std::vector< rtl::OString > const & types, - rtl::OString const & delegate) + TypeManager const & manager, + std::vector< OString > const & types, + OString const & delegate) { - std::hash_set< rtl::OString, rtl::OStringHash > interfaces; - std::hash_set< rtl::OString, rtl::OStringHash > services; + std::hash_set< OString, OStringHash > interfaces; + std::hash_set< OString, OStringHash > services; StringPairHashMap properties; - bool attributes = false; + StringPairHashMap attributes; + std::hash_set< OString, OStringHash > propinterfaces; bool serviceobject = false; bool supportxcomponent = false; - std::vector< rtl::OString >::const_iterator iter = types.begin(); + std::vector< OString >::const_iterator iter = types.begin(); while (iter != types.end()) { - checkType(manager, *iter, interfaces, services, properties, attributes); + checkType(manager, *iter, interfaces, services, properties); iter++; } - rtl::OString propertyhelper = checkPropertyHelper(manager, services); + OString propertyhelper = checkPropertyHelper(manager, services, + attributes, propinterfaces); checkDefaultInterfaces(interfaces, services, propertyhelper); @@ -337,19 +437,19 @@ void generateSkeleton(ProgramOptions const & options, supportxcomponent = checkXComponentSupport(manager, interfaces); - rtl::OString compFileName(createFileNameFromType( + OString compFileName(createFileNameFromType( options.outputpath, options.implname.replace('.','/'), ".cxx")); - rtl::OString tmpDir = getTempDir(compFileName); + OString tmpDir = getTempDir(compFileName); FileStream file; file.createTempFile(tmpDir); - rtl::OString tmpFileName; + OString tmpFileName; if(!file.isValid()) { - rtl::OString message("cannot open "); + OString message("cannot open "); message += compFileName + " for writing"; throw CannotDumpException(message); } else { @@ -359,14 +459,14 @@ void generateSkeleton(ProgramOptions const & options, std::ofstream oFile(tmpFileName.getStr(), std::ios_base::binary); try { - generateIncludes(oFile, interfaces, properties, attributes, - false, serviceobject, supportxcomponent); + generateIncludes(oFile, interfaces, properties, propertyhelper, + serviceobject, supportxcomponent); // namespace oFile << "\n\nnamespace css = ::com::sun::star;\n\n"; short nm = generateNamespace(oFile, options.implname); sal_Int32 index = 0; - rtl::OString nmspace; - rtl::OString classname(options.implname); + OString nmspace; + OString classname(options.implname); if ((index = classname.lastIndexOf('.')) > 0) { nmspace = scopedCppName(classname.copy(0, index)); nmspace = nmspace.concat("::"); @@ -375,11 +475,16 @@ void generateSkeleton(ProgramOptions const & options, generateServiceHelper(oFile, options.implname, services); - generateClassDefinition(oFile, options, manager, classname, - interfaces, properties, propertyhelper, - supportxcomponent); + OString parentname( + generateClassDefinition( + oFile, options, manager,classname, interfaces, properties, + attributes, propinterfaces, propertyhelper, supportxcomponent)); + + generateQueryInterface(oFile, options, manager, interfaces, parentname, + classname, propertyhelper); - generateMethodBodies(oFile, options, manager, classname, interfaces); + generateMethodBodies(oFile, options, manager, classname, interfaces, + propertyhelper.getLength() > 1); generateCreateFunction(oFile, classname); diff --git a/unodevtools/source/skeletonmaker/cpptypemaker.cxx b/unodevtools/source/skeletonmaker/cpptypemaker.cxx index c7cd69441506..1cb27b2602d5 100644 --- a/unodevtools/source/skeletonmaker/cpptypemaker.cxx +++ b/unodevtools/source/skeletonmaker/cpptypemaker.cxx @@ -1,66 +1,43 @@ /************************************************************************* * - * $RCSfile: cpptypemaker.cxx,v $ - * - * $Revision: 1.1 $ - * - * last change: $Author: jsc $ $Date: 2005-08-23 08:29:58 $ - * - * The Contents of this file are made available subject to the terms of - * either of the following licenses - * - * - GNU Lesser General Public License Version 2.1 - * - Sun Industry Standards Source License Version 1.1 - * - * Sun Microsystems Inc., October, 2000 - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2000 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA + * OpenOffice.org - a multi-platform office productivity suite * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * $RCSfile: cpptypemaker.cxx,v $ * + * $Revision: 1.2 $ * - * Sun Industry Standards Source License Version 1.1 - * ================================================= - * The contents of this file are subject to the Sun Industry Standards - * Source License Version 1.1 (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.openoffice.org/license.html. + * last change: $Author: jsc $ $Date: 2005-09-09 13:50:28 $ * - * Software provided under this License is provided on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, - * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. - * See the License for the specific provisions governing your rights and - * obligations concerning the Software. + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. * - * The Initial Developer of the Original Code is: Sun Microsystems, Inc. * - * Copyright: 2000 by Sun Microsystems, Inc. + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA * - * All Rights Reserved. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. * - * Contributor(s): _______________________________________ + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA * ************************************************************************/ +#include <codemaker/commoncpp.hxx> + #include "skeletoncpp.hxx" +using namespace ::rtl; using namespace ::codemaker::cpp; namespace skeletonmaker { namespace cpp { @@ -68,8 +45,8 @@ namespace skeletonmaker { namespace cpp { void printType(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, codemaker::UnoType::Sort sort, RTTypeClass typeClass, - rtl::OString const & name, sal_Int32 rank, - std::vector< rtl::OString > const & arguments, short referenceType, + OString const & name, sal_Int32 rank, + std::vector< OString > const & arguments, short referenceType, bool shortname, bool defaultvalue) { if (defaultvalue && rank == 0 && sort <= codemaker::UnoType::SORT_CHAR) { @@ -111,6 +88,20 @@ void printType(std::ostream & o, sort, typeClass, name), false, shortname); if (typeClass == RT_TYPE_INTERFACE && referenceType > 0) o << " >"; + + if (!arguments.empty()) { + o << "< "; + for (std::vector< OString >::const_iterator i(arguments.begin()); + i != arguments.end(); ++i) + { + if (i != arguments.begin()) { + o << ", "; + } + printType(o, options, manager, *i, false, shortname, defaultvalue); + } + o << " >"; + } + for (sal_Int32 i = 0; i < rank; ++i) { o << " >"; } @@ -125,13 +116,13 @@ void printType(std::ostream & o, void printType(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, - rtl::OString const & type, short referenceType, bool shortname, + OString const & type, short referenceType, bool shortname, bool defaultvalue) { RTTypeClass typeClass; - rtl::OString name; + OString name; sal_Int32 rank; - std::vector< rtl::OString > arguments; + std::vector< OString > arguments; codemaker::UnoType::Sort sort = codemaker::decomposeAndResolve( manager, type, true, true, true, &typeClass, &name, &rank, &arguments); printType(o, @@ -142,11 +133,11 @@ void printType(std::ostream & o, bool printConstructorParameters(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, typereg::Reader const & reader, typereg::Reader const & outerReader, - std::vector< rtl::OString > const & arguments) + std::vector< OString > const & arguments) { bool previous = false; if (reader.getSuperTypeCount() != 0) { - rtl::OString super( + OString super( codemaker::convertString(reader.getSuperTypeName(0))); typereg::Reader superReader(manager.getTypeReader(super)); if (!superReader.isValid()) { @@ -175,7 +166,7 @@ bool printConstructorParameters(std::ostream & o, ++tparam; OSL_ASSERT(tparam < outerReader.getReferenceCount()); } - // assume std::vector< rtl::OString >::size_type is at least as + // assume std::vector< OString >::size_type is at least as // large as sal_uInt16: printType(o, options, manager, arguments[tparam], 4); } @@ -191,10 +182,10 @@ bool printConstructorParameters(std::ostream & o, void printConstructor(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, typereg::Reader const & reader, - std::vector< rtl::OString > const & arguments) + std::vector< OString > const & arguments) { - rtl::OString type(codemaker::convertString(reader.getTypeName())); -// o << "public "; + OString type(codemaker::convertString(reader.getTypeName())); + o << "public "; o << type.copy(type.lastIndexOf('/') + 1) << '('; printConstructorParameters(o, options, manager, reader, reader, arguments); o << ");\n"; @@ -259,13 +250,103 @@ void printExceptionSpecification(std::ostream & o, o << ")"; } +void printSetPropertyMixinBody(std::ostream & o, + typereg::Reader const & reader, + sal_uInt16 field, + sal_uInt16 method) +{ + RTFieldAccess propFlags = checkAdditionalPropertyFlags(reader, field, method); + OString fieldname = codemaker::convertString(reader.getFieldName(field)); + bool bound = (reader.getFieldFlags(field) & RT_ACCESS_BOUND ? true : false); + + o << "\n{\n"; + + if (bound) { + o << " BoundListeners l;\n"; + } + + if (propFlags & RT_ACCESS_CONSTRAINED) { + OString fieldtype = codemaker::convertString(reader.getFieldTypeName(field)); + + sal_Int32 index = fieldtype.lastIndexOf('<'); + sal_Int32 nPos=0; + bool single = true; + bool optional = false; + OStringBuffer buffer1(64); + OStringBuffer buffer2(64); + do + { + OString s(fieldtype.getToken(0, '<', nPos)); + OString t = s.copy(s.lastIndexOf('/')+1); + + if (t.equals("Optional")) { + optional=true; + if (single) { + single=false; + buffer1.append("the_value.IsPresent"); + buffer2.append("the_value.Value"); + } else { + buffer1.insert(0, t); + buffer1.append(".IsPresent"); + buffer2.insert(0, t); + buffer2.append(".Value"); + } + } else { + if (single) { + single=false; + if (!optional) { + buffer1.append("the_value.Value"); + } + buffer2.append("the_value.Value"); + } else { + if (!optional) { + buffer1.insert(0, t); + buffer1.append(".Value"); + } + buffer2.insert(0, t); + buffer2.append(".Value"); + } + } + } while( nPos <= index ); + + o << " css::uno::Any v;\n"; + if (optional) { + o << " if(" << buffer1.makeStringAndClear() << ")\n {\n" + << " v <<= " << buffer2.makeStringAndClear() << ";\n }\n"; + } else { + o << " v <<= " << buffer2.makeStringAndClear() << ";\n\n"; + } + + o << " prepareSet(\n rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\"" + << fieldname << "\")),\n css::uno::Any(), v, "; + } else { + o << " prepareSet(\n rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\"" + << fieldname << "\")),\n css::uno::Any(), css::uno::Any(), "; + } + + if (bound) + o << "&l);\n"; + else + o << "0);\n"; + + o << " {\n osl::MutexGuard g(m_mutex);\n m_" + << fieldname << " = the_value;\n }\n"; + + if (bound) { + o << " l.notify();\n"; + } + o << "}\n\n"; +} + + void printMethods(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, typereg::Reader const & reader, codemaker::GeneratedTypeSet & generated, - rtl::OString const & delegate, rtl::OString const & classname, - rtl::OString const & indentation, bool shortname, bool defaultvalue) + OString const & delegate, OString const & classname, + OString const & indentation, bool shortname, bool defaultvalue, + bool usepropertymixin) { - rtl::OString type(codemaker::convertString(reader.getTypeName())); + OString type(codemaker::convertString(reader.getTypeName())); if (generated.contains(type) || type.equals("com/sun/star/uno/XInterface") || (defaultvalue && ( type.equals("com/sun/star/lang/XComponent") || @@ -274,7 +355,7 @@ void printMethods(std::ostream & o, return; } - static rtl::OString sd(RTL_CONSTASCII_STRINGPARAM("_")); + static OString sd(RTL_CONSTASCII_STRINGPARAM("_")); bool body = ((delegate.getLength() > 0) ? true : false); bool defaultbody = ((delegate.equals(sd)) ? true : false); @@ -303,6 +384,8 @@ void printMethods(std::ostream & o, sal_uInt16 method = 0; for (sal_uInt16 i = 0; i < reader.getFieldCount(); ++i) { o << indentation; + if (!body) + o << "virtual "; printType(o, options, manager, codemaker::convertString(reader.getFieldTypeName(i)), 1, shortname); @@ -321,22 +404,31 @@ void printMethods(std::ostream & o, } if (body) { if (defaultbody) { - o << "\n{\n return "; - printType(o, - options, manager, - codemaker::convertString(reader.getFieldTypeName(i)), 8, - shortname, defaultvalue); - o << "\n}\n\n"; + if (usepropertymixin) { + o << "\n{\n osl::MutexGuard g(m_mutex);\n return m_" + << codemaker::convertString(reader.getFieldName(i)).getStr() + << ";\n}\n\n"; + } else { + o << "\n{\n return "; + printType(o, + options, manager, + codemaker::convertString(reader.getFieldTypeName(i)), + 8, shortname, true); + o << ";\n}\n\n"; + } } else { o << "\n" << indentation << " { return " << delegate.getStr() << "get" << codemaker::convertString(reader.getFieldName(i)).getStr() - << "(); }"; + << "(); }\n"; } } else o << ";\n"; if ((reader.getFieldFlags(i) & RT_ACCESS_READONLY) == 0) { - o << indentation << "void SAL_CALL "; + o << indentation; + if (!body) + o << "virtual "; + o << "void SAL_CALL "; if (classname.getLength() > 0) o << classname; o << "set" @@ -356,12 +448,16 @@ void printMethods(std::ostream & o, } if (body) { if (defaultbody) { - o << "\n{\n\n}\n\n"; + if (usepropertymixin) { + printSetPropertyMixinBody(o, reader, i, method); + } else { + o << "\n{\n\n}\n\n"; + } } else { o << "\n" << indentation << " { " << delegate.getStr() << "set" << codemaker::convertString(reader.getFieldName(i)).getStr() - << "(the_value); }"; + << "(the_value); }\n"; } } else o << ";\n"; @@ -369,6 +465,8 @@ void printMethods(std::ostream & o, } for (; method < reader.getMethodCount(); ++method) { o << indentation; + if (!body) + o << "virtual "; printType(o, options, manager, codemaker::convertString( @@ -384,7 +482,7 @@ void printMethods(std::ostream & o, printExceptionSpecification(o, options, manager, reader, method, shortname); if (body) { - static rtl::OUString s(RTL_CONSTASCII_USTRINGPARAM("void")); + static OUString s(RTL_CONSTASCII_USTRINGPARAM("void")); if (defaultbody) { o << "\n{\n"; if (!reader.getMethodReturnTypeName(method).equals(s)) { @@ -393,7 +491,7 @@ void printMethods(std::ostream & o, options, manager, codemaker::convertString( reader.getMethodReturnTypeName(method)), 8, - shortname, defaultvalue); + shortname, true); o << ";"; } o << "\n}\n\n"; @@ -443,11 +541,11 @@ void printConstructionMethods(std::ostream & o, void printServiceMembers(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, - typereg::Reader const & reader, rtl::OString const & type, - rtl::OString const & delegate) + typereg::Reader const & reader, OString const & type, + OString const & delegate) { for (sal_uInt16 i = 0; i < reader.getReferenceCount(); ++i) { - rtl::OString referenceType( + OString referenceType( codemaker::convertString( reader.getReferenceTypeName(i)).replace('/', '.')); @@ -464,9 +562,9 @@ void printServiceMembers(std::ostream & o, if (delegate.getLength() == 0) { o << "\n// properties of service \""<< type.getStr() << "\"\n"; for (sal_uInt16 i = 0; i < reader.getFieldCount(); ++i) { - rtl::OString fieldName( + OString fieldName( codemaker::convertString(reader.getFieldName(i))); - rtl::OString fieldType( + OString fieldType( codemaker::convertString(reader.getFieldTypeName(i))); o << "// private "; @@ -482,8 +580,8 @@ void printServiceMembers(std::ostream & o, void printMapsToCppType(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, codemaker::UnoType::Sort sort, RTTypeClass typeClass, - rtl::OString const & name, sal_Int32 rank, - std::vector< rtl::OString > const & arguments, const char * cppTypeSort) + OString const & name, sal_Int32 rank, + std::vector< OString > const & arguments, const char * cppTypeSort) { o << "maps to C++ "; if (cppTypeSort != 0) { @@ -501,16 +599,16 @@ void printMapsToCppType(std::ostream & o, void generateDocumentation(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, - rtl::OString const & type, rtl::OString const & delegate) + OString const & type, OString const & delegate) { if (type.indexOf('/') >= 0) { throw CannotDumpException("Illegal type name " + type); } - rtl::OString binType(type.replace('.', '/')); + OString binType(type.replace('.', '/')); RTTypeClass typeClass; - rtl::OString name; + OString name; sal_Int32 rank; - std::vector< rtl::OString > arguments; + std::vector< OString > arguments; codemaker::UnoType::Sort sort = decomposeResolveAndCheck( manager, binType, false, true, true, &typeClass, &name, &rank, &arguments); @@ -634,7 +732,7 @@ void generateDocumentation(std::ostream & o, codemaker::GeneratedTypeSet generated; printMethods(o, options, manager, reader, generated, - delegate, options.implname); + delegate, options.implname); } break; @@ -694,7 +792,7 @@ void generateDocumentation(std::ostream & o, printConstructionMethods(o, options, manager, reader); } - rtl::OString super( + OString super( codemaker::convertString( reader.getSuperTypeName(0)).replace('/', '.')); generateDocumentation(o, options, manager, super, delegate); @@ -715,7 +813,6 @@ void generateDocumentation(std::ostream & o, printMapsToCppType(o, options, manager, sort, typeClass, name, rank, arguments, "class"); -// o << "; get method:\npublic static "; o << "; get method:\nstatic "; printType(o, options, manager, codemaker::convertString(reader.getSuperTypeName(0)), 1); diff --git a/unodevtools/source/skeletonmaker/javacompskeleton.cxx b/unodevtools/source/skeletonmaker/javacompskeleton.cxx index d22893c110e4..7e3ff4f34f93 100644 --- a/unodevtools/source/skeletonmaker/javacompskeleton.cxx +++ b/unodevtools/source/skeletonmaker/javacompskeleton.cxx @@ -1,71 +1,50 @@ /************************************************************************* * - * $RCSfile: javacompskeleton.cxx,v $ - * - * $Revision: 1.3 $ - * - * last change: $Author: jsc $ $Date: 2005-08-25 15:30:33 $ - * - * The Contents of this file are made available subject to the terms of - * either of the following licenses - * - * - GNU Lesser General Public License Version 2.1 - * - Sun Industry Standards Source License Version 1.1 - * - * Sun Microsystems Inc., October, 2000 - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2000 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * OpenOffice.org - a multi-platform office productivity suite * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * $RCSfile: javacompskeleton.cxx,v $ * + * $Revision: 1.4 $ * - * Sun Industry Standards Source License Version 1.1 - * ================================================= - * The contents of this file are subject to the Sun Industry Standards - * Source License Version 1.1 (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.openoffice.org/license.html. + * last change: $Author: jsc $ $Date: 2005-09-09 13:50:29 $ * - * Software provided under this License is provided on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, - * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. - * See the License for the specific provisions governing your rights and - * obligations concerning the Software. + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. * - * The Initial Developer of the Original Code is: Sun Microsystems, Inc. * - * Copyright: 2000 by Sun Microsystems, Inc. + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA * - * All Rights Reserved. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. * - * Contributor(s): _______________________________________ + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA * ************************************************************************/ +#include <codemaker/commonjava.hxx> + #include "skeletonjava.hxx" +#include <iostream> + +using namespace ::rtl; using namespace ::codemaker::java; namespace skeletonmaker { namespace java { -void generatePackage(std::ostream & o, const rtl::OString & implname) +void generatePackage(std::ostream & o, const OString & implname) { short count=0; sal_Int32 index = implname.lastIndexOf('.'); @@ -75,8 +54,8 @@ void generatePackage(std::ostream & o, const rtl::OString & implname) } void generateImports(std::ostream & o, - const std::hash_set< rtl::OString, rtl::OStringHash >& interfaces, - const rtl::OString & propertyhelper, + const std::hash_set< OString, OStringHash >& interfaces, + const OString & propertyhelper, bool serviceobject, bool supportxcomponent) { o << "import com.sun.star.uno.XComponentContext;\n"; @@ -98,33 +77,38 @@ void generateImports(std::ostream & o, o << "import com.sun.star.beans.PropertyAttribute;\n"; } else { o << "import com.sun.star.uno.Type;\n"; + o << "import com.sun.star.uno.Any;\n"; + o << "import com.sun.star.beans.Ambiguous;\n"; + o << "import com.sun.star.beans.Defaulted;\n"; + o << "import com.sun.star.beans.Optional;\n"; o << "import com.sun.star.lib.uno.helper.PropertySetMixin;\n"; } } -// std::hash_set< rtl::OString, rtl::OStringHash >::const_iterator iter = interfaces.begin(); +// std::hash_set< OString, OStringHash >::const_iterator iter = +// interfaces.begin(); // while (iter != interfaces.end()) { // o << "import " << ((*iter).getStr()) << ";\n"; // iter++; // } } -void generateCompFunctions(std::ostream & o, const rtl::OString & classname) +void generateCompFunctions(std::ostream & o, const OString & classname) { o << " public static XSingleComponentFactory __getComponentFactory(" - << "String sImplementationName ) {\n" - << " XSingleComponentFactory xFactory = null;\n\n" - << " if ( sImplementationName.equals( m_implementationName ) )\n" - << " xFactory = Factory.createComponentFactory(" + "String sImplementationName ) {\n" + " XSingleComponentFactory xFactory = null;\n\n" + " if ( sImplementationName.equals( m_implementationName ) )\n" + " xFactory = Factory.createComponentFactory(" << classname << ".class, m_serviceNames);\n" - << " return xFactory;\n }\n\n"; + " return xFactory;\n }\n\n"; o << " public static boolean __writeRegistryServiceInfo(" - << "XRegistryKey xRegistryKey ) {\n" - << " return Factory.writeRegistryServiceInfo(m_implementationName,\n" - << " m_serviceNames,\n" - << " xRegistryKey);\n" - << " }\n\n"; + "XRegistryKey xRegistryKey ) {\n" + " return Factory.writeRegistryServiceInfo(m_implementationName,\n" + " m_serviceNames,\n" + " xRegistryKey);\n" + " }\n\n"; } void generateXServiceInfoBodies(std::ostream& o) @@ -151,38 +135,40 @@ void generateXPropertySetBodies(std::ostream& o) " {\n return m_prophlp.getPropertySetInfo();\n }\n\n"; o << " public void setPropertyValue(java.lang.String aPropertyName, " - "java.lang.Object aValue) throws com.sun.star.beans.UnknownPropertyException, " - "com.sun.star.beans.PropertyVetoException, " - "com.sun.star.lang.IllegalArgumentException," - "com.sun.star.lang.WrappedTargetException\n {\n " - "m_prophlp.setPropertyValue(aPropertyName, aValue);\n }\n\n"; - - o << " public java.lang.Object getPropertyValue(java.lang.String aPropertyName) " - "throws com.sun.star.beans.UnknownPropertyException, " - "com.sun.star.lang.WrappedTargetException\n {\n return " - "m_prophlp.getPropertyValue(aPropertyName);\n }\n\n"; - - o << " public void addPropertyChangeListener(java.lang.String aPropertyName, " - "com.sun.star.beans.XPropertyChangeListener xListener) throws " - "com.sun.star.beans.UnknownPropertyException, " - "com.sun.star.lang.WrappedTargetException\n {\n " - "m_prophlp.addPropertyChangeListener(aPropertyName, xListener);\n }\n\n"; - - o << " public void removePropertyChangeListener(java.lang.String aPropertyName, " - "com.sun.star.beans.XPropertyChangeListener xListener) throws " - "com.sun.star.beans.UnknownPropertyException, " - "com.sun.star.lang.WrappedTargetException\n {\n " - "m_prophlp.removePropertyChangeListener(aPropertyName, xListener);\n }\n\n"; - - o << " public void addVetoableChangeListener(java.lang.String aPropertyName, " - "com.sun.star.beans.XVetoableChangeListener xListener) throws " - "com.sun.star.beans.UnknownPropertyException, " - "com.sun.star.lang.WrappedTargetException\n {\n " - "m_prophlp.addVetoableChangeListener(aPropertyName, xListener);\n }\n\n"; - - o << " public void removeVetoableChangeListener(java.lang.String aPropertyName, " - "com.sun.star.beans.XVetoableChangeListener xListener) throws " + "java.lang.Object aValue) throws " "com.sun.star.beans.UnknownPropertyException, " + "com.sun.star.beans.PropertyVetoException, " + "com.sun.star.lang.IllegalArgumentException," + "com.sun.star.lang.WrappedTargetException\n {\n " + "m_prophlp.setPropertyValue(aPropertyName, aValue);\n }\n\n"; + + o << " public java.lang.Object getPropertyValue(java.lang.String " + "aPropertyName) throws com.sun.star.beans.UnknownPropertyException, " + "com.sun.star.lang.WrappedTargetException\n {\n return " + "m_prophlp.getPropertyValue(aPropertyName);\n }\n\n"; + + o << " public void addPropertyChangeListener(java.lang.String aPropertyName" + ", com.sun.star.beans.XPropertyChangeListener xListener) throws " + "com.sun.star.beans.UnknownPropertyException, " + "com.sun.star.lang.WrappedTargetException\n {\n " + "m_prophlp.addPropertyChangeListener(aPropertyName, xListener);\n }\n\n"; + + o << " public void removePropertyChangeListener(java.lang.String " + "aPropertyName, com.sun.star.beans.XPropertyChangeListener xListener) " + "throws com.sun.star.beans.UnknownPropertyException, " + "com.sun.star.lang.WrappedTargetException\n {\n " + "m_prophlp.removePropertyChangeListener(aPropertyName, xListener);\n" + " }\n\n"; + + o << " public void addVetoableChangeListener(java.lang.String aPropertyName" + ", com.sun.star.beans.XVetoableChangeListener xListener) throws " + "com.sun.star.beans.UnknownPropertyException, " + "com.sun.star.lang.WrappedTargetException\n {\n " + "m_prophlp.addVetoableChangeListener(aPropertyName, xListener);\n }\n\n"; + + o << " public void removeVetoableChangeListener(java.lang.String " + "aPropertyName, com.sun.star.beans.XVetoableChangeListener xListener) " + "throws com.sun.star.beans.UnknownPropertyException, " "com.sun.star.lang.WrappedTargetException\n {\n " "m_prophlp.removeVetoableChangeListener(aPropertyName, xListener);\n }\n\n"; } @@ -191,8 +177,8 @@ void generateXFastPropertySetBodies(std::ostream& o) { o << " /* com.sun.star.lang.XFastPropertySet */\n"; - o << " public void setFastPropertyValue(int nHandle, java.lang.Object aValue) " - "throws com.sun.star.beans.UnknownPropertyException, " + o << " public void setFastPropertyValue(int nHandle, java.lang.Object " + "aValue) throws com.sun.star.beans.UnknownPropertyException, " "com.sun.star.beans.PropertyVetoException, " "com.sun.star.lang.IllegalArgumentException, " "com.sun.star.lang.WrappedTargetException\n {\n " @@ -208,11 +194,11 @@ void generateXPropertyAccessBodies(std::ostream& o) { o << " /* com.sun.star.lang.XPropertyAccess */\n"; - o << " public com.sun.star.beans.PropertyValue[] getPropertyValues()\n {\n" - << " return m_prophlp.getPropertyValues();\n }\n\n"; + o << " public com.sun.star.beans.PropertyValue[] getPropertyValues()\n" + " {\n return m_prophlp.getPropertyValues();\n }\n\n"; - o << " public void setPropertyValues(com.sun.star.beans.PropertyValue[] aProps) " - "throws com.sun.star.beans.UnknownPropertyException, " + o << " public void setPropertyValues(com.sun.star.beans.PropertyValue[] " + "aProps) throws com.sun.star.beans.UnknownPropertyException, " "com.sun.star.beans.PropertyVetoException, " "com.sun.star.lang.IllegalArgumentException, " "com.sun.star.lang.WrappedTargetException\n {\n " @@ -220,7 +206,7 @@ void generateXPropertyAccessBodies(std::ostream& o) } -bool checkAttribute(rtl::OStringBuffer& attributeValue, sal_uInt16 attribute) { +bool checkAttribute(OStringBuffer& attributeValue, sal_uInt16 attribute) { bool cast = false; sal_uInt16 attributes[9] = { /* com::sun::star::beans::PropertyValue::MAYBEVOID */ 1, @@ -281,13 +267,13 @@ bool checkAttribute(rtl::OStringBuffer& attributeValue, sal_uInt16 attribute) { void registerProperties(std::ostream& o, TypeManager const & manager, const StringPairHashMap& properties, - const rtl::OString& indentation) + const OString& indentation) { if (!properties.empty()) { StringPairHashMap::const_iterator iter = properties.begin(); bool cast = false; - rtl::OStringBuffer attributeValue; + OStringBuffer attributeValue; while (iter != properties.end()) { if (iter->second.second > 0) { cast = checkAttribute(attributeValue, iter->second.second); @@ -311,11 +297,10 @@ void registerProperties(std::ostream& o, void generateMethodBodies(std::ostream& o, ProgramOptions const & options, TypeManager const & manager, - StringPairHashMap& attributes, - const std::hash_set< rtl::OString, rtl::OStringHash >& interfaces, - const rtl::OString& indentation, bool usepropertymixin) + const std::hash_set< OString, OStringHash >& interfaces, + const OString& indentation, bool usepropertymixin) { - std::hash_set< rtl::OString, rtl::OStringHash >::const_iterator iter = + std::hash_set< OString, OStringHash >::const_iterator iter = interfaces.begin(); codemaker::GeneratedTypeSet generated; while (iter != interfaces.end()) { @@ -323,7 +308,7 @@ void generateMethodBodies(std::ostream& o, generateXServiceInfoBodies(o); } else { typereg::Reader reader(manager.getTypeReader((*iter).replace('.','/'))); - printMethods(o, options, manager, reader, attributes, generated, "_", + printMethods(o, options, manager, reader, generated, "_", indentation, true, usepropertymixin); } iter++; @@ -333,16 +318,18 @@ void generateMethodBodies(std::ostream& o, static const char* propcomment= " // use the last parameter of the PropertySetMixin constructor\n" " // for your optional attributes if necessary. See the documentation\n" -" // of the PropertySetMixin helper for further information\n"; +" // of the PropertySetMixin helper for further information.\n" +" // Ensure that your attributes are initialized correctly!\n"; void generateClassDefinition(std::ostream& o, ProgramOptions const & options, TypeManager const & manager, - const rtl::OString & classname, - const std::hash_set< rtl::OString, rtl::OStringHash >& services, - const std::hash_set< rtl::OString, rtl::OStringHash >& interfaces, + const OString & classname, + const std::hash_set< OString, OStringHash >& services, + const std::hash_set< OString, OStringHash >& interfaces, const StringPairHashMap& properties, - const rtl::OString& propertyhelper, bool supportxcomponent) + const StringPairHashMap& attributes, + const OString& propertyhelper, bool supportxcomponent) { o << "\n\npublic final class " << classname << " extends "; @@ -356,7 +343,7 @@ void generateClassDefinition(std::ostream& o, o << "WeakBase\n"; } o << " implements "; - std::hash_set< rtl::OString, rtl::OStringHash >::const_iterator iter = + std::hash_set< OString, OStringHash >::const_iterator iter = interfaces.begin(); while (iter != interfaces.end()) { o << (*iter); @@ -379,7 +366,7 @@ void generateClassDefinition(std::ostream& o, if (!services.empty()) { o << " private static final java.lang.String[] m_serviceNames = {\n"; - std::hash_set< rtl::OString, rtl::OStringHash >::const_iterator iter = + std::hash_set< OString, OStringHash >::const_iterator iter = services.begin(); while (iter != services.end()) { o << " \"" << (*iter).replace('/','.') << "\""; @@ -406,11 +393,9 @@ void generateClassDefinition(std::ostream& o, if (!services.empty()) generateCompFunctions(o, classname); - StringPairHashMap attributes; - generateMethodBodies(o, options, manager, attributes, interfaces, + generateMethodBodies(o, options, manager, interfaces, " ", propertyhelper.getLength() > 1); - if (!properties.empty()) { StringPairHashMap::const_iterator iter = properties.begin(); @@ -427,7 +412,7 @@ void generateClassDefinition(std::ostream& o, attributes.begin(); o << " // attributes\n"; while (iter != attributes.end()) { - o << " protected "; + o << " private "; printType(o, options, manager, iter->second.first.replace('.','/'), false, false); o << " m_" << iter->first << ";\n"; @@ -442,19 +427,20 @@ void generateClassDefinition(std::ostream& o, void generateSkeleton(ProgramOptions const & options, TypeManager const & manager, - std::vector< rtl::OString > const & types, - rtl::OString const & delegate) + std::vector< OString > const & types, + OString const & delegate) { - std::hash_set< rtl::OString, rtl::OStringHash > interfaces; - std::hash_set< rtl::OString, rtl::OStringHash > services; + std::hash_set< OString, OStringHash > interfaces; + std::hash_set< OString, OStringHash > services; StringPairHashMap properties; - bool attributes = false; + StringPairHashMap attributes; + std::hash_set< OString, OStringHash > propinterfaces; bool serviceobject = false; bool supportxcomponent = false; - std::vector< rtl::OString >::const_iterator iter = types.begin(); + std::vector< OString >::const_iterator iter = types.begin(); while (iter != types.end()) { - checkType(manager, *iter, interfaces, services, properties, attributes); + checkType(manager, *iter, interfaces, services, properties); iter++; } @@ -462,24 +448,25 @@ void generateSkeleton(ProgramOptions const & options, if (!services.empty()) serviceobject = true; - rtl::OString propertyhelper = checkPropertyHelper(manager, services); + OString propertyhelper = checkPropertyHelper(manager, services, + attributes, propinterfaces); checkDefaultInterfaces(interfaces, services, propertyhelper); supportxcomponent = checkXComponentSupport(manager, interfaces); - rtl::OString compFileName(createFileNameFromType( + OString compFileName(createFileNameFromType( options.outputpath, options.implname.replace('.','/'), ".java")); - rtl::OString tmpDir = getTempDir(compFileName); + OString tmpDir = getTempDir(compFileName); FileStream file; file.createTempFile(tmpDir); - rtl::OString tmpFileName; + OString tmpFileName; if(!file.isValid()) { - rtl::OString message("cannot open "); + OString message("cannot open "); message += compFileName + " for writing"; throw CannotDumpException(message); } else { @@ -494,13 +481,13 @@ void generateSkeleton(ProgramOptions const & options, generateImports(oFile, interfaces, propertyhelper, serviceobject, supportxcomponent); - rtl::OString classname(options.implname); + OString classname(options.implname); sal_Int32 index = 0; if ((index = classname.lastIndexOf('.')) > 0) classname = classname.copy(index+1); generateClassDefinition(oFile, options, manager, classname, services, - interfaces, properties, propertyhelper, + interfaces, properties, attributes, propertyhelper, supportxcomponent); oFile.close(); diff --git a/unodevtools/source/skeletonmaker/javatypemaker.cxx b/unodevtools/source/skeletonmaker/javatypemaker.cxx index ac8073b61e41..bddd0927b8f1 100644 --- a/unodevtools/source/skeletonmaker/javatypemaker.cxx +++ b/unodevtools/source/skeletonmaker/javatypemaker.cxx @@ -1,78 +1,56 @@ /************************************************************************* * - * $RCSfile: javatypemaker.cxx,v $ - * - * $Revision: 1.2 $ - * - * last change: $Author: jsc $ $Date: 2005-08-25 15:30:33 $ - * - * The Contents of this file are made available subject to the terms of - * either of the following licenses - * - * - GNU Lesser General Public License Version 2.1 - * - Sun Industry Standards Source License Version 1.1 - * - * Sun Microsystems Inc., October, 2000 + * OpenOffice.org - a multi-platform office productivity suite * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2000 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * $RCSfile: javatypemaker.cxx,v $ * + * $Revision: 1.3 $ * - * Sun Industry Standards Source License Version 1.1 - * ================================================= - * The contents of this file are subject to the Sun Industry Standards - * Source License Version 1.1 (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.openoffice.org/license.html. + * last change: $Author: jsc $ $Date: 2005-09-09 13:50:30 $ * - * Software provided under this License is provided on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, - * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. - * See the License for the specific provisions governing your rights and - * obligations concerning the Software. + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. * - * The Initial Developer of the Original Code is: Sun Microsystems, Inc. * - * Copyright: 2000 by Sun Microsystems, Inc. + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA * - * All Rights Reserved. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. * - * Contributor(s): _______________________________________ + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA * ************************************************************************/ +#include <codemaker/commonjava.hxx> + #include "skeletonjava.hxx" +using namespace ::rtl; + namespace skeletonmaker { namespace java { void printType(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, - rtl::OString const & type, bool referenceType, + OString const & type, bool referenceType, bool defaultvalue); void printType(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, codemaker::UnoType::Sort sort, RTTypeClass typeClass, - rtl::OString const & name, sal_Int32 rank, - std::vector< rtl::OString > const & arguments, bool referenceType, + OString const & name, sal_Int32 rank, + std::vector< OString > const & arguments, bool referenceType, bool defaultvalue) { if (defaultvalue && rank == 0 && sort <= codemaker::UnoType::SORT_CHAR) { @@ -108,7 +86,7 @@ void printType(std::ostream & o, replace('/', '.').getStr()); if (!arguments.empty() && options.java5) { o << '<'; - for (std::vector< rtl::OString >::const_iterator i(arguments.begin()); + for (std::vector< OString >::const_iterator i(arguments.begin()); i != arguments.end(); ++i) { if (i != arguments.begin()) { @@ -131,12 +109,12 @@ void printType(std::ostream & o, void printType(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, - rtl::OString const & type, bool referenceType, bool defaultvalue) + OString const & type, bool referenceType, bool defaultvalue) { RTTypeClass typeClass; - rtl::OString name; + OString name; sal_Int32 rank; - std::vector< rtl::OString > arguments; + std::vector< OString > arguments; codemaker::UnoType::Sort sort = codemaker::decomposeAndResolve( manager, type, true, true, true, &typeClass, &name, &rank, &arguments); printType(o, @@ -147,11 +125,11 @@ void printType(std::ostream & o, bool printConstructorParameters(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, typereg::Reader const & reader, typereg::Reader const & outerReader, - std::vector< rtl::OString > const & arguments) + std::vector< OString > const & arguments) { bool previous = false; if (reader.getSuperTypeCount() != 0) { - rtl::OString super( + OString super( codemaker::convertString(reader.getSuperTypeName(0))); typereg::Reader superReader(manager.getTypeReader(super)); if (!superReader.isValid()) { @@ -180,7 +158,7 @@ bool printConstructorParameters(std::ostream & o, ++tparam; OSL_ASSERT(tparam < outerReader.getReferenceCount()); } - // assume std::vector< rtl::OString >::size_type is at least as + // assume std::vector< OString >::size_type is at least as // large as sal_uInt16: printType(o, options, manager, arguments[tparam], true); } @@ -197,9 +175,9 @@ bool printConstructorParameters(std::ostream & o, void printConstructor(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, typereg::Reader const & reader, - std::vector< rtl::OString > const & arguments) + std::vector< OString > const & arguments) { - rtl::OString type(codemaker::convertString(reader.getTypeName())); + OString type(codemaker::convertString(reader.getTypeName())); o << "public " << type.copy(type.lastIndexOf('/') + 1) << '('; printConstructorParameters(o, options, manager, reader, reader, arguments); o << ");\n"; @@ -260,18 +238,15 @@ void printExceptionSpecification(std::ostream & o, } -void generateXPropertySetBodies(std::ostream& o); -void generateXFastPropertySetBodies(std::ostream& o); -void generateXPropertyAccessBodies(std::ostream& o); - void printSetPropertyMixinBody(std::ostream & o, typereg::Reader const & reader, - sal_uInt16 fieldno, - rtl::OString const & indentation) + sal_uInt16 field, + sal_uInt16 method, + OString const & indentation) { - RTFieldAccess fieldAccess = reader.getFieldFlags(fieldno); - rtl::OString fieldname = codemaker::convertString(reader.getFieldName(fieldno)); - bool bound = (fieldAccess & RT_ACCESS_BOUND ? true : false); + RTFieldAccess propFlags = checkAdditionalPropertyFlags(reader, field, method); + OString fieldname = codemaker::convertString(reader.getFieldName(field)); + bool bound = (reader.getFieldFlags(field) & RT_ACCESS_BOUND ? true : false); o << "\n" << indentation << "{\n"; @@ -280,23 +255,73 @@ void printSetPropertyMixinBody(std::ostream & o, "new PropertySetMixin.BoundListeners();\n\n"; } - if (fieldAccess & RT_ACCESS_CONSTRAINED || - fieldAccess & RT_ACCESS_MAYBEDEFAULT || - fieldAccess & RT_ACCESS_MAYBEAMBIGUOUS || - fieldAccess & RT_ACCESS_MAYBEVOID ) { - - // TODO - - } else { - o << indentation << " m_prophlp.prepareSet(\"" - << fieldname << "\", "; - if (bound) - o << "l"; + o << indentation << " m_prophlp.prepareSet(\"" + << fieldname << "\", "; + if (propFlags & RT_ACCESS_CONSTRAINED) { + OString fieldtype = codemaker::convertString(reader.getFieldTypeName(field)); + + sal_Int32 index = fieldtype.lastIndexOf('<'); + sal_Int32 nPos=0; + bool single = true; + bool optional = false; + OStringBuffer buffer1(64); + OStringBuffer buffer2(64); + do + { + OString s(fieldtype.getToken(0, '<', nPos)); + OStringBuffer buffer(16); + buffer.append("(("); + buffer.append(s.copy(s.lastIndexOf('/')+1)); + buffer.append(')'); + OString t = buffer.makeStringAndClear(); + + if (t.equals("((Optional)")) { + optional=true; + if (single) { + single=false; + buffer1.append("the_value.IsPresent"); + buffer2.append("the_value.Value"); + } else { + buffer1.insert(0, t); + buffer1.append(").IsPresent"); + buffer2.insert(0, t); + buffer2.append(").Value"); + } + } else { + if (single) { + single=false; + if (!optional) { + buffer1.append("the_value.Value"); + } + buffer2.append("the_value.Value"); + } else { + if (!optional) { + buffer1.insert(0, t); + buffer1.append(").Value"); + } + buffer2.insert(0, t); + buffer2.append(").Value"); + } + } + } while( nPos <= index ); + + o << "Any.VOID,\n" << indentation << " "; + if (optional) + o << "("; + o << buffer1.makeStringAndClear(); + if (optional) + o << ") ? " << buffer2.makeStringAndClear() << " : Any.VOID,\n" + << indentation << " "; else - o << "null"; - o << ");\n"; + o << ", "; } + if (bound) + o << "l"; + else + o << "null"; + o << ");\n"; + o << indentation << " synchronized (this) {\n" << indentation << " m_" << fieldname << " = the_value;\n" << indentation << " }\n"; @@ -307,15 +332,18 @@ void printSetPropertyMixinBody(std::ostream & o, o << indentation << "}\n\n"; } +void generateXPropertySetBodies(std::ostream& o); +void generateXFastPropertySetBodies(std::ostream& o); +void generateXPropertyAccessBodies(std::ostream& o); + void printMethods(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, typereg::Reader const & reader, - StringPairHashMap& attributes, codemaker::GeneratedTypeSet & generated, - rtl::OString const & delegate, rtl::OString const & indentation, + OString const & delegate, OString const & indentation, bool defaultvalue, bool usepropertymixin) { - rtl::OString type(codemaker::convertString(reader.getTypeName())); + OString type(codemaker::convertString(reader.getTypeName())); if (generated.contains(type) || type == "com/sun/star/uno/XInterface" || (defaultvalue && ( type.equals("com/sun/star/lang/XComponent") || @@ -340,7 +368,7 @@ void printMethods(std::ostream & o, } } - static rtl::OString sd(RTL_CONSTASCII_STRINGPARAM("_")); + static OString sd(RTL_CONSTASCII_STRINGPARAM("_")); bool body = ((delegate.getLength() > 0) ? true : false); bool defaultbody = ((delegate.equals(sd)) ? true : false); @@ -357,7 +385,7 @@ void printMethods(std::ostream & o, + codemaker::convertString( reader.getSuperTypeName(i))); } - printMethods(o, options, manager, super, attributes, generated, delegate, + printMethods(o, options, manager, super, generated, delegate, indentation, defaultvalue, usepropertymixin); } if (reader.getFieldCount() > 0 || reader.getMethodCount() > 0) { @@ -368,16 +396,15 @@ void printMethods(std::ostream & o, } sal_uInt16 method = 0; for (sal_uInt16 i = 0; i < reader.getFieldCount(); ++i) { - rtl::OString fieldName( - codemaker::convertString(reader.getFieldName(i)). - replace('/', '.')); - rtl::OString fieldType( - codemaker::convertString(reader.getFieldTypeName(i)). - replace('/', '.')); - attributes.insert(StringPairHashMap::value_type(fieldName, - std::pair<rtl::OString, sal_Int16>( - fieldType, reader.getFieldFlags(i)))); - +// OString fieldName( +// codemaker::convertString(reader.getFieldName(i)). +// replace('/', '.')); +// OString fieldType( +// codemaker::convertString(reader.getFieldTypeName(i)). +// replace('/', '.')); +// attributes.insert(StringPairHashMap::value_type(fieldName, +// std::pair<OString, sal_Int16>( +// fieldType, reader.getFieldFlags(i)))); o << indentation << "public "; printType(o, @@ -386,6 +413,13 @@ void printMethods(std::ostream & o, o << " get" << codemaker::convertString(reader.getFieldName(i)).getStr() << "()"; + + // DEBUG + sal_uInt16 mc = reader.getMethodCount(); + RTMethodMode mm = reader.getMethodFlags(method); + OUString mn = reader.getMethodName(method); + OUString fn = reader.getFieldName(i); + if (method < reader.getMethodCount() && reader.getMethodFlags(method) == RT_MODE_ATTRIBUTE_GET && reader.getMethodName(method) == reader.getFieldName(i)) @@ -395,29 +429,32 @@ void printMethods(std::ostream & o, if (body) { if (defaultbody) { if (usepropertymixin) { - o << "\n" << indentation << "{\n" << indentation << " return m_" + o << "\n" << indentation << "{\n" << indentation + << " return m_" << codemaker::convertString(reader.getFieldName(i)).getStr() << ";\n" << indentation << "}\n\n"; } else { - o << "\n" << indentation << "{\n" << indentation << " return "; + o << "\n" << indentation << "{\n" << indentation + << " return "; printType(o, options, manager, codemaker::convertString(reader.getFieldTypeName(i)), - false, defaultvalue); + false, true); o << ";\n" << indentation << "}\n\n"; } } else { o << "\n" << indentation << " { return " << delegate.getStr() << "get" << codemaker::convertString(reader.getFieldName(i)).getStr() - << "();\n" << indentation << "}\n\n"; + << "(); }\n"; } } else { o << ";\n"; } // REMOVE next line - rtl::OUString tmp = reader.getFieldName(i); + OUString tmp = reader.getFieldName(i); + bool setAttrMethod = false; if ((reader.getFieldFlags(i) & RT_ACCESS_READONLY) == 0) { o << indentation << "public void set" << (codemaker::convertString(reader.getFieldName(i)). @@ -432,24 +469,28 @@ void printMethods(std::ostream & o, && reader.getMethodFlags(method) == RT_MODE_ATTRIBUTE_SET && reader.getMethodName(method) == reader.getFieldName(i)) { - printExceptionSpecification(o, options, manager, reader, method++); + setAttrMethod=true; + printExceptionSpecification(o, options, manager, reader, method); } if (body) { if (defaultbody) { if (usepropertymixin) { - printSetPropertyMixinBody(o, reader, i, indentation); + printSetPropertyMixinBody(o, reader, i, method, + indentation); } else { - o << "\n" << indentation << "{\n\n" << indentation << "}\n\n"; + o << "\n" << indentation << "{\n\n" << indentation + << "}\n\n"; } } else { o << "\n" << indentation << " { " << delegate.getStr() << "set" << codemaker::convertString(reader.getFieldName(i)).getStr() - << "(the_value);\n" << indentation << "}"; + << "(the_value); }\n"; } } else { o << ";\n"; } + if (setAttrMethod) ++method; } } for (; method < reader.getMethodCount(); ++method) { @@ -467,7 +508,7 @@ void printMethods(std::ostream & o, o << ')'; printExceptionSpecification(o, options, manager, reader, method); if (body) { - static rtl::OUString s(RTL_CONSTASCII_USTRINGPARAM("void")); + static OUString s(RTL_CONSTASCII_USTRINGPARAM("void")); if (defaultbody) { o << "\n" << indentation << "{\n"; if (!reader.getMethodReturnTypeName(method).equals(s)) { @@ -476,7 +517,7 @@ void printMethods(std::ostream & o, options, manager, codemaker::convertString( reader.getMethodReturnTypeName(method)), - false, defaultvalue); + false, true); o << ";"; } o << "\n" << indentation << "}\n\n"; @@ -490,7 +531,7 @@ void printMethods(std::ostream & o, << '('; printMethodParameters(o, options, manager, reader, method, false, false); - o << ");\n" << indentation << "}\n"; + o << "); }\n"; } } else o << ";\n"; @@ -526,31 +567,32 @@ void printConstructionMethods(std::ostream & o, void generateDocumentation(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, - rtl::OString const & type); + OString const & type); void printServiceMembers(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, - typereg::Reader const & reader, rtl::OString const & type) + typereg::Reader const & reader, OString const & type, + OString const & delegate) { for (sal_uInt16 i = 0; i < reader.getReferenceCount(); ++i) { - rtl::OString referenceType( + OString referenceType( codemaker::convertString( reader.getReferenceTypeName(i)).replace('/', '.')); if ( reader.getReferenceSort(i) == RT_REF_SUPPORTS ) { o << "\n// supported interface " << referenceType.getStr() << "\n"; - generateDocumentation(o, options, manager, referenceType); + generateDocumentation(o, options, manager, referenceType, delegate); } else if ( reader.getReferenceSort(i) == RT_REF_EXPORTS ) { o << "\n// exported service " << referenceType.getStr() << "\n"; - generateDocumentation(o, options, manager, referenceType); + generateDocumentation(o, options, manager, referenceType, delegate); } } o << "\n// properties of service \""<< type.getStr() << "\"\n"; for (sal_uInt16 i = 0; i < reader.getFieldCount(); ++i) { - rtl::OString fieldName( + OString fieldName( codemaker::convertString(reader.getFieldName(i))); - rtl::OString fieldType( + OString fieldType( codemaker::convertString(reader.getFieldTypeName(i))); o << "// private "; @@ -565,8 +607,8 @@ void printServiceMembers(std::ostream & o, void printMapsToJavaType(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, codemaker::UnoType::Sort sort, RTTypeClass typeClass, - rtl::OString const & name, sal_Int32 rank, - std::vector< rtl::OString > const & arguments, const char * javaTypeSort) + OString const & name, sal_Int32 rank, + std::vector< OString > const & arguments, const char * javaTypeSort) { o << "maps to Java " << (options.java5 ? "1.5" : "1.4") << " "; if (javaTypeSort != 0) { @@ -584,91 +626,103 @@ void printMapsToJavaType(std::ostream & o, void generateDocumentation(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, - rtl::OString const & type) + OString const & type, OString const & delegate) { if (type.indexOf('/') >= 0) { throw CannotDumpException("Illegal type name " + type); } - rtl::OString binType(type.replace('.', '/')); + OString binType(type.replace('.', '/')); RTTypeClass typeClass; - rtl::OString name; + OString name; sal_Int32 rank; - std::vector< rtl::OString > arguments; + std::vector< OString > arguments; codemaker::UnoType::Sort sort = decomposeResolveAndCheck( manager, binType, false, true, true, &typeClass, &name, &rank, &arguments); - o << "\n// UNO"; - if (rank > 0) { - o << " sequence type"; - } else if (sort != codemaker::UnoType::SORT_COMPLEX) { - o << " simple type"; - } else { - typereg::Reader reader(manager.getTypeReader(name)); - if (!reader.isValid()) { - throw CannotDumpException("Bad type library entity " + name); - } - switch (typeClass) { - case RT_TYPE_INTERFACE: - o << " interface type"; - break; - case RT_TYPE_MODULE: - o << "IDL module"; - break; + bool comment=true; + if (delegate.getLength() > 0) { + if (typeClass != RT_TYPE_INTERFACE && + typeClass != RT_TYPE_SERVICE ) + return; - case RT_TYPE_STRUCT: - if (reader.getReferenceCount() == 0) { - o << " simple struct type"; - } else if (arguments.empty()) { - o << " polymorphic struct type template"; - } else { - o << " instantiated polymorphic struct type"; + comment=false; + } + + if (comment) { + o << "\n// UNO"; + if (rank > 0) { + o << " sequence type"; + } else if (sort != codemaker::UnoType::SORT_COMPLEX) { + o << " simple type"; + } else { + typereg::Reader reader(manager.getTypeReader(name)); + if (!reader.isValid()) { + throw CannotDumpException("Bad type library entity " + name); } - break; + switch (typeClass) { + case RT_TYPE_INTERFACE: + o << " interface type"; + break; + + case RT_TYPE_MODULE: + o << "IDL module"; + break; + + case RT_TYPE_STRUCT: + if (reader.getReferenceCount() == 0) { + o << " simple struct type"; + } else if (arguments.empty()) { + o << " polymorphic struct type template"; + } else { + o << " instantiated polymorphic struct type"; + } + break; - case RT_TYPE_ENUM: - o << " enum type"; - break; + case RT_TYPE_ENUM: + o << " enum type"; + break; - case RT_TYPE_EXCEPTION: - o << " exception type"; - break; + case RT_TYPE_EXCEPTION: + o << " exception type"; + break; - case RT_TYPE_TYPEDEF: - o << "IDL typedef"; - break; + case RT_TYPE_TYPEDEF: + o << "IDL typedef"; + break; - case RT_TYPE_SERVICE: - if (reader.getSuperTypeCount() > 0) { - o << " single-inheritance--based service"; - } else { - o << "IDL accumulation-based service"; - } - break; - - case RT_TYPE_SINGLETON: - if ((manager.getTypeReader( - codemaker::convertString( - reader.getSuperTypeName(0))). - getTypeClass()) - == RT_TYPE_INTERFACE) - { - o << " inheritance-based singleton"; - } else { - o << "IDL service-based singleton"; - } - break; + case RT_TYPE_SERVICE: + if (reader.getSuperTypeCount() > 0) { + o << " single-inheritance--based service"; + } else { + o << "IDL accumulation-based service"; + } + break; + + case RT_TYPE_SINGLETON: + if ((manager.getTypeReader( + codemaker::convertString( + reader.getSuperTypeName(0))). + getTypeClass()) + == RT_TYPE_INTERFACE) + { + o << " inheritance-based singleton"; + } else { + o << "IDL service-based singleton"; + } + break; - case RT_TYPE_CONSTANTS: - o << "IDL constant group"; - break; + case RT_TYPE_CONSTANTS: + o << "IDL constant group"; + break; - default: - OSL_ASSERT(false); - break; + default: + OSL_ASSERT(false); + break; + } } + o << " \"" << type.getStr() << "\" "; } - o << " \"" << type.getStr() << "\" "; sort = codemaker::decomposeAndResolve( manager, binType, true, true, true, &typeClass, &name, &rank, &arguments); @@ -697,9 +751,8 @@ void generateDocumentation(std::ostream & o, << "; " << (options.all ? "all" : "direct") << " methods:\n"; codemaker::GeneratedTypeSet generated; - StringPairHashMap attributes; - printMethods(o, options, manager, reader, attributes, generated, - "", "", false); + printMethods(o, options, manager, reader, generated, + delegate, ""); } break; @@ -752,15 +805,15 @@ void generateDocumentation(std::ostream & o, o << "; construction methods:\n"; printConstructionMethods(o, options, manager, reader); - rtl::OString super( + OString super( codemaker::convertString( reader.getSuperTypeName(0)).replace('/', '.')); - generateDocumentation(o, options, manager, super); + generateDocumentation(o, options, manager, super, delegate); } else { o << ("does not map to Java\n" "// the service members are generated instead\n"); - printServiceMembers(o, options, manager, reader, type); + printServiceMembers(o, options, manager, reader, type, delegate); } break; diff --git a/unodevtools/source/skeletonmaker/makefile.mk b/unodevtools/source/skeletonmaker/makefile.mk index 8a4118dd2a9a..692df16b3885 100644 --- a/unodevtools/source/skeletonmaker/makefile.mk +++ b/unodevtools/source/skeletonmaker/makefile.mk @@ -1,61 +1,35 @@ #************************************************************************* # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.1 $ -# -# last change: $Author: jsc $ $Date: 2005-08-23 08:30:33 $ -# -# The Contents of this file are made available subject to the terms of -# either of the following licenses -# -# - GNU Lesser General Public License Version 2.1 -# - Sun Industry Standards Source License Version 1.1 +# OpenOffice.org - a multi-platform office productivity suite # -# Sun Microsystems Inc., October, 2000 -# -# GNU Lesser General Public License Version 2.1 -# ============================================= -# Copyright 2000 by Sun Microsystems, Inc. -# 901 San Antonio Road, Palo Alto, CA 94303, USA -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License version 2.1, as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -# MA 02111-1307 USA +# $RCSfile: makefile.mk,v $ # +# $Revision: 1.2 $ # -# Sun Industry Standards Source License Version 1.1 -# ================================================= -# The contents of this file are subject to the Sun Industry Standards -# Source License Version 1.1 (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.openoffice.org/license.html. +# last change: $Author: jsc $ $Date: 2005-09-09 13:50:31 $ # -# Software provided under this License is provided on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -# See the License for the specific provisions governing your rights and -# obligations concerning the Software. +# The Contents of this file are made available subject to +# the terms of GNU Lesser General Public License Version 2.1. # -# The Initial Developer of the Original Code is: Sun Microsystems, Inc. # -# Copyright: 2000 by Sun Microsystems, Inc. +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2005 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA # -# All Rights Reserved. +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. # -# Contributor(s): _______________________________________ +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. # +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA # #************************************************************************* diff --git a/unodevtools/source/skeletonmaker/skeletoncommon.cxx b/unodevtools/source/skeletonmaker/skeletoncommon.cxx index e7260f6de19a..8ceaa2ba6f1e 100644 --- a/unodevtools/source/skeletonmaker/skeletoncommon.cxx +++ b/unodevtools/source/skeletonmaker/skeletoncommon.cxx @@ -1,88 +1,66 @@ /************************************************************************* * - * $RCSfile: skeletoncommon.cxx,v $ - * - * $Revision: 1.2 $ - * - * last change: $Author: jsc $ $Date: 2005-08-25 15:30:33 $ - * - * The Contents of this file are made available subject to the terms of - * either of the following licenses - * - * - GNU Lesser General Public License Version 2.1 - * - Sun Industry Standards Source License Version 1.1 - * - * Sun Microsystems Inc., October, 2000 + * OpenOffice.org - a multi-platform office productivity suite * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2000 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * $RCSfile: skeletoncommon.cxx,v $ * + * $Revision: 1.3 $ * - * Sun Industry Standards Source License Version 1.1 - * ================================================= - * The contents of this file are subject to the Sun Industry Standards - * Source License Version 1.1 (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.openoffice.org/license.html. + * last change: $Author: jsc $ $Date: 2005-09-09 13:50:32 $ * - * Software provided under this License is provided on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, - * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. - * See the License for the specific provisions governing your rights and - * obligations concerning the Software. + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. * - * The Initial Developer of the Original Code is: Sun Microsystems, Inc. * - * Copyright: 2000 by Sun Microsystems, Inc. + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA * - * All Rights Reserved. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. * - * Contributor(s): _______________________________________ + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA * ************************************************************************/ #include <osl/thread.hxx> -#include "skeletonmaker.hxx" + +#include <codemaker/commonjava.hxx> +#include <codemaker/commoncpp.hxx> + #include "skeletoncommon.hxx" +using namespace ::rtl; using namespace ::codemaker::cpp; namespace skeletonmaker { codemaker::UnoType::Sort decomposeResolveAndCheck( - TypeManager const & manager, rtl::OString const & type, + TypeManager const & manager, OString const & type, bool resolveTypedefs, bool allowVoid, bool allowExtraEntities, - RTTypeClass * typeClass, rtl::OString * name, sal_Int32 * rank, - std::vector< rtl::OString > * arguments) + RTTypeClass * typeClass, OString * name, sal_Int32 * rank, + std::vector< OString > * arguments) { codemaker::UnoType::Sort sort = codemaker::decomposeAndResolve( manager, type, resolveTypedefs, allowVoid, allowExtraEntities, typeClass, name, rank, arguments); - for (std::vector< rtl::OString >::iterator i(arguments->begin()); + for (std::vector< OString >::iterator i(arguments->begin()); i != arguments->end(); ++i) { RTTypeClass typeClass2; - rtl::OString name2; + OString name2; sal_Int32 rank2; - std::vector< rtl::OString > arguments2; + std::vector< OString > arguments2; decomposeResolveAndCheck( manager, *i, true, false, false, &typeClass2, &name2, &rank2, &arguments2); @@ -90,14 +68,55 @@ codemaker::UnoType::Sort decomposeResolveAndCheck( return sort; } +// collect attributes including inherited attributes +void checkAttributes(TypeManager const & manager, + const typereg::Reader& reader, + StringPairHashMap& attributes, + std::hash_set< OString, OStringHash >& propinterfaces) +{ + OString typeName = codemaker::convertString(reader.getTypeName()); + if (typeName.equals("com/sun/star/beans/XPropertySet") || + typeName.equals("com/sun/star/beans/XFastPropertySet") || + typeName.equals("com/sun/star/beans/XMultiPropertySet") || + typeName.equals("com/sun/star/beans/XPropertyAccess") ) + { + propinterfaces.insert(typeName); + } + + for (sal_uInt16 i = 0; i < reader.getSuperTypeCount(); ++i) { + typereg::Reader supertype(manager.getTypeReader( + codemaker::convertString( + reader.getSuperTypeName(i)))); + if (!supertype.isValid()) { + throw CannotDumpException( + "Bad type library entity " + + codemaker::convertString(reader.getSuperTypeName(i))); + } + checkAttributes(manager, supertype, attributes, propinterfaces); + } + + for (sal_uInt16 i = 0; i < reader.getFieldCount(); ++i) { + OString fieldName( + codemaker::convertString(reader.getFieldName(i)). + replace('/', '.')); + OString fieldType( + codemaker::convertString(reader.getFieldTypeName(i)). + replace('/', '.')); + attributes.insert(StringPairHashMap::value_type( + fieldName, + std::pair<OString, sal_Int16>( + fieldType, reader.getFieldFlags(i)))); + } +} + void checkType(TypeManager const & manager, - rtl::OString const & type, - std::hash_set< rtl::OString, rtl::OStringHash >& interfaceTypes, - std::hash_set< rtl::OString, rtl::OStringHash >& serviceTypes, - StringPairHashMap& properties, - bool& attributes) { + OString const & type, + std::hash_set< OString, OStringHash >& interfaceTypes, + std::hash_set< OString, OStringHash >& serviceTypes, + StringPairHashMap& properties) +{ - rtl::OString binType(type.replace('.', '/')); + OString binType(type.replace('.', '/')); typereg::Reader reader(manager.getTypeReader(binType)); if (!reader.isValid()) { throw CannotDumpException("Bad type library entity " + binType); @@ -114,8 +133,6 @@ void checkType(TypeManager const & manager, return; if (interfaceTypes.find(type) == interfaceTypes.end()) { interfaceTypes.insert(type); - if (reader.getFieldCount() > 0) - attributes |= true; } } break; @@ -124,35 +141,53 @@ void checkType(TypeManager const & manager, serviceTypes.insert(binType); if (reader.getSuperTypeCount() > 0) { - rtl::OString superType(codemaker::convertString( + OString supername(codemaker::convertString( reader.getSuperTypeName(0).replace('/', '.'))); - if (interfaceTypes.find(superType) == interfaceTypes.end()) - interfaceTypes.insert(superType); + if (interfaceTypes.find(supername) == interfaceTypes.end()) { + interfaceTypes.insert(supername); + + typereg::Reader supertype(manager.getTypeReader( + codemaker::convertString( + reader.getSuperTypeName(0)))); + if (!supertype.isValid()) { + throw CannotDumpException( + "Bad type library entity " + + codemaker::convertString(reader.getSuperTypeName(0))); + } + } + + // check if constructors are specified, if yes automatically + // support of XInitialization + if (reader.getMethodCount() > 0) { + OString s("com.sun.star.lang.XInitialization"); + if (interfaceTypes.find(s) == interfaceTypes.end()) + interfaceTypes.insert(s); + } } else { for (sal_uInt16 i = 0; i < reader.getReferenceCount(); ++i) { - rtl::OString referenceType( + OString referenceType( codemaker::convertString( reader.getReferenceTypeName(i)).replace('/', '.')); if ( reader.getReferenceSort(i) == RT_REF_SUPPORTS ) { checkType(manager, referenceType, interfaceTypes, - serviceTypes, properties, attributes); + serviceTypes, properties); } else if ( reader.getReferenceSort(i) == RT_REF_EXPORTS ) { checkType(manager, referenceType, interfaceTypes, - serviceTypes, properties, attributes); + serviceTypes, properties); } } for (sal_uInt16 i = 0; i < reader.getFieldCount(); ++i) { - rtl::OString fieldName( + OString fieldName( codemaker::convertString(reader.getFieldName(i)). replace('/', '.')); - rtl::OString fieldType( + OString fieldType( codemaker::convertString(reader.getFieldTypeName(i)). replace('/', '.')); properties.insert(StringPairHashMap::value_type(fieldName, - std::pair<rtl::OString, sal_Int16>( + std::pair<OString, sal_Int16>( fieldType, reader.getFieldFlags(i)))); } } @@ -165,9 +200,9 @@ void checkType(TypeManager const & manager, } void checkDefaultInterfaces( - std::hash_set< rtl::OString, rtl::OStringHash >& interfaces, - const std::hash_set< rtl::OString, rtl::OStringHash >& services, - const rtl::OString & propertyhelper) + std::hash_set< OString, OStringHash >& interfaces, + const std::hash_set< OString, OStringHash >& services, + const OString & propertyhelper) { if (services.empty()) { if (interfaces.find("com.sun.star.lang.XServiceInfo") != interfaces.end()) @@ -178,38 +213,46 @@ void checkDefaultInterfaces( } if (propertyhelper.equals("_")) { - if (interfaces.find("com.sun.star.beans.XPropertySet") != interfaces.end()) + if (interfaces.find("com.sun.star.beans.XPropertySet") + != interfaces.end()) interfaces.erase("com.sun.star.beans.XPropertySet"); - if (interfaces.find("com.sun.star.beans.XFastPropertySet") != interfaces.end()) + if (interfaces.find("com.sun.star.beans.XFastPropertySet") + != interfaces.end()) interfaces.erase("com.sun.star.beans.XFastPropertySet"); - if (interfaces.find("com.sun.star.beans.XPropertyAccess") != interfaces.end()) + if (interfaces.find("com.sun.star.beans.XPropertyAccess") + != interfaces.end()) interfaces.erase("com.sun.star.beans.XPropertyAccess"); } } -rtl::OString checkPropertyHelper(TypeManager const & manager, - const std::hash_set< rtl::OString, rtl::OStringHash >& services) +OString checkPropertyHelper( + TypeManager const & manager, + const std::hash_set< OString, OStringHash >& services, + StringPairHashMap& attributes, + std::hash_set< OString, OStringHash >& propinterfaces) { - std::hash_set< rtl::OString, rtl::OStringHash >::const_iterator iter = + std::hash_set< OString, OStringHash >::const_iterator iter = services.begin(); bool oldStyleWithProperties = false; while (iter != services.end()) { typereg::Reader reader(manager.getTypeReader((*iter).replace('.', '/'))); if (reader.getSuperTypeCount() > 0) { - typereg::Reader super( + typereg::Reader supertype( manager.getTypeReader( codemaker::convertString( reader.getSuperTypeName(0)))); - if (!super.isValid()) { + if (!supertype.isValid()) { throw CannotDumpException( "Bad type library entity " + codemaker::convertString( reader.getSuperTypeName(0))); } - if (super.getFieldCount() > 0) - return rtl::OUStringToOString(super.getTypeName().replace('/', '.'), + checkAttributes(manager, supertype, attributes, propinterfaces); + + if (!(attributes.empty() || propinterfaces.empty())) + return OUStringToOString(supertype.getTypeName().replace('/', '.'), osl_getThreadTextEncoding()); } else { if (reader.getFieldCount() > 0) @@ -225,7 +268,8 @@ rtl::OString checkPropertyHelper(TypeManager const & manager, bool checkXComponentSupport(TypeManager const & manager, typereg::Reader const & reader) { - static rtl::OUString s(RTL_CONSTASCII_USTRINGPARAM("com/sun/star/lang/XComponent")); + static OUString s(RTL_CONSTASCII_USTRINGPARAM( + "com/sun/star/lang/XComponent")); if (reader.getTypeName().equals(s)) return true; @@ -251,12 +295,12 @@ bool checkXComponentSupport(TypeManager const & manager, // if XComponent is directly specified, return true and remove it from the // supported interfaces list bool checkXComponentSupport(TypeManager const & manager, - std::hash_set< rtl::OString, rtl::OStringHash >& interfaces) + std::hash_set< OString, OStringHash >& interfaces) { if (interfaces.empty()) return false; - std::hash_set< rtl::OString, rtl::OStringHash >::const_iterator iter = + std::hash_set< OString, OStringHash >::const_iterator iter = interfaces.begin(); while (iter != interfaces.end()) { if ((*iter).equals("com.sun.star.lang.XComponent")) { @@ -272,5 +316,46 @@ bool checkXComponentSupport(TypeManager const & manager, return false; } +sal_uInt16 checkAdditionalPropertyFlags(typereg::Reader const & reader, + sal_uInt16 field, sal_uInt16 method) +{ + sal_uInt16 flags = 0; + bool getterSupportsUnknown = false; + + OUString su(RTL_CONSTASCII_USTRINGPARAM( + "com/sun/star/beans/UnknownPropertyException")); + if (method < reader.getMethodCount() + && reader.getMethodFlags(method) == RT_MODE_ATTRIBUTE_GET + && reader.getMethodName(method) == reader.getFieldName(field)) + { + if (reader.getMethodExceptionCount(method) > 0) { + for (sal_uInt16 i = 0; i < reader.getMethodExceptionCount(method); ++i) + { + if (su.equals(reader.getMethodExceptionTypeName(method, i))) + getterSupportsUnknown = true; + } + } + method++; + } + if (method < reader.getMethodCount() + && reader.getMethodFlags(method) == RT_MODE_ATTRIBUTE_SET + && reader.getMethodName(method) == reader.getFieldName(field)) + { + if (reader.getMethodExceptionCount(method) > 0) { + OUString s(RTL_CONSTASCII_USTRINGPARAM( + "com/sun/star/beans/PropertyVetoException")); + for (sal_uInt16 i = 0; i < reader.getMethodExceptionCount(method); ++i) + { + if (s.equals(reader.getMethodExceptionTypeName(method, i))) + flags |= RT_ACCESS_CONSTRAINED; + if (getterSupportsUnknown && + su.equals(reader.getMethodExceptionTypeName(method, i))) + flags |= RT_ACCESS_OPTIONAL; + } + } + } + return flags; +} + } diff --git a/unodevtools/source/skeletonmaker/skeletoncommon.hxx b/unodevtools/source/skeletonmaker/skeletoncommon.hxx index 895fae0f001d..8f26a0294301 100644 --- a/unodevtools/source/skeletonmaker/skeletoncommon.hxx +++ b/unodevtools/source/skeletonmaker/skeletoncommon.hxx @@ -1,70 +1,82 @@ /************************************************************************* * - * $RCSfile: skeletoncommon.hxx,v $ - * - * $Revision: 1.1 $ - * - * last change: $Author: jsc $ $Date: 2005-08-23 08:31:00 $ - * - * The Contents of this file are made available subject to the terms of - * either of the following licenses - * - * - GNU Lesser General Public License Version 2.1 - * - Sun Industry Standards Source License Version 1.1 - * - * Sun Microsystems Inc., October, 2000 - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2000 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * OpenOffice.org - a multi-platform office productivity suite * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * $RCSfile: skeletoncommon.hxx,v $ * + * $Revision: 1.2 $ * - * Sun Industry Standards Source License Version 1.1 - * ================================================= - * The contents of this file are subject to the Sun Industry Standards - * Source License Version 1.1 (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.openoffice.org/license.html. + * last change: $Author: jsc $ $Date: 2005-09-09 13:50:33 $ * - * Software provided under this License is provided on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, - * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. - * See the License for the specific provisions governing your rights and - * obligations concerning the Software. + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. * - * The Initial Developer of the Original Code is: Sun Microsystems, Inc. * - * Copyright: 2000 by Sun Microsystems, Inc. + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA * - * All Rights Reserved. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. * - * Contributor(s): _______________________________________ + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA * ************************************************************************/ #ifndef _UNO_DEVTOOLS_SKELETONCOMMON_HXX_ #define _UNO_DEVTOOLS_SKELETONCOMMON_HXX_ -#include "skeletonmaker.hxx" +#ifndef _RTL_STRING_HXX_ +#include <rtl/string.hxx> +#endif +#ifndef _REGISTRY_READER_HXX_ +#include <registry/reader.hxx> +#endif +#ifndef _CODEMAKER_TYPEMANAGER_HXX_ +#include <codemaker/typemanager.hxx> +#endif +#ifndef _CODEMAKER_UNOTYPE_HXX_ +#include <codemaker/unotype.hxx> +#endif + +#include <hash_set> +#include <hash_map> + +// #ifndef _UNO_DEVTOOLS_SKELETONMAKER_HXX_ +// #include "skeletonmaker.hxx" +// #endif namespace skeletonmaker { +struct ProgramOptions { + ProgramOptions(): java5(true), all(false), dump(false), + language(1) {} + + bool java5; + bool all; + bool dump; + // language specifier - is extendable + // 1 = Java + // 2 = C++ + short language; + rtl::OString outputpath; + rtl::OString implname; +}; + +typedef ::std::hash_map< ::rtl::OString, + std::pair< rtl::OString, sal_Int16 >, + rtl::OStringHash > StringPairHashMap; + + codemaker::UnoType::Sort decomposeResolveAndCheck( TypeManager const & manager, rtl::OString const & type, bool resolveTypedefs, bool allowVoid, bool allowExtraEntities, @@ -75,7 +87,7 @@ void checkType(TypeManager const & manager, rtl::OString const & type, std::hash_set< rtl::OString, rtl::OStringHash >& interfaceTypes, std::hash_set< rtl::OString, rtl::OStringHash >& serviceTypes, - StringPairHashMap& properties, bool& attributes); + StringPairHashMap& properties); void checkDefaultInterfaces( std::hash_set< rtl::OString, rtl::OStringHash >& interfaces, @@ -83,7 +95,9 @@ void checkDefaultInterfaces( const rtl::OString & propertyhelper); rtl::OString checkPropertyHelper(TypeManager const & manager, - const std::hash_set< rtl::OString, rtl::OStringHash >& services); + const std::hash_set< rtl::OString, rtl::OStringHash >& services, + StringPairHashMap& attributes, + std::hash_set< rtl::OString, rtl::OStringHash >& propinterfaces); bool checkXComponentSupport(TypeManager const & manager, typereg::Reader const & reader); @@ -93,6 +107,9 @@ bool checkXComponentSupport(TypeManager const & manager, bool checkXComponentSupport(TypeManager const & manager, std::hash_set< rtl::OString, rtl::OStringHash >& interfaces); +sal_uInt16 checkAdditionalPropertyFlags(typereg::Reader const & reader, + sal_uInt16 field, sal_uInt16 method); + } #endif // _UNO_DEVTOOLS_SKELETONCOMMON_HXX_ diff --git a/unodevtools/source/skeletonmaker/skeletoncpp.hxx b/unodevtools/source/skeletonmaker/skeletoncpp.hxx index a74ad470da97..07dedc573616 100644 --- a/unodevtools/source/skeletonmaker/skeletoncpp.hxx +++ b/unodevtools/source/skeletonmaker/skeletoncpp.hxx @@ -1,67 +1,48 @@ /************************************************************************* * - * $RCSfile: skeletoncpp.hxx,v $ - * - * $Revision: 1.1 $ - * - * last change: $Author: jsc $ $Date: 2005-08-23 08:31:11 $ - * - * The Contents of this file are made available subject to the terms of - * either of the following licenses - * - * - GNU Lesser General Public License Version 2.1 - * - Sun Industry Standards Source License Version 1.1 - * - * Sun Microsystems Inc., October, 2000 + * OpenOffice.org - a multi-platform office productivity suite * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2000 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * $RCSfile: skeletoncpp.hxx,v $ * + * $Revision: 1.2 $ * - * Sun Industry Standards Source License Version 1.1 - * ================================================= - * The contents of this file are subject to the Sun Industry Standards - * Source License Version 1.1 (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.openoffice.org/license.html. + * last change: $Author: jsc $ $Date: 2005-09-09 13:50:34 $ * - * Software provided under this License is provided on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, - * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. - * See the License for the specific provisions governing your rights and - * obligations concerning the Software. + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. * - * The Initial Developer of the Original Code is: Sun Microsystems, Inc. * - * Copyright: 2000 by Sun Microsystems, Inc. + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA * - * All Rights Reserved. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. * - * Contributor(s): _______________________________________ + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA * ************************************************************************/ #ifndef _UNO_DEVTOOLS_SKELETONCPP_HXX_ #define _UNO_DEVTOOLS_SKELETONCPP_HXX_ +#include <fstream> + +#ifndef _CODEMAKER_GENERATEDTYPESET_HXX_ +#include <codemaker/generatedtypeset.hxx> +#endif +#ifndef _UNO_DEVTOOLS_SKELETONCOMMON_HXX_ #include "skeletoncommon.hxx" +#endif namespace skeletonmaker { namespace cpp { @@ -124,7 +105,8 @@ void printMethods(std::ostream & o, rtl::OString const & delegate, rtl::OString const & classname=rtl::OString(), rtl::OString const & indentation=rtl::OString(), - bool shortname=false, bool defaultvalue=false); + bool shortname=false, bool defaultvalue=false, + bool usepropertymixin=false); void printConstructionMethods(std::ostream & o, @@ -137,7 +119,8 @@ void printServiceMembers(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, typereg::Reader const & reader, - rtl::OString const & type); + rtl::OString const & type, + rtl::OString const & delegate); void printMapsToCppType(std::ostream & o, diff --git a/unodevtools/source/skeletonmaker/skeletonjava.hxx b/unodevtools/source/skeletonmaker/skeletonjava.hxx index 1e2f7b2fa232..eec373562c90 100644 --- a/unodevtools/source/skeletonmaker/skeletonjava.hxx +++ b/unodevtools/source/skeletonmaker/skeletonjava.hxx @@ -1,67 +1,48 @@ /************************************************************************* * - * $RCSfile: skeletonjava.hxx,v $ - * - * $Revision: 1.2 $ - * - * last change: $Author: jsc $ $Date: 2005-08-25 15:30:33 $ - * - * The Contents of this file are made available subject to the terms of - * either of the following licenses - * - * - GNU Lesser General Public License Version 2.1 - * - Sun Industry Standards Source License Version 1.1 - * - * Sun Microsystems Inc., October, 2000 + * OpenOffice.org - a multi-platform office productivity suite * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2000 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * $RCSfile: skeletonjava.hxx,v $ * + * $Revision: 1.3 $ * - * Sun Industry Standards Source License Version 1.1 - * ================================================= - * The contents of this file are subject to the Sun Industry Standards - * Source License Version 1.1 (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.openoffice.org/license.html. + * last change: $Author: jsc $ $Date: 2005-09-09 13:50:35 $ * - * Software provided under this License is provided on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, - * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. - * See the License for the specific provisions governing your rights and - * obligations concerning the Software. + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. * - * The Initial Developer of the Original Code is: Sun Microsystems, Inc. * - * Copyright: 2000 by Sun Microsystems, Inc. + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA * - * All Rights Reserved. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. * - * Contributor(s): _______________________________________ + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA * ************************************************************************/ #ifndef _UNO_DEVTOOLS_SKELETONJAVA_HXX_ #define _UNO_DEVTOOLS_SKELETONJAVA_HXX_ +#include <fstream> + +#ifndef _CODEMAKER_GENERATEDTYPESET_HXX_ +#include <codemaker/generatedtypeset.hxx> +#endif +#ifndef _UNO_DEVTOOLS_SKELETONCOMMON_HXX_ #include "skeletoncommon.hxx" +#endif namespace skeletonmaker { namespace java { @@ -106,7 +87,6 @@ void printExceptionSpecification(std::ostream & o, void printMethods(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, typereg::Reader const & reader, - StringPairHashMap& attributes, codemaker::GeneratedTypeSet & generated, rtl::OString const & delegate, rtl::OString const & indentation=rtl::OString(), @@ -122,7 +102,8 @@ void printServiceMembers(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, typereg::Reader const & reader, - rtl::OString const & type); + rtl::OString const & type, + rtl::OString const & delegate); void printMapsToJavaType(std::ostream & o, ProgramOptions const & options, @@ -136,7 +117,8 @@ void printMapsToJavaType(std::ostream & o, void generateDocumentation(std::ostream & o, ProgramOptions const & options, TypeManager const & manager, - rtl::OString const & type); + rtl::OString const & type, + rtl::OString const & delegate); void generateSkeleton(ProgramOptions const & options, TypeManager const & manager, std::vector< rtl::OString > const & types, rtl::OString const & delegate); diff --git a/unodevtools/source/skeletonmaker/skeletonmaker.cxx b/unodevtools/source/skeletonmaker/skeletonmaker.cxx index 88f2707b0bbf..ebffa7519d53 100644 --- a/unodevtools/source/skeletonmaker/skeletonmaker.cxx +++ b/unodevtools/source/skeletonmaker/skeletonmaker.cxx @@ -1,63 +1,38 @@ /************************************************************************* * - * $RCSfile: skeletonmaker.cxx,v $ - * - * $Revision: 1.1 $ - * - * last change: $Author: jsc $ $Date: 2005-08-23 08:31:46 $ - * - * The Contents of this file are made available subject to the terms of - * either of the following licenses - * - * - GNU Lesser General Public License Version 2.1 - * - Sun Industry Standards Source License Version 1.1 + * OpenOffice.org - a multi-platform office productivity suite * - * Sun Microsystems Inc., October, 2000 - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2000 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * $RCSfile: skeletonmaker.cxx,v $ * + * $Revision: 1.2 $ * - * Sun Industry Standards Source License Version 1.1 - * ================================================= - * The contents of this file are subject to the Sun Industry Standards - * Source License Version 1.1 (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.openoffice.org/license.html. + * last change: $Author: jsc $ $Date: 2005-09-09 13:50:36 $ * - * Software provided under this License is provided on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, - * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. - * See the License for the specific provisions governing your rights and - * obligations concerning the Software. + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. * - * The Initial Developer of the Original Code is: Sun Microsystems, Inc. * - * Copyright: 2000 by Sun Microsystems, Inc. + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA * - * All Rights Reserved. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. * - * Contributor(s): _______________________________________ + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA * ************************************************************************/ +#include <iostream> #include "sal/main.h" #include "rtl/process.h" @@ -79,8 +54,8 @@ namespace { static const char usageText[] = "\n sub-commands:\n" " dump dump declarations on stdout (e.g. constructors, methods, type\n" -" mapping for properties)\n" -" or complete method bodies with method forwarding.\n" +" mapping for properties) or complete method bodies with\n" +" method forwarding.\n" " component generates language specific code skeleton files using the\n" " implementation name as the file and class name\n" "\n options:\n" @@ -119,11 +94,12 @@ static const char usageText[] = void printUsageAndExit(char* programname, char* version) { std::cerr << "\n using: " << programname - << " dump [<options>] (-env:INIFILENAME=<url> | \n" - << " -env:UNO_TYPES=<url>) -t <type> ...\n" + << " (-env:INIFILENAME=<url> | -env:UNO_TYPES=<url>)\n" + << " dump [<options>] -t <type> ...\n" << " " << programname - << " component [<options>] (-env:INIFILENAME=<path>\n" - << " | -env:UNO_TYPES=<url>) -n <name> -t <type> ...\n" + << " (-env:INIFILENAME=<url> | -env:UNO_TYPES=<url>)\n" + << " component [<options>] -n <name> -t " + << "<type> ...\n" << " " << programname << " --v\n" << " " << programname << " --h\n" << usageText @@ -142,9 +118,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) printUsageAndExit(programname, version); ProgramOptions options; - std::vector< rtl::OUString > registries; - std::vector< rtl::OString > types; - rtl::OString delegate; + std::vector< OUString > registries; + std::vector< OString > types; + OString delegate; try { @@ -242,13 +218,13 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) } if (options.dump) { - std::vector< rtl::OString >::const_iterator iter = types.begin(); + std::vector< OString >::const_iterator iter = types.begin(); while (iter != types.end()) { std::cout << "\n/********************************************************************************/\n"; switch (options.language ) { case 1: //Java java::generateDocumentation(std::cout, options, manager, - *iter); + *iter, delegate); break; case 2: //C++ cpp::generateDocumentation(std::cout, options, manager, diff --git a/unodevtools/source/unodevtools/makefile.mk b/unodevtools/source/unodevtools/makefile.mk index ae5534ea1791..5dc1fba76c6a 100644 --- a/unodevtools/source/unodevtools/makefile.mk +++ b/unodevtools/source/unodevtools/makefile.mk @@ -1,62 +1,35 @@ #************************************************************************* # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.1 $ -# -# last change: $Author: jsc $ $Date: 2005-08-23 08:27:34 $ -# -# The Contents of this file are made available subject to the terms of -# either of the following licenses -# -# - GNU Lesser General Public License Version 2.1 -# - Sun Industry Standards Source License Version 1.1 -# -# Sun Microsystems Inc., October, 2000 -# -# GNU Lesser General Public License Version 2.1 -# ============================================= -# Copyright 2000 by Sun Microsystems, Inc. -# 901 San Antonio Road, Palo Alto, CA 94303, USA -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License version 2.1, as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -# MA 02111-1307 USA +# OpenOffice.org - a multi-platform office productivity suite # +# $RCSfile: makefile.mk,v $ # -# Sun Industry Standards Source License Version 1.1 -# ================================================= -# The contents of this file are subject to the Sun Industry Standards -# Source License Version 1.1 (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.openoffice.org/license.html. +# $Revision: 1.2 $ # -# Software provided under this License is provided on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -# See the License for the specific provisions governing your rights and -# obligations concerning the Software. +# last change: $Author: jsc $ $Date: 2005-09-09 13:50:38 $ # -# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# The Contents of this file are made available subject to +# the terms of GNU Lesser General Public License Version 2.1. # -# Copyright: 2000 by Sun Microsystems, Inc. # -# All Rights Reserved. +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2005 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA # -# Contributor(s): _______________________________________ +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. # +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. # +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA # #************************************************************************* PRJ=..$/.. diff --git a/unodevtools/source/unodevtools/options.cxx b/unodevtools/source/unodevtools/options.cxx index 051a13ade233..9a7acb5412ed 100644 --- a/unodevtools/source/unodevtools/options.cxx +++ b/unodevtools/source/unodevtools/options.cxx @@ -1,61 +1,35 @@ /************************************************************************* * - * $RCSfile: options.cxx,v $ - * - * $Revision: 1.1 $ - * - * last change: $Author: jsc $ $Date: 2005-08-23 08:26:33 $ - * - * The Contents of this file are made available subject to the terms of - * either of the following licenses - * - * - GNU Lesser General Public License Version 2.1 - * - Sun Industry Standards Source License Version 1.1 + * OpenOffice.org - a multi-platform office productivity suite * - * Sun Microsystems Inc., October, 2000 - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2000 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * $RCSfile: options.cxx,v $ * + * $Revision: 1.2 $ * - * Sun Industry Standards Source License Version 1.1 - * ================================================= - * The contents of this file are subject to the Sun Industry Standards - * Source License Version 1.1 (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.openoffice.org/license.html. + * last change: $Author: jsc $ $Date: 2005-09-09 13:50:38 $ * - * Software provided under this License is provided on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, - * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. - * See the License for the specific provisions governing your rights and - * obligations concerning the Software. + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. * - * The Initial Developer of the Original Code is: Sun Microsystems, Inc. * - * Copyright: 2000 by Sun Microsystems, Inc. + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA * - * All Rights Reserved. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. * - * Contributor(s): _______________________________________ + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA * ************************************************************************/ @@ -133,7 +107,7 @@ sal_Bool readOption( OUString * pValue, const sal_Char * pOpt, out( "\n> identified option -" ); out( pOpt ); out( " = " ); - OString tmp = OUStringToOString(aArg.copy(aOpt.getLength()), RTL_TEXTENCODING_ASCII_US); + OString tmp = OUStringToOString(*pValue, RTL_TEXTENCODING_ASCII_US); out( tmp.getStr() ); #endif ++(*pnIndex); diff --git a/unodevtools/source/unodevtools/typeblob.cxx b/unodevtools/source/unodevtools/typeblob.cxx index 6c8df8b7c893..2096a838a825 100644 --- a/unodevtools/source/unodevtools/typeblob.cxx +++ b/unodevtools/source/unodevtools/typeblob.cxx @@ -1,61 +1,35 @@ /************************************************************************* * - * $RCSfile: typeblob.cxx,v $ - * - * $Revision: 1.1 $ - * - * last change: $Author: jsc $ $Date: 2005-08-23 08:26:55 $ - * - * The Contents of this file are made available subject to the terms of - * either of the following licenses - * - * - GNU Lesser General Public License Version 2.1 - * - Sun Industry Standards Source License Version 1.1 - * - * Sun Microsystems Inc., October, 2000 + * OpenOffice.org - a multi-platform office productivity suite * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2000 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * $RCSfile: typeblob.cxx,v $ * + * $Revision: 1.2 $ * - * Sun Industry Standards Source License Version 1.1 - * ================================================= - * The contents of this file are subject to the Sun Industry Standards - * Source License Version 1.1 (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.openoffice.org/license.html. + * last change: $Author: jsc $ $Date: 2005-09-09 13:50:40 $ * - * Software provided under this License is provided on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, - * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. - * See the License for the specific provisions governing your rights and - * obligations concerning the Software. + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. * - * The Initial Developer of the Original Code is: Sun Microsystems, Inc. * - * Copyright: 2000 by Sun Microsystems, Inc. + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA * - * All Rights Reserved. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. * - * Contributor(s): _______________________________________ + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA * ************************************************************************/ @@ -254,6 +228,32 @@ void writeMethodData( typereg::Writer& rWriter, sal_uInt32 calculatedMemberOffse } } +void writeAttributeMethodData( + typereg::Writer& rWriter, sal_uInt16& methodindex, RTMethodMode methodmode, + const Reference<XInterfaceAttributeTypeDescription2>& xAttr) +{ + Sequence<Reference<XCompoundTypeDescription> > seqExcp; + if (methodmode == RT_MODE_ATTRIBUTE_GET) + seqExcp = xAttr->getGetExceptions(); + else + seqExcp = xAttr->getSetExceptions(); + + if (seqExcp.getLength() > 0) { + rWriter.setMethodData(methodindex, OUString(), methodmode, + xAttr->getMemberName(), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("void")), + 0, (sal_uInt16)seqExcp.getLength()); + + for (sal_Int32 i=0; i < seqExcp.getLength(); i++) + { + rWriter.setMethodExceptionTypeName( + methodindex, (sal_uInt16)i, + seqExcp[i]->getName().replace('.', '/')); + } + ++methodindex; + } +} + RTFieldAccess checkParameterizedTypeFlag(const Sequence< OUString >& typeParams, const OUString & memberType) { @@ -403,7 +403,7 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, sal_uInt16 baseCount = (sal_uInt16)baseTypes.getLength(); sal_uInt16 optBaseCount = (sal_uInt16)optBaseTypes.getLength(); sal_uInt16 memberCount = (sal_uInt16)memberTypes.getLength(); - sal_uInt16 attrCount = 0; + sal_uInt16 attrCount = 0, attrmethods = 0; sal_uInt16 inheritedMemberCount = 0; sal_uInt16 i; @@ -411,8 +411,15 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, { xAttr = Reference< XInterfaceAttributeTypeDescription2 >( memberTypes[i], UNO_QUERY); - if ( xAttr.is() ) + if ( xAttr.is() ) { attrCount++; + + if (xAttr->getGetExceptions().getLength() > 0) + attrmethods++; + + if (xAttr->getSetExceptions().getLength() > 0) + attrmethods++; + } } // check inherited members count @@ -426,7 +433,7 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, typereg::Writer writer(TYPEREG_VERSION_1, OUString(), OUString(), RT_TYPE_INTERFACE, xPublished->isPublished(), uTypeName.replace('.', '/'), - baseCount, attrCount, memberCount-attrCount, + baseCount, attrCount, memberCount-attrCount+attrmethods, (sal_uInt16)optBaseTypes.getLength()); // set super types @@ -447,6 +454,7 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, fieldAccess = RT_ACCESS_READWRITE; // reset attrCount, used for method index calculation attrCount = 0; + attrmethods = 0; for (i=0; i < memberCount; i++) { xAttr = Reference< XInterfaceAttributeTypeDescription2 >( @@ -462,13 +470,18 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, if (xAttr->isBound()) fieldAccess |= RT_ACCESS_BOUND; - writer.setFieldData((sal_uInt16)memberTypes[i]->getPosition() - inheritedMemberCount, OUString(), OUString(), fieldAccess, memberTypes[i]->getMemberName(), xAttr->getType()->getName().replace('.','/'), RTConstValue()); + + writeAttributeMethodData(writer, attrmethods, + RT_MODE_ATTRIBUTE_GET, xAttr); + writeAttributeMethodData(writer, attrmethods, + RT_MODE_ATTRIBUTE_SET, xAttr); + continue; } @@ -476,7 +489,7 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, memberTypes[i], UNO_QUERY); if ( xMethod.is() ) { - writeMethodData(writer, attrCount+inheritedMemberCount, + writeMethodData(writer, attrCount+attrmethods+inheritedMemberCount, xMethod); } } @@ -625,7 +638,7 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, typereg::Writer writer(TYPEREG_VERSION_1, OUString(), OUString(), RT_TYPE_TYPEDEF, xPublished->isPublished(), uTypeName.replace('.', '/'), - 0, 0, 0, 0); + 1, 0, 0, 0); writer.setSuperTypeName(0, xTD->getReferencedType() ->getName().replace('.','/')); diff --git a/unodevtools/source/unodevtools/typemanager.cxx b/unodevtools/source/unodevtools/typemanager.cxx index 5951850d4ba3..2a134bc094ef 100644 --- a/unodevtools/source/unodevtools/typemanager.cxx +++ b/unodevtools/source/unodevtools/typemanager.cxx @@ -1,70 +1,42 @@ /************************************************************************* * - * $RCSfile: typemanager.cxx,v $ - * - * $Revision: 1.2 $ - * - * last change: $Author: jsc $ $Date: 2005-08-25 15:30:34 $ - * - * The Contents of this file are made available subject to the terms of - * either of the following licenses - * - * - GNU Lesser General Public License Version 2.1 - * - Sun Industry Standards Source License Version 1.1 - * - * Sun Microsystems Inc., October, 2000 + * OpenOffice.org - a multi-platform office productivity suite * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2000 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * $RCSfile: typemanager.cxx,v $ * + * $Revision: 1.3 $ * - * Sun Industry Standards Source License Version 1.1 - * ================================================= - * The contents of this file are subject to the Sun Industry Standards - * Source License Version 1.1 (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.openoffice.org/license.html. + * last change: $Author: jsc $ $Date: 2005-09-09 13:50:40 $ * - * Software provided under this License is provided on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, - * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. - * See the License for the specific provisions governing your rights and - * obligations concerning the Software. + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. * - * The Initial Developer of the Original Code is: Sun Microsystems, Inc. * - * Copyright: 2000 by Sun Microsystems, Inc. + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA * - * All Rights Reserved. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. * - * Contributor(s): _______________________________________ + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA * ************************************************************************/ - #include "unodevtools/typemanager.hxx" #include <rtl/alloc.h> #include <registry/reader.hxx> -//#include <registry/version.h> #include <cppuhelper/bootstrap.hxx> #include <com/sun/star/container/XSet.hpp> |