Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / idlc / inc / astattribute.hxx
blob7ce370a7fa940b7c8e3cb556a33a66493058250a
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_ASTATTRIBUTE_HXX
20 #define INCLUDED_IDLC_INC_ASTATTRIBUTE_HXX
22 #include "astdeclaration.hxx"
23 #include "astscope.hxx"
25 #include <registry/types.hxx>
26 #include <rtl/ustring.hxx>
28 namespace typereg { class Writer; }
30 class AstAttribute: public AstDeclaration, public AstScope {
31 public:
32 AstAttribute(
33 sal_uInt32 flags, AstType const * type, OString const & name,
34 AstScope * scope):
35 AstDeclaration(NT_attribute, name, scope),
36 AstScope(NT_attribute), m_flags(flags), m_pType(type)
39 AstAttribute(NodeType nodeType, sal_uInt32 flags, AstType const * pType, const OString& name, AstScope* pScope)
40 : AstDeclaration(nodeType, name, pScope), AstScope(nodeType)
41 , m_flags(flags)
42 , m_pType(pType)
45 void setExceptions(
46 OUString const * getDoc, DeclList const * getExc,
47 OUString const * setDoc, DeclList const * setExc)
49 if (getDoc != nullptr) {
50 m_getDocumentation = *getDoc;
52 if (getExc != nullptr) {
53 m_getExceptions = *getExc;
55 if (setDoc != nullptr) {
56 m_setDocumentation = *setDoc;
58 if (setExc != nullptr) {
59 m_setExceptions = *setExc;
63 DeclList::size_type getGetExceptionCount() const
64 { return m_getExceptions.size(); }
66 DeclList::size_type getSetExceptionCount() const
67 { return m_setExceptions.size(); }
69 bool isReadonly() const
70 { return ((m_flags & AF_READONLY) == AF_READONLY); }
71 bool isOptional() const
72 { return ((m_flags & AF_OPTIONAL) == AF_OPTIONAL); }
73 bool isBound() const
74 { return ((m_flags & AF_BOUND) == AF_BOUND); }
75 bool isMayBeVoid() const
76 { return ((m_flags & AF_MAYBEVOID) == AF_MAYBEVOID); }
77 bool isConstrained() const
78 { return ((m_flags & AF_CONSTRAINED) == AF_CONSTRAINED); }
79 bool isTransient() const
80 { return ((m_flags & AF_TRANSIENT) == AF_TRANSIENT); }
81 bool isMayBeAmbiguous() const
82 { return ((m_flags & AF_MAYBEAMBIGUOUS) == AF_MAYBEAMBIGUOUS); }
83 bool isMayBeDefault() const
84 { return ((m_flags & AF_MAYBEDEFAULT) == AF_MAYBEDEFAULT); }
85 bool isRemoveable() const
86 { return ((m_flags & AF_REMOVABLE) == AF_REMOVABLE); }
88 void dumpBlob(
89 typereg::Writer & rBlob, sal_uInt16 index, sal_uInt16 * methodIndex) const;
91 private:
92 void dumpExceptions(
93 typereg::Writer & writer, OUString const & documentation,
94 DeclList const & exceptions, RTMethodMode flags,
95 sal_uInt16 * methodIndex) const;
97 const sal_uInt32 m_flags;
98 AstType const * m_pType;
99 OUString m_getDocumentation;
100 DeclList m_getExceptions;
101 OUString m_setDocumentation;
102 DeclList m_setExceptions;
105 #endif // INCLUDED_IDLC_INC_ASTATTRIBUTE_HXX
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */