xref: /AOO41X/main/idlc/inc/idlc/astoperation.hxx (revision f04bd1c41dbb33d4d3f057e7474795ed0a0da601)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _IDLC_ASTOPERATION_HXX_
24 #define _IDLC_ASTOPERATION_HXX_
25 
26 #include <idlc/astdeclaration.hxx>
27 #include <idlc/astscope.hxx>
28 
29 namespace typereg { class Writer; }
30 
31 #define OP_NONE         0x0000
32 #define OP_ONEWAY       0x0001
33 
34 class AstType;
35 
36 class AstOperation : public AstDeclaration
37                    , public AstScope
38 {
39 public:
AstOperation(sal_uInt32 flags,AstType * pReturnType,const::rtl::OString & name,AstScope * pScope)40     AstOperation(sal_uInt32 flags, AstType* pReturnType, const ::rtl::OString& name, AstScope* pScope)
41         : AstDeclaration(NT_operation, name, pScope)
42         , AstScope(NT_operation)
43         , m_flags(flags)
44         , m_pReturnType(pReturnType)
45         {}
~AstOperation()46     virtual ~AstOperation() {}
47 
isOneway()48     sal_Bool isOneway()
49         { return ((m_flags & OP_ONEWAY) == OP_ONEWAY); }
50 
51     bool isVariadic() const;
52 
isConstructor() const53     bool isConstructor() const { return m_pReturnType == 0; }
54 
55     void setExceptions(DeclList const * pExceptions);
getExceptions()56     const DeclList& getExceptions()
57         { return m_exceptions; }
nExceptions()58     sal_uInt16 nExceptions()
59         { return (sal_uInt16)(m_exceptions.size()); }
60 
61     sal_Bool dumpBlob(typereg::Writer & rBlob, sal_uInt16 index);
62 
63     // scope management
64     virtual AstDeclaration* addDeclaration(AstDeclaration* pDecl);
65 private:
66     sal_uInt32  m_flags;
67     AstType*    m_pReturnType;
68     DeclList    m_exceptions;
69 };
70 
71 #endif // _IDLC_ASTOPERATION_HXX_
72 
73