bump product version to 7.2.5.1
[LibreOffice.git] / idlc / inc / astinterface.hxx
blob03c5f22f5f376db827d5fa884fcd01920f796ffb
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 .
19 #ifndef INCLUDED_IDLC_INC_ASTINTERFACE_HXX
20 #define INCLUDED_IDLC_INC_ASTINTERFACE_HXX
22 #include "asttype.hxx"
23 #include "astscope.hxx"
24 #include "inheritedinterface.hxx"
26 #include <map>
27 #include <vector>
29 class AstInterface : public AstType
30 , public AstScope
32 public:
33 typedef std::vector< InheritedInterface > InheritedInterfaces;
35 struct DoubleMemberDeclaration {
36 AstDeclaration const * first;
37 AstDeclaration const * second;
40 typedef std::vector< DoubleMemberDeclaration > DoubleMemberDeclarations;
42 struct DoubleDeclarations {
43 std::vector< AstInterface const * > interfaces;
44 DoubleMemberDeclarations members;
47 AstInterface(
48 const OString& name, AstInterface const * pInherits,
49 AstScope* pScope);
50 virtual ~AstInterface() override;
52 AstInterface(AstInterface const &) = default;
53 AstInterface(AstInterface &&) = default;
54 AstInterface & operator =(AstInterface const &) = default;
55 AstInterface & operator =(AstInterface &&) = default;
57 InheritedInterfaces const & getAllInheritedInterfaces() const
58 { return m_inheritedInterfaces; }
60 bool hasMandatoryInheritedInterfaces() const
61 { return m_mandatoryInterfaces > 0; }
63 void setDefined() { m_bIsDefined = true; }
64 bool isDefined() const
65 { return m_bIsDefined; }
67 bool usesSingleInheritance() const { return m_bSingleInheritance; }
69 DoubleDeclarations checkInheritedInterfaceClashes(
70 AstInterface const * ifc, bool optional) const;
72 void addInheritedInterface(
73 AstType const * ifc, bool optional,
74 OUString const & documentation);
76 DoubleMemberDeclarations checkMemberClashes(
77 AstDeclaration const * member) const;
79 void addMember(AstDeclaration /*TODO: const*/ * member);
81 void forwardDefined(AstInterface const & def);
83 virtual bool dump(RegistryKey& rKey) override;
85 private:
86 enum InterfaceKind {
87 INTERFACE_INDIRECT_OPTIONAL, INTERFACE_DIRECT_OPTIONAL,
88 INTERFACE_INDIRECT_MANDATORY, INTERFACE_DIRECT_MANDATORY };
90 struct VisibleMember {
91 explicit VisibleMember(AstDeclaration const * theMandatory = nullptr):
92 mandatory(theMandatory) {}
94 typedef std::map< OString, AstDeclaration const * > Optionals;
96 AstDeclaration const * mandatory;
97 Optionals optionals;
100 typedef std::map< OString, InterfaceKind > VisibleInterfaces;
101 typedef std::map< OString, VisibleMember > VisibleMembers;
103 void checkInheritedInterfaceClashes(
104 DoubleDeclarations & doubleDeclarations,
105 std::set< OString > & seenInterfaces, AstInterface const * ifc,
106 bool direct, bool optional, bool mainOptional) const;
108 void checkMemberClashes(
109 DoubleMemberDeclarations & doubleMembers, AstDeclaration const * member,
110 bool checkOptional) const;
112 void addVisibleInterface(
113 AstInterface const * ifc, bool direct, bool optional);
115 void addOptionalVisibleMembers(AstInterface const * ifc);
117 bool increment(sal_uInt16 * counter, char const * sort) const;
119 InheritedInterfaces m_inheritedInterfaces;
120 InheritedInterfaces::size_type m_mandatoryInterfaces;
121 bool m_bIsDefined;
122 bool m_bSingleInheritance;
123 VisibleInterfaces m_visibleInterfaces;
124 VisibleMembers m_visibleMembers;
127 #endif // INCLUDED_IDLC_INC_ASTINTERFACE_HXX
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */