Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef _IDLC_ASTATTRIBUTE_HXX_
20 : #define _IDLC_ASTATTRIBUTE_HXX_
21 :
22 : #include <idlc/astdeclaration.hxx>
23 : #include "idlc/astscope.hxx"
24 :
25 : #include "registry/types.h"
26 : #include "rtl/ustring.hxx"
27 :
28 : namespace typereg { class Writer; }
29 :
30 : class AstAttribute: public AstDeclaration, public AstScope {
31 : public:
32 0 : AstAttribute(
33 : sal_uInt32 flags, AstType const * type, rtl::OString const & name,
34 : AstScope * scope):
35 : AstDeclaration(NT_attribute, name, scope),
36 0 : AstScope(NT_attribute), m_flags(flags), m_pType(type)
37 0 : {}
38 :
39 0 : AstAttribute(NodeType nodeType, sal_uInt32 flags, AstType const * pType, const ::rtl::OString& name, AstScope* pScope)
40 : : AstDeclaration(nodeType, name, pScope), AstScope(nodeType)
41 : , m_flags(flags)
42 0 : , m_pType(pType)
43 0 : {}
44 0 : virtual ~AstAttribute() {}
45 :
46 0 : void setExceptions(
47 : rtl::OUString const * getDoc, DeclList const * getExc,
48 : rtl::OUString const * setDoc, DeclList const * setExc)
49 : {
50 0 : if (getDoc != 0) {
51 0 : m_getDocumentation = *getDoc;
52 : }
53 0 : if (getExc != 0) {
54 0 : m_getExceptions = *getExc;
55 : }
56 0 : if (setDoc != 0) {
57 0 : m_setDocumentation = *setDoc;
58 : }
59 0 : if (setExc != 0) {
60 0 : m_setExceptions = *setExc;
61 : }
62 0 : }
63 :
64 0 : DeclList::size_type getGetExceptionCount() const
65 0 : { return m_getExceptions.size(); }
66 :
67 0 : DeclList::size_type getSetExceptionCount() const
68 0 : { return m_setExceptions.size(); }
69 :
70 0 : AstType const * getType() const
71 0 : { return m_pType; }
72 0 : sal_Bool isReadonly() const
73 0 : { return ((m_flags & AF_READONLY) == AF_READONLY); }
74 0 : sal_Bool isOptional() const
75 0 : { return ((m_flags & AF_OPTIONAL) == AF_OPTIONAL); }
76 : sal_Bool isAttribute() const
77 : { return ((m_flags & AF_ATTRIBUTE) == AF_ATTRIBUTE); }
78 : sal_Bool isProperty() const
79 : { return ((m_flags & AF_PROPERTY) == AF_PROPERTY); }
80 0 : sal_Bool isBound() const
81 0 : { return ((m_flags & AF_BOUND) == AF_BOUND); }
82 0 : sal_Bool isMayBeVoid() const
83 0 : { return ((m_flags & AF_MAYBEVOID) == AF_MAYBEVOID); }
84 0 : sal_Bool isConstrained() const
85 0 : { return ((m_flags & AF_CONSTRAINED) == AF_CONSTRAINED); }
86 0 : sal_Bool isTransient() const
87 0 : { return ((m_flags & AF_TRANSIENT) == AF_TRANSIENT); }
88 0 : sal_Bool isMayBeAmbiguous() const
89 0 : { return ((m_flags & AF_MAYBEAMBIGUOUS) == AF_MAYBEAMBIGUOUS); }
90 0 : sal_Bool isMayBeDefault() const
91 0 : { return ((m_flags & AF_MAYBEDEFAULT) == AF_MAYBEDEFAULT); }
92 0 : sal_Bool isRemoveable() const
93 0 : { return ((m_flags & AF_REMOVEABLE) == AF_REMOVEABLE); }
94 :
95 : sal_Bool dumpBlob(
96 : typereg::Writer & rBlob, sal_uInt16 index, sal_uInt16 * methodIndex);
97 :
98 : private:
99 : void dumpExceptions(
100 : typereg::Writer & writer, rtl::OUString const & documentation,
101 : DeclList const & exceptions, RTMethodMode flags,
102 : sal_uInt16 * methodIndex);
103 :
104 : const sal_uInt32 m_flags;
105 : AstType const * m_pType;
106 : rtl::OUString m_getDocumentation;
107 : DeclList m_getExceptions;
108 : rtl::OUString m_setDocumentation;
109 : DeclList m_setExceptions;
110 : };
111 :
112 : #endif // _IDLC_ASTATTRIBUTE_HXX_
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|