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(): all(false), dump(false), license(false),
44 : shortnames(false), supportpropertysetmixin(false),
45 0 : backwardcompatible(false), language(1), componenttype(1) {}
46 :
47 : bool all;
48 : bool dump;
49 : bool license;
50 : bool shortnames;
51 : bool supportpropertysetmixin;
52 : bool backwardcompatible;
53 : // language specifier - is extendable
54 : // 1 = Java
55 : // 2 = C++
56 : short language;
57 : // component type
58 : // 1 = default UNO component - is extendable
59 : // 2 = calc add-in
60 : // 3 = add-on
61 : short componenttype;
62 : OString outputpath;
63 : OString implname;
64 : ProtocolCmdMap protocolCmdMap;
65 : };
66 :
67 :
68 : /**
69 : print the standard OpenOffice.org license header
70 :
71 : @param o specifies the output stream
72 : @param filename specifies the source file name
73 : */
74 : void printLicenseHeader(std::ostream& o, OString const & filename);
75 :
76 : /**
77 : create dependent on the output path, the implementation name and the
78 : extension a new output file. If output path is equal "stdout" the tool
79 : generates the output to standard out.
80 :
81 : @param options the program options including the output path and the
82 : implementation name
83 : @param extension specifies the file extensions (e.g. .cxx or .java)
84 : @param ppOutputStream out parameter returning the output stream
85 : @param targetSourceFileName out parameter returning the generated file name
86 : constructed on base of the output path, the
87 : implementation name and the extension
88 : @param tmpSourceFileName out parameter returning the temporary file name based
89 : on the output path and a generated temporary file name.
90 : @return true if output is generated to standard out or else false
91 : */
92 : bool getOutputStream(ProgramOptions const & options,
93 : OString const & extension,
94 : std::ostream** ppOutputStream,
95 : OString & targetSourceFileName,
96 : OString & tmpSourceFileName);
97 :
98 : void checkType(rtl::Reference< TypeManager > const & manager,
99 : OUString const & type,
100 : std::set< OUString >& interfaceTypes,
101 : std::set< OUString >& serviceTypes,
102 : AttributeInfo& properties);
103 :
104 : void checkDefaultInterfaces(
105 : std::set< OUString >& interfaces,
106 : const std::set< OUString >& services,
107 : const OUString & propertyhelper);
108 :
109 : OUString checkPropertyHelper(
110 : ProgramOptions const & options, rtl::Reference< TypeManager > const & manager,
111 : const std::set< OUString >& services,
112 : const std::set< OUString >& interfaces,
113 : AttributeInfo& attributes,
114 : std::set< OUString >& propinterfaces);
115 :
116 : /**
117 : checks if XComponent have to be supported, if yes it removes it from the
118 : supported interfaces list because it becomes implemented by the appropriate
119 : helper
120 :
121 : @param manager a type manager
122 : @param interfaces a list of interfaces which should be implemented
123 :
124 : @return true if XComponent have to be supported
125 : */
126 : bool checkXComponentSupport(rtl::Reference< TypeManager > const & manager,
127 : std::set< OUString >& interfaces);
128 :
129 :
130 : unoidl::AccumulationBasedServiceEntity::Property::Attributes
131 : checkAdditionalPropertyFlags(
132 : unoidl::InterfaceTypeEntity::Attribute const & attribute);
133 :
134 : void generateFunctionParameterMap(std::ostream& o,
135 : ProgramOptions const & options,
136 : rtl::Reference< TypeManager > const & manager,
137 : const std::set< OUString >& interfaces);
138 :
139 : }
140 :
141 : #endif // INCLUDED_UNODEVTOOLS_SOURCE_SKELETONMAKER_SKELETONCOMMON_HXX
142 :
143 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|