bump product version to 6.3.0.0.beta1
[LibreOffice.git] / idlc / inc / astinterface.hxx
blobb83c796572525546012c509b245548a1dada6eba
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 typedef std::vector< AstInterface const * > DoubleInterfaceDeclarations;
37 struct DoubleMemberDeclaration {
38 AstDeclaration const * first;
39 AstDeclaration const * second;
42 typedef std::vector< DoubleMemberDeclaration > DoubleMemberDeclarations;
44 struct DoubleDeclarations {
45 DoubleInterfaceDeclarations interfaces;
46 DoubleMemberDeclarations members;
49 AstInterface(
50 const OString& name, AstInterface const * pInherits,
51 AstScope* pScope);
52 virtual ~AstInterface() override;
54 InheritedInterfaces const & getAllInheritedInterfaces() const
55 { return m_inheritedInterfaces; }
57 bool hasMandatoryInheritedInterfaces() const
58 { return m_mandatoryInterfaces > 0; }
60 void setDefined() { m_bIsDefined = true; }
61 bool isDefined() const
62 { return m_bIsDefined; }
64 bool usesSingleInheritance() const { return m_bSingleInheritance; }
66 DoubleDeclarations checkInheritedInterfaceClashes(
67 AstInterface const * ifc, bool optional) const;
69 void addInheritedInterface(
70 AstType const * ifc, bool optional,
71 OUString const & documentation);
73 DoubleMemberDeclarations checkMemberClashes(
74 AstDeclaration const * member) const;
76 void addMember(AstDeclaration /*TODO: const*/ * member);
78 void forwardDefined(AstInterface const & def);
80 virtual bool dump(RegistryKey& rKey) override;
82 private:
83 enum InterfaceKind {
84 INTERFACE_INDIRECT_OPTIONAL, INTERFACE_DIRECT_OPTIONAL,
85 INTERFACE_INDIRECT_MANDATORY, INTERFACE_DIRECT_MANDATORY };
87 struct VisibleMember {
88 explicit VisibleMember(AstDeclaration const * theMandatory = nullptr):
89 mandatory(theMandatory) {}
91 typedef std::map< OString, AstDeclaration const * > Optionals;
93 AstDeclaration const * mandatory;
94 Optionals optionals;
97 typedef std::map< OString, InterfaceKind > VisibleInterfaces;
98 typedef std::map< OString, VisibleMember > VisibleMembers;
100 void checkInheritedInterfaceClashes(
101 DoubleDeclarations & doubleDeclarations,
102 std::set< OString > & seenInterfaces, AstInterface const * ifc,
103 bool direct, bool optional, bool mainOptional) const;
105 void checkMemberClashes(
106 DoubleMemberDeclarations & doubleMembers, AstDeclaration const * member,
107 bool checkOptional) const;
109 void addVisibleInterface(
110 AstInterface const * ifc, bool direct, bool optional);
112 void addOptionalVisibleMembers(AstInterface const * ifc);
114 bool increment(sal_uInt16 * counter, char const * sort) const;
116 InheritedInterfaces m_inheritedInterfaces;
117 InheritedInterfaces::size_type m_mandatoryInterfaces;
118 bool m_bIsDefined;
119 bool m_bSingleInheritance;
120 VisibleInterfaces m_visibleInterfaces;
121 VisibleMembers m_visibleMembers;
124 #endif // INCLUDED_IDLC_INC_ASTINTERFACE_HXX
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */