1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: skeletoncommon.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef INCLUDED_UNODEVTOOLS_SOURCE_SKELETONMAKER_SKELETONCOMMON_HXX
31 #define INCLUDED_UNODEVTOOLS_SOURCE_SKELETONMAKER_SKELETONCOMMON_HXX
33 #include "rtl/string.hxx"
34 #include "registry/reader.hxx"
35 #include "codemaker/typemanager.hxx"
36 #include "codemaker/unotype.hxx"
42 namespace skeletonmaker
{
44 typedef ::std::map
< ::rtl::OString
, ::std::vector
< ::rtl::OString
>,
45 ::std::less
< ::rtl::OString
> > ProtocolCmdMap
;
47 typedef ::std::vector
< ::std::pair
< rtl::OString
,
48 ::std::pair
< rtl::OString
, sal_Int16
> > > AttributeInfo
;
51 struct ProgramOptions
{
52 ProgramOptions(): java5(true), all(false), dump(false), license(false),
53 shortnames(false), supportpropertysetmixin(false),
54 backwardcompatible(false), language(1), componenttype(1) {}
61 bool supportpropertysetmixin
;
62 bool backwardcompatible
;
63 // language specifier - is extendable
68 // 1 = default UNO component - is extendable
72 rtl::OString outputpath
;
73 rtl::OString implname
;
74 ProtocolCmdMap protocolCmdMap
;
79 print the standard OpenOffice.org license header
81 @param o specifies the output stream
82 @param filename specifies the source file name
84 void printLicenseHeader(std::ostream
& o
, rtl::OString
const & filename
);
87 create dependent on the output path, the implementation name and the
88 extension a new output file. If output path is equal "stdout" the tool
89 generates the output to standard out.
91 @param options the program options including the output path and the
93 @param extension specifies the file extensions (e.g. .cxx or .java)
94 @param ppOutputStream out parameter returning the output stream
95 @param targetSourceFileName out parameter returning the generated file name
96 constructed on base of the output path, the
97 implementation name and the extension
98 @param tmpSourceFileName out parameter returning the temporary file name based
99 on the output path and a generated temporary file name.
100 @return true if output is generated to standard out or else false
102 bool getOutputStream(ProgramOptions
const & options
,
103 rtl::OString
const & extension
,
104 std::ostream
** ppOutputStream
,
105 rtl::OString
& targetSourceFileName
,
106 rtl::OString
& tmpSourceFileName
);
108 codemaker::UnoType::Sort
decomposeResolveAndCheck(
109 TypeManager
const & manager
, rtl::OString
const & type
,
110 bool resolveTypedefs
, bool allowVoid
, bool allowExtraEntities
,
111 RTTypeClass
* typeClass
, rtl::OString
* name
, sal_Int32
* rank
,
112 std::vector
< rtl::OString
> * arguments
);
114 void checkType(TypeManager
const & manager
,
115 rtl::OString
const & type
,
116 std::hash_set
< rtl::OString
, rtl::OStringHash
>& interfaceTypes
,
117 std::hash_set
< rtl::OString
, rtl::OStringHash
>& serviceTypes
,
118 AttributeInfo
& properties
);
120 void checkDefaultInterfaces(
121 std::hash_set
< rtl::OString
, rtl::OStringHash
>& interfaces
,
122 const std::hash_set
< rtl::OString
, rtl::OStringHash
>& services
,
123 const rtl::OString
& propertyhelper
);
125 rtl::OString
checkPropertyHelper(
126 ProgramOptions
const & options
, TypeManager
const & manager
,
127 const std::hash_set
< rtl::OString
, rtl::OStringHash
>& services
,
128 const std::hash_set
< rtl::OString
, rtl::OStringHash
>& interfaces
,
129 AttributeInfo
& attributes
,
130 std::hash_set
< rtl::OString
, rtl::OStringHash
>& propinterfaces
);
133 checks whether the return and parameters types are valid and allowed
134 calc add-in type. The function throws a CannotDumpException with an
135 detailed error description which type is wrong
137 @param manager a type manager
138 @param reader a registry type reader of an interface defining
139 calc add-in functions
141 void checkAddInTypes(TypeManager
const & manager
,
142 typereg::Reader
const & reader
);
146 checks if XComponent have to be supported, if yes it removes it from the
147 supported interfaces list becuase it becmoes implmented by the appropriate
150 @param manager a type manager
151 @param interfaces a list of interfaces which should be implemented
153 @return true if XComponent have to be supported
155 bool checkXComponentSupport(TypeManager
const & manager
,
156 std::hash_set
< rtl::OString
, rtl::OStringHash
>& interfaces
);
159 sal_uInt16
checkAdditionalPropertyFlags(typereg::Reader
const & reader
,
160 sal_uInt16 field
, sal_uInt16 method
);
163 void generateFunctionParameterMap(std::ostream
& o
,
164 ProgramOptions
const & options
,
165 TypeManager
const & manager
,
166 const std::hash_set
< ::rtl::OString
, ::rtl::OStringHash
>& interfaces
);
170 #endif // INCLUDED_UNODEVTOOLS_SOURCE_SKELETONMAKER_SKELETONCOMMON_HXX