Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_UNODEVTOOLS_SOURCE_SKELETONMAKER_SKELETONCOMMON_HXX
20 : #define INCLUDED_UNODEVTOOLS_SOURCE_SKELETONMAKER_SKELETONCOMMON_HXX
21 :
22 : #include "sal/config.h"
23 :
24 : #include "rtl/ref.hxx"
25 : #include "rtl/string.hxx"
26 : #include "codemaker/typemanager.hxx"
27 : #include "codemaker/unotype.hxx"
28 : #include "unoidl/unoidl.hxx"
29 :
30 : #include <fstream>
31 : #include <map>
32 : #include <set>
33 :
34 : namespace skeletonmaker {
35 :
36 : typedef ::std::map< OString, ::std::vector< OString >,
37 : ::std::less< OString > > ProtocolCmdMap;
38 :
39 : typedef ::std::vector< unoidl::AccumulationBasedServiceEntity::Property >
40 : AttributeInfo;
41 :
42 0 : struct ProgramOptions {
43 0 : ProgramOptions(): java5(true), all(false), dump(false), license(false),
44 : shortnames(false), supportpropertysetmixin(false),
45 0 : backwardcompatible(false), language(1), componenttype(1) {}
46 :
47 : bool java5;
48 : bool all;
49 : bool dump;
50 : bool license;
51 : bool shortnames;
52 : bool supportpropertysetmixin;
53 : bool backwardcompatible;
54 : // language specifier - is extendable
55 : // 1 = Java
56 : // 2 = C++
57 : short language;
58 : // component type
59 : // 1 = default UNO component - is extendable
60 : // 2 = calc add-in
61 : // 3 = add-on
62 : short componenttype;
63 : OString outputpath;
64 : OString implname;
65 : ProtocolCmdMap protocolCmdMap;
66 : };
67 :
68 :
69 : /**
70 : print the standard OpenOffice.org license header
71 :
72 : @param o specifies the output stream
73 : @param filename specifies the source file name
74 : */
75 : void printLicenseHeader(std::ostream& o, OString const & filename);
76 :
77 : /**
78 : create dependent on the output path, the implementation name and the
79 : extension a new output file. If output path is equal "stdout" the tool
80 : generates the output to standard out.
81 :
82 : @param options the program options including the output path and the
83 : implementation name
84 : @param extension specifies the file extensions (e.g. .cxx or .java)
85 : @param ppOutputStream out parameter returning the output stream
86 : @param targetSourceFileName out parameter returning the generated file name
87 : constructed on base of the output path, the
88 : implementation name and the extension
89 : @param tmpSourceFileName out parameter returning the temporary file name based
90 : on the output path and a generated temporary file name.
91 : @return true if output is generated to standard out or else false
92 : */
93 : bool getOutputStream(ProgramOptions const & options,
94 : OString const & extension,
95 : std::ostream** ppOutputStream,
96 : OString & targetSourceFileName,
97 : OString & tmpSourceFileName);
98 :
99 : void checkType(rtl::Reference< TypeManager > const & manager,
100 : OUString const & type,
101 : std::set< OUString >& interfaceTypes,
102 : std::set< OUString >& serviceTypes,
103 : AttributeInfo& properties);
104 :
105 : void checkDefaultInterfaces(
106 : std::set< OUString >& interfaces,
107 : const std::set< OUString >& services,
108 : const OUString & propertyhelper);
109 :
110 : OUString checkPropertyHelper(
111 : ProgramOptions const & options, rtl::Reference< TypeManager > const & manager,
112 : const std::set< OUString >& services,
113 : const std::set< OUString >& interfaces,
114 : AttributeInfo& attributes,
115 : std::set< OUString >& propinterfaces);
116 :
117 : /**
118 : checks if XComponent have to be supported, if yes it removes it from the
119 : supported interfaces list because it becomes implemented by the appropriate
120 : helper
121 :
122 : @param manager a type manager
123 : @param interfaces a list of interfaces which should be implemented
124 :
125 : @return true if XComponent have to be supported
126 : */
127 : bool checkXComponentSupport(rtl::Reference< TypeManager > const & manager,
128 : std::set< OUString >& interfaces);
129 :
130 :
131 : unoidl::AccumulationBasedServiceEntity::Property::Attributes
132 : checkAdditionalPropertyFlags(
133 : unoidl::InterfaceTypeEntity::Attribute const & attribute);
134 :
135 : void generateFunctionParameterMap(std::ostream& o,
136 : ProgramOptions const & options,
137 : rtl::Reference< TypeManager > const & manager,
138 : const std::set< OUString >& interfaces);
139 :
140 : }
141 :
142 : #endif // INCLUDED_UNODEVTOOLS_SOURCE_SKELETONMAKER_SKELETONCOMMON_HXX
143 :
144 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|