Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / codemaker / source / cppumaker / dependencies.hxx
blob718dac392c877a4fae7d0824b51c528ebebfe68a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_CODEMAKER_SOURCE_CPPUMAKER_DEPENDENCIES_HXX
21 #define INCLUDED_CODEMAKER_SOURCE_CPPUMAKER_DEPENDENCIES_HXX
23 #include <sal/config.h>
25 #include <map>
27 #include <rtl/ref.hxx>
29 namespace rtl { class OUString; }
30 class TypeManager;
32 /// @HTML
34 namespace codemaker { namespace cppumaker {
36 /**
37 A simple class to track which other entities a given entity depends on.
39 <p>This class is not multi-thread&ndash;safe.</p>
41 class Dependencies {
42 public:
43 /**
44 Flags to distinguish whether one entity depends on another entity because
45 the second is a direct base of the first or an exception thrown by the
46 first.
48 enum Kind { KIND_NORMAL, KIND_BASE, KIND_EXCEPTION };
50 typedef std::map< rtl::OUString, Kind > Map;
52 /**
53 Constructs the dependencies for a given entity.
55 @param manager a type manager, to obtain information about the given
56 entity; must not be null
58 @param name the UNOIDL name of an enum type, plain struct type,
59 polymorphic struct type template, exception type, interface type,
60 typedef, constant group, single-interface--based service, or
61 interface-based singleton entity
63 Dependencies(
64 rtl::Reference< TypeManager > const & manager,
65 rtl::OUString const & name);
67 ~Dependencies();
69 Dependencies(const Dependencies&) = delete;
70 const Dependencies& operator=(const Dependencies&) = delete;
72 Map const & getMap() const { return m_map; }
74 bool hasBooleanDependency() const { return m_booleanDependency; }
76 bool hasByteDependency() const { return m_byteDependency; }
78 bool hasShortDependency() const { return m_shortDependency; }
80 bool hasUnsignedShortDependency() const
81 { return m_unsignedShortDependency; }
83 bool hasLongDependency() const { return m_longDependency; }
85 bool hasHyperDependency() const { return m_hyperDependency; }
87 bool hasUnsignedHyperDependency() const
88 { return m_unsignedHyperDependency; }
90 bool hasCharDependency() const { return m_charDependency; }
92 bool hasStringDependency() const { return m_stringDependency; }
94 bool hasTypeDependency() const { return m_typeDependency; }
96 bool hasAnyDependency() const { return m_anyDependency; }
98 bool hasSequenceDependency() const { return m_sequenceDependency; }
100 private:
101 void insert(rtl::OUString const & name, Kind kind);
103 rtl::Reference< TypeManager > m_manager;
104 Map m_map;
105 bool m_voidDependency;
106 bool m_booleanDependency;
107 bool m_byteDependency;
108 bool m_shortDependency;
109 bool m_unsignedShortDependency;
110 bool m_longDependency;
111 bool m_unsignedLongDependency;
112 bool m_hyperDependency;
113 bool m_unsignedHyperDependency;
114 bool m_floatDependency;
115 bool m_doubleDependency;
116 bool m_charDependency;
117 bool m_stringDependency;
118 bool m_typeDependency;
119 bool m_anyDependency;
120 bool m_sequenceDependency;
125 #endif
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */