1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
27 #include "boost/noncopyable.hpp"
28 #include "rtl/ref.hxx"
30 namespace rtl
{ class OUString
; }
35 namespace codemaker
{ namespace cppumaker
{
38 A simple class to track which other entites a given entity depends on.
40 <p>This class is not multi-thread–safe.</p>
42 class Dependencies
: private boost::noncopyable
{
45 Flags to distinguish whether or not one entity depends on another entity
46 because the second is a direct base of the first.
48 enum Kind
{ KIND_NO_BASE
, KIND_BASE
};
50 typedef std::map
< rtl::OUString
, Kind
> Map
;
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
64 rtl::Reference
< TypeManager
> const & manager
,
65 rtl::OUString
const & name
);
70 Add a special dependency (which is not obvious from the entity's data
71 available at the type manager).
73 @param name a UNOIDL entity name
75 void add(rtl::OUString
const & name
) { insert(name
); }
77 Map
const & getMap() const { return m_map
; }
79 bool hasVoidDependency() const { return m_voidDependency
; }
81 bool hasBooleanDependency() const { return m_booleanDependency
; }
83 bool hasByteDependency() const { return m_byteDependency
; }
85 bool hasShortDependency() const { return m_shortDependency
; }
87 bool hasUnsignedShortDependency() const
88 { return m_unsignedShortDependency
; }
90 bool hasLongDependency() const { return m_longDependency
; }
92 bool hasUnsignedLongDependency() const { return m_unsignedLongDependency
; }
94 bool hasHyperDependency() const { return m_hyperDependency
; }
96 bool hasUnsignedHyperDependency() const
97 { return m_unsignedHyperDependency
; }
99 bool hasFloatDependency() const { return m_floatDependency
; }
101 bool hasDoubleDependency() const { return m_doubleDependency
; }
103 bool hasCharDependency() const { return m_charDependency
; }
105 bool hasStringDependency() const { return m_stringDependency
; }
107 bool hasTypeDependency() const { return m_typeDependency
; }
109 bool hasAnyDependency() const { return m_anyDependency
; }
111 bool hasSequenceDependency() const { return m_sequenceDependency
; }
114 void insert(rtl::OUString
const & name
, bool base
= false);
116 rtl::Reference
< TypeManager
> m_manager
;
118 bool m_voidDependency
;
119 bool m_booleanDependency
;
120 bool m_byteDependency
;
121 bool m_shortDependency
;
122 bool m_unsignedShortDependency
;
123 bool m_longDependency
;
124 bool m_unsignedLongDependency
;
125 bool m_hyperDependency
;
126 bool m_unsignedHyperDependency
;
127 bool m_floatDependency
;
128 bool m_doubleDependency
;
129 bool m_charDependency
;
130 bool m_stringDependency
;
131 bool m_typeDependency
;
132 bool m_anyDependency
;
133 bool m_sequenceDependency
;
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */