Bump for 3.6-28
[LibreOffice.git] / unodevtools / source / skeletonmaker / skeletoncommon.hxx
blob593b28504ae90ef73399f8319343ddb06acc79c1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
28 #ifndef INCLUDED_UNODEVTOOLS_SOURCE_SKELETONMAKER_SKELETONCOMMON_HXX
29 #define INCLUDED_UNODEVTOOLS_SOURCE_SKELETONMAKER_SKELETONCOMMON_HXX
31 #include "rtl/string.hxx"
32 #include "registry/reader.hxx"
33 #include "codemaker/typemanager.hxx"
34 #include "codemaker/unotype.hxx"
36 #include <fstream>
37 #include <boost/unordered_set.hpp>
38 #include <map>
40 namespace skeletonmaker {
42 typedef ::std::map< ::rtl::OString, ::std::vector< ::rtl::OString >,
43 ::std::less< ::rtl::OString > > ProtocolCmdMap;
45 typedef ::std::vector< ::std::pair< rtl::OString,
46 ::std::pair< rtl::OString, sal_Int16 > > > AttributeInfo;
49 struct ProgramOptions {
50 ProgramOptions(): java5(true), all(false), dump(false), license(false),
51 shortnames(false), supportpropertysetmixin(false),
52 backwardcompatible(false), language(1), componenttype(1) {}
54 bool java5;
55 bool all;
56 bool dump;
57 bool license;
58 bool shortnames;
59 bool supportpropertysetmixin;
60 bool backwardcompatible;
61 // language specifier - is extendable
62 // 1 = Java
63 // 2 = C++
64 short language;
65 // component type
66 // 1 = default UNO component - is extendable
67 // 2 = calc add-in
68 // 3 = add-on
69 short componenttype;
70 rtl::OString outputpath;
71 rtl::OString implname;
72 ProtocolCmdMap protocolCmdMap;
76 /**
77 print the standard OpenOffice.org license header
79 @param o specifies the output stream
80 @param filename specifies the source file name
82 void printLicenseHeader(std::ostream& o, rtl::OString const & filename);
84 /**
85 create dependent on the output path, the implementation name and the
86 extension a new output file. If output path is equal "stdout" the tool
87 generates the output to standard out.
89 @param options the program options including the output path and the
90 implementation name
91 @param extension specifies the file extensions (e.g. .cxx or .java)
92 @param ppOutputStream out parameter returning the output stream
93 @param targetSourceFileName out parameter returning the generated file name
94 constructed on base of the output path, the
95 implementation name and the extension
96 @param tmpSourceFileName out parameter returning the temporary file name based
97 on the output path and a generated temporary file name.
98 @return true if output is generated to standard out or else false
100 bool getOutputStream(ProgramOptions const & options,
101 rtl::OString const & extension,
102 std::ostream** ppOutputStream,
103 rtl::OString & targetSourceFileName,
104 rtl::OString & tmpSourceFileName);
106 codemaker::UnoType::Sort decomposeResolveAndCheck(
107 TypeManager const & manager, rtl::OString const & type,
108 bool resolveTypedefs, bool allowVoid, bool allowExtraEntities,
109 RTTypeClass * typeClass, rtl::OString * name, sal_Int32 * rank,
110 std::vector< rtl::OString > * arguments);
112 void checkType(TypeManager const & manager,
113 rtl::OString const & type,
114 boost::unordered_set< rtl::OString, rtl::OStringHash >& interfaceTypes,
115 boost::unordered_set< rtl::OString, rtl::OStringHash >& serviceTypes,
116 AttributeInfo& properties);
118 void checkDefaultInterfaces(
119 boost::unordered_set< rtl::OString, rtl::OStringHash >& interfaces,
120 const boost::unordered_set< rtl::OString, rtl::OStringHash >& services,
121 const rtl::OString & propertyhelper);
123 rtl::OString checkPropertyHelper(
124 ProgramOptions const & options, TypeManager const & manager,
125 const boost::unordered_set< rtl::OString, rtl::OStringHash >& services,
126 const boost::unordered_set< rtl::OString, rtl::OStringHash >& interfaces,
127 AttributeInfo& attributes,
128 boost::unordered_set< rtl::OString, rtl::OStringHash >& propinterfaces);
131 checks whether the return and parameters types are valid and allowed
132 calc add-in type. The function throws a CannotDumpException with an
133 detailed error description which type is wrong
135 @param manager a type manager
136 @param reader a registry type reader of an interface defining
137 calc add-in functions
139 void checkAddInTypes(TypeManager const & manager,
140 typereg::Reader const & reader);
144 checks if XComponent have to be supported, if yes it removes it from the
145 supported interfaces list becuase it becmoes implmented by the appropriate
146 helper
148 @param manager a type manager
149 @param interfaces a list of interfaces which should be implemented
151 @return true if XComponent have to be supported
153 bool checkXComponentSupport(TypeManager const & manager,
154 boost::unordered_set< rtl::OString, rtl::OStringHash >& interfaces);
157 sal_uInt16 checkAdditionalPropertyFlags(typereg::Reader const & reader,
158 sal_uInt16 field, sal_uInt16 method);
161 void generateFunctionParameterMap(std::ostream& o,
162 ProgramOptions const & options,
163 TypeManager const & manager,
164 const boost::unordered_set< ::rtl::OString, ::rtl::OStringHash >& interfaces);
168 #endif // INCLUDED_UNODEVTOOLS_SOURCE_SKELETONMAKER_SKELETONCOMMON_HXX
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */