Branch data 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 : 4980 : AstAttribute(
33 : : sal_uInt32 flags, AstType const * type, rtl::OString const & name,
34 : : AstScope * scope):
35 : : AstDeclaration(NT_attribute, name, scope),
36 [ + - ][ + - ]: 4980 : AstScope(NT_attribute), m_flags(flags), m_pType(type)
[ + - ]
37 : 4980 : {}
38 : :
39 : 23273 : 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 [ + - ][ + - ]: 23273 : , m_pType(pType)
[ + - ]
43 : 23273 : {}
44 [ # # ][ # # ]: 0 : virtual ~AstAttribute() {}
45 : :
46 : 4980 : void setExceptions(
47 : : rtl::OUString const * getDoc, DeclList const * getExc,
48 : : rtl::OUString const * setDoc, DeclList const * setExc)
49 : : {
50 [ + + ]: 4980 : if (getDoc != 0) {
51 : 1174 : m_getDocumentation = *getDoc;
52 : : }
53 [ + + ]: 4980 : if (getExc != 0) {
54 : 1174 : m_getExceptions = *getExc;
55 : : }
56 [ + + ]: 4980 : if (setDoc != 0) {
57 : 1334 : m_setDocumentation = *setDoc;
58 : : }
59 [ + + ]: 4980 : if (setExc != 0) {
60 : 1334 : m_setExceptions = *setExc;
61 : : }
62 : 4980 : }
63 : :
64 : 1179 : DeclList::size_type getGetExceptionCount() const
65 : 1179 : { return m_getExceptions.size(); }
66 : :
67 : 1179 : DeclList::size_type getSetExceptionCount() const
68 : 1179 : { return m_setExceptions.size(); }
69 : :
70 : 4895 : AstType const * getType() const
71 : 4895 : { return m_pType; }
72 : 6229 : sal_Bool isReadonly() const
73 : 6229 : { return ((m_flags & AF_READONLY) == AF_READONLY); }
74 : 4895 : sal_Bool isOptional() const
75 : 4895 : { 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 : 6074 : sal_Bool isBound() const
81 : 6074 : { return ((m_flags & AF_BOUND) == AF_BOUND); }
82 : 4895 : sal_Bool isMayBeVoid() const
83 : 4895 : { return ((m_flags & AF_MAYBEVOID) == AF_MAYBEVOID); }
84 : 4895 : sal_Bool isConstrained() const
85 : 4895 : { return ((m_flags & AF_CONSTRAINED) == AF_CONSTRAINED); }
86 : 4895 : sal_Bool isTransient() const
87 : 4895 : { return ((m_flags & AF_TRANSIENT) == AF_TRANSIENT); }
88 : 4895 : sal_Bool isMayBeAmbiguous() const
89 : 4895 : { return ((m_flags & AF_MAYBEAMBIGUOUS) == AF_MAYBEAMBIGUOUS); }
90 : 4895 : sal_Bool isMayBeDefault() const
91 : 4895 : { return ((m_flags & AF_MAYBEDEFAULT) == AF_MAYBEDEFAULT); }
92 : 4895 : sal_Bool isRemoveable() const
93 : 4895 : { 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: */
|