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 .
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
{
33 sal_uInt32 flags
, AstType
const * type
, OString
const & name
,
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
)
44 virtual ~AstAttribute() override
{}
47 OUString
const * getDoc
, DeclList
const * getExc
,
48 OUString
const * setDoc
, DeclList
const * setExc
)
50 if (getDoc
!= nullptr) {
51 m_getDocumentation
= *getDoc
;
53 if (getExc
!= nullptr) {
54 m_getExceptions
= *getExc
;
56 if (setDoc
!= nullptr) {
57 m_setDocumentation
= *setDoc
;
59 if (setExc
!= nullptr) {
60 m_setExceptions
= *setExc
;
64 DeclList::size_type
getGetExceptionCount() const
65 { return m_getExceptions
.size(); }
67 DeclList::size_type
getSetExceptionCount() const
68 { return m_setExceptions
.size(); }
70 bool isReadonly() const
71 { return ((m_flags
& AF_READONLY
) == AF_READONLY
); }
72 bool isOptional() const
73 { return ((m_flags
& AF_OPTIONAL
) == AF_OPTIONAL
); }
75 { return ((m_flags
& AF_BOUND
) == AF_BOUND
); }
76 bool isMayBeVoid() const
77 { return ((m_flags
& AF_MAYBEVOID
) == AF_MAYBEVOID
); }
78 bool isConstrained() const
79 { return ((m_flags
& AF_CONSTRAINED
) == AF_CONSTRAINED
); }
80 bool isTransient() const
81 { return ((m_flags
& AF_TRANSIENT
) == AF_TRANSIENT
); }
82 bool isMayBeAmbiguous() const
83 { return ((m_flags
& AF_MAYBEAMBIGUOUS
) == AF_MAYBEAMBIGUOUS
); }
84 bool isMayBeDefault() const
85 { return ((m_flags
& AF_MAYBEDEFAULT
) == AF_MAYBEDEFAULT
); }
86 bool isRemoveable() const
87 { return ((m_flags
& AF_REMOVABLE
) == AF_REMOVABLE
); }
90 typereg::Writer
& rBlob
, sal_uInt16 index
, sal_uInt16
* methodIndex
);
94 typereg::Writer
& writer
, OUString
const & documentation
,
95 DeclList
const & exceptions
, RTMethodMode flags
,
96 sal_uInt16
* methodIndex
);
98 const sal_uInt32 m_flags
;
99 AstType
const * m_pType
;
100 OUString m_getDocumentation
;
101 DeclList m_getExceptions
;
102 OUString m_setDocumentation
;
103 DeclList m_setExceptions
;
106 #endif // INCLUDED_IDLC_INC_ASTATTRIBUTE_HXX
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */