1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #include <precomp.h>
29 #include <ary/idl/i_function.hxx>
30 
31 
32 // NOT FULLY DECLARED SERVICES
33 #include <cosv/tpl/processor.hxx>
34 #include <sci_impl.hxx>
35 
36 
37 
38 namespace ary
39 {
40 namespace idl
41 {
42 
43 Function::Function( const String &      i_sName,
44                     Ce_id               i_nOwner,
45                     Ce_id               i_nNameRoom,
46                     Type_id             i_nReturnType,
47                     bool                i_bOneWay )
48     :   sName(i_sName),
49         nOwner(i_nOwner),
50         nNameRoom(i_nNameRoom),
51         nReturnType(i_nReturnType),
52         aParameters(),
53         aExceptions(),
54         bOneWay(i_bOneWay),
55         bEllipse(false)
56 {
57 }
58 
59 Function::Function( const String &      i_sName,
60                     Ce_id               i_nOwner,
61                     Ce_id               i_nNameRoom )
62     :   sName(i_sName),
63         nOwner(i_nOwner),
64         nNameRoom(i_nNameRoom),
65         nReturnType(0),
66         aParameters(),
67         aExceptions(),
68         bOneWay(false),
69         bEllipse(false)
70 {
71 }
72 
73 Function::~Function()
74 {
75 }
76 
77 void
78 Function::do_Accept( csv::ProcessorIfc & io_processor ) const
79 {
80     csv::CheckedCall(io_processor, *this);
81 }
82 
83 ClassId
84 Function::get_AryClass() const
85 {
86     return class_id;
87 }
88 
89 const String &
90 Function::inq_LocalName() const
91 {
92     return sName;
93 }
94 
95 Ce_id
96 Function::inq_NameRoom() const
97 {
98     return nNameRoom;
99 }
100 
101 Ce_id
102 Function::inq_Owner() const
103 {
104     return nOwner;
105 }
106 
107 E_SightLevel
108 Function::inq_SightLevel() const
109 {
110     return sl_Member;
111 }
112 
113 
114 namespace ifc_function
115 {
116 
117 inline const Function &
118 function_cast( const CodeEntity &  i_ce )
119 {
120     csv_assert( i_ce.AryClass() == Function::class_id );
121     return static_cast< const Function& >(i_ce);
122 }
123 
124 Type_id
125 attr::ReturnType( const CodeEntity & i_ce )
126 {
127     return function_cast(i_ce).nReturnType;
128 }
129 
130 bool
131 attr::IsOneway( const CodeEntity & i_ce )
132 {
133     return function_cast(i_ce).bOneWay;
134 }
135 
136 bool
137 attr::HasEllipse( const CodeEntity & i_ce )
138 {
139     return function_cast(i_ce).bEllipse;
140 }
141 
142 void
143 attr::Get_Parameters( Dyn_StdConstIterator<ary::idl::Parameter> & o_result,
144                       const CodeEntity &						  i_ce )
145 {
146     o_result
147         = new SCI_Vector<Parameter>( function_cast(i_ce).aParameters );
148 }
149 
150 void
151 attr::Get_Exceptions( Dyn_TypeIterator &  o_result,
152                       const CodeEntity &  i_ce )
153 {
154     o_result
155         = new SCI_Vector<Type_id>( function_cast(i_ce).aExceptions );
156 }
157 
158 
159 
160 
161 
162 }   // namespace ifc_function
163 
164 }   //  namespace   idl
165 }   //  namespace   ary
166