Branch libreoffice-24-8-3
[LibreOffice.git] / codemaker / source / cppumaker / dependencies.hxx
blob0071397aa0efc5b7fca550ce85372ae45135c5e3
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 #pragma once
22 #include <sal/config.h>
24 #include <map>
25 #include <string_view>
27 #include <rtl/ref.hxx>
29 namespace rtl { class OUString; }
30 class TypeManager;
32 /// @HTML
34 namespace codemaker::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< 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 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 hasUnsignedLongDependency() const
86 { return m_unsignedLongDependency; }
88 bool hasHyperDependency() const { return m_hyperDependency; }
90 bool hasUnsignedHyperDependency() const
91 { return m_unsignedHyperDependency; }
93 bool hasCharDependency() const { return m_charDependency; }
95 bool hasStringDependency() const { return m_stringDependency; }
97 bool hasTypeDependency() const { return m_typeDependency; }
99 bool hasAnyDependency() const { return m_anyDependency; }
101 bool hasSequenceDependency() const { return m_sequenceDependency; }
103 private:
104 void insert(std::u16string_view name, Kind kind);
106 rtl::Reference< TypeManager > m_manager;
107 Map m_map;
108 bool m_voidDependency;
109 bool m_booleanDependency;
110 bool m_byteDependency;
111 bool m_shortDependency;
112 bool m_unsignedShortDependency;
113 bool m_longDependency;
114 bool m_unsignedLongDependency;
115 bool m_hyperDependency;
116 bool m_unsignedHyperDependency;
117 bool m_charDependency;
118 bool m_stringDependency;
119 bool m_typeDependency;
120 bool m_anyDependency;
121 bool m_sequenceDependency;
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */