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
)
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
); }
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
); }
89 typereg::Writer
& rBlob
, sal_uInt16 index
, sal_uInt16
* methodIndex
) const;
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: */