1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_CODEMAKER_SOURCE_CPPUMAKER_INCLUDES_HXX
25 #define INCLUDED_CODEMAKER_SOURCE_CPPUMAKER_INCLUDES_HXX
26 
27 #include "codemaker/dependencies.hxx"
28 #include "rtl/ustring.hxx"
29 
30 class FileStream;
31 class TypeManager;
32 
33 namespace codemaker { namespace cppumaker {
34 
35 class Includes {
36 public:
37     Includes(
38         TypeManager const & manager,
39         codemaker::Dependencies const & dependencies, bool hpp);
40 
41     ~Includes();
42 
43     void add(rtl::OString const & registryType);
44 
addAny()45     void addAny() { m_includeAny = true; }
46 
addReference()47     void addReference() { m_includeReference = true; }
48 
addSequence()49     void addSequence() { m_includeSequence = true; }
50 
addType()51     void addType() { m_includeType = true; }
52 
addCppuMacrosHxx()53     void addCppuMacrosHxx() { m_includeCppuMacrosHxx = true; }
54 
addCppuUnotypeHxx()55     void addCppuUnotypeHxx() { m_includeCppuUnotypeHxx = true; }
56 
addOslDoublecheckedlockingH()57     void addOslDoublecheckedlockingH()
58     { m_includeOslDoublecheckedlockingH = true; }
59 
addOslMutexHxx()60     void addOslMutexHxx() { m_includeOslMutexHxx = true; }
61 
addRtlStrbufHxx()62     void addRtlStrbufHxx() { m_includeRtlStrbufHxx = true; }
63 
addRtlStringH()64     void addRtlStringH() { m_includeRtlStringH = true; }
65 
addRtlTextencH()66     void addRtlTextencH() { m_includeRtlTextencH = true; }
67 
addRtlUstrbufHxx()68     void addRtlUstrbufHxx() { m_includeRtlUstrbufHxx = true; }
69 
addRtlUstringH()70     void addRtlUstringH() { m_includeRtlUstringH = true; }
71 
addRtlUstringHxx()72     void addRtlUstringHxx() { m_includeRtlUstringHxx = true; }
73 
addSalTypesH()74     void addSalTypesH() { m_includeSalTypesH = true; }
75 
addTypelibTypeclassH()76     void addTypelibTypeclassH() { m_includeTypelibTypeclassH = true; }
77 
addTypelibTypedescriptionH()78     void addTypelibTypedescriptionH()
79     { m_includeTypelibTypedescriptionH = true; }
80 
81     void dump(FileStream & out, rtl::OString const * companionHdl);
82 
83     static void dumpInclude(
84         FileStream & out, rtl::OString const & registryType, bool hpp,
85         rtl::OString const & suffix = rtl::OString());
86 
87 private:
88     Includes(Includes &); // not implemented
89     void operator =(Includes); // not implemented;
90 
91     bool isInterfaceType(rtl::OString const & registryType) const;
92 
93     TypeManager const & m_manager;
94     codemaker::Dependencies::Map m_map;
95     bool m_hpp;
96     bool m_includeAny;
97     bool m_includeReference;
98     bool m_includeSequence;
99     bool m_includeType;
100     bool m_includeCppuMacrosHxx;
101     bool m_includeCppuUnotypeHxx;
102     bool m_includeOslDoublecheckedlockingH;
103     bool m_includeOslMutexHxx;
104     bool m_includeRtlStrbufHxx;
105     bool m_includeRtlStringH;
106     bool m_includeRtlTextencH;
107     bool m_includeRtlUstrbufHxx;
108     bool m_includeRtlUstringH;
109     bool m_includeRtlUstringHxx;
110     bool m_includeSalTypesH;
111     bool m_includeTypelibTypeclassH;
112     bool m_includeTypelibTypedescriptionH;
113 };
114 
115 } }
116 
117 #endif // INCLUDED_CODEMAKER_SOURCE_CPPUMAKER_INCLUDES_HXX
118