xref: /trunk/main/autodoc/inc/ary/idl/i_function.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef ARY_IDL_I_FUNCTION_HXX
29*cdf0e10cSrcweir #define ARY_IDL_I_FUNCTION_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir // BASE CLASSES
32*cdf0e10cSrcweir #include <ary/idl/i_ce.hxx>
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir // USED SERVICES
35*cdf0e10cSrcweir #include <ary/idl/i_param.hxx>
36*cdf0e10cSrcweir #include <ary/idl/ik_function.hxx>
37*cdf0e10cSrcweir #include <ary/stdconstiter.hxx>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir namespace ary
43*cdf0e10cSrcweir {
44*cdf0e10cSrcweir namespace idl
45*cdf0e10cSrcweir {
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir /** Represents an IDL function.
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir     Special case constructor:
51*cdf0e10cSrcweir     Constructors have return type "0".
52*cdf0e10cSrcweir */
53*cdf0e10cSrcweir class Function : public CodeEntity
54*cdf0e10cSrcweir {
55*cdf0e10cSrcweir   public:
56*cdf0e10cSrcweir     enum E_ClassId { class_id = 2002 };
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir     typedef std::vector< Parameter >    ParamList;
59*cdf0e10cSrcweir     typedef std::vector< Type_id >      ExceptionList;
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir     // LIFECYCLE
62*cdf0e10cSrcweir     /// Normal function
63*cdf0e10cSrcweir                         Function(
64*cdf0e10cSrcweir                             const String &      i_sName,
65*cdf0e10cSrcweir                             Ce_id               i_nOwner,
66*cdf0e10cSrcweir                             Ce_id               i_nNameRoom,
67*cdf0e10cSrcweir                             Type_id             i_nReturnType,
68*cdf0e10cSrcweir                             bool                i_bOneWay );
69*cdf0e10cSrcweir     /// Constructor
70*cdf0e10cSrcweir                         Function(
71*cdf0e10cSrcweir                             const String &      i_sName,
72*cdf0e10cSrcweir                             Ce_id               i_nOwner,
73*cdf0e10cSrcweir                             Ce_id               i_nNameRoom );
74*cdf0e10cSrcweir                         ~Function();
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir     // OPERATIONS
77*cdf0e10cSrcweir     void                Add_Parameter(
78*cdf0e10cSrcweir                             const String &      i_sName,
79*cdf0e10cSrcweir                             Type_id             i_nType,
80*cdf0e10cSrcweir                             E_ParameterDirection
81*cdf0e10cSrcweir                                                 i_eDirection );
82*cdf0e10cSrcweir     /// The function's parameter list ends with the ellipse "..." .
83*cdf0e10cSrcweir     void                Set_Ellipse();
84*cdf0e10cSrcweir     void                Add_Exception(
85*cdf0e10cSrcweir                             Type_id             i_nException );
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir     // INQUIRY
88*cdf0e10cSrcweir     Type_id             ReturnType() const;
89*cdf0e10cSrcweir     const ParamList &   Parameters() const      { return aParameters; }
90*cdf0e10cSrcweir     const ExceptionList &
91*cdf0e10cSrcweir                         Exceptions() const      { return aExceptions; }
92*cdf0e10cSrcweir     bool                IsOneway() const;
93*cdf0e10cSrcweir     bool                HasEllipse() const      { return bEllipse; }
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir   private:
96*cdf0e10cSrcweir     // Interface csv::ConstProcessorClient:
97*cdf0e10cSrcweir     virtual void        do_Accept(
98*cdf0e10cSrcweir                             csv::ProcessorIfc & io_processor ) const;
99*cdf0e10cSrcweir     // Interface ary::Object:
100*cdf0e10cSrcweir     virtual ClassId     get_AryClass() const;
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir     // Interface CodeEntity
103*cdf0e10cSrcweir     virtual const String &  inq_LocalName() const;
104*cdf0e10cSrcweir     virtual Ce_id           inq_NameRoom() const;
105*cdf0e10cSrcweir     virtual Ce_id           inq_Owner() const;
106*cdf0e10cSrcweir     virtual E_SightLevel    inq_SightLevel() const;
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir     // Locals
109*cdf0e10cSrcweir     friend struct ifc_function::attr;
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir     // DATA
112*cdf0e10cSrcweir     String              sName;
113*cdf0e10cSrcweir     Ce_id               nOwner;
114*cdf0e10cSrcweir     Ce_id               nNameRoom;
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir     Type_id             nReturnType;
117*cdf0e10cSrcweir     ParamList           aParameters;
118*cdf0e10cSrcweir     ExceptionList       aExceptions;
119*cdf0e10cSrcweir     bool                bOneWay;
120*cdf0e10cSrcweir     bool                bEllipse;
121*cdf0e10cSrcweir };
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir // IMPLEMENTATION
127*cdf0e10cSrcweir inline void
128*cdf0e10cSrcweir Function::Add_Parameter( const String &         i_sName,
129*cdf0e10cSrcweir                          Type_id                i_nType,
130*cdf0e10cSrcweir                          E_ParameterDirection   i_eDirection )
131*cdf0e10cSrcweir {
132*cdf0e10cSrcweir     aParameters.push_back( Parameter(i_sName,i_nType,i_eDirection) );
133*cdf0e10cSrcweir }
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir inline void
136*cdf0e10cSrcweir Function::Set_Ellipse()
137*cdf0e10cSrcweir {
138*cdf0e10cSrcweir     bEllipse = true;
139*cdf0e10cSrcweir }
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir inline void
142*cdf0e10cSrcweir Function::Add_Exception( Type_id i_nException )
143*cdf0e10cSrcweir {
144*cdf0e10cSrcweir     aExceptions.push_back(i_nException);
145*cdf0e10cSrcweir }
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir inline Type_id
148*cdf0e10cSrcweir Function::ReturnType() const
149*cdf0e10cSrcweir     { return nReturnType; }
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir inline bool
152*cdf0e10cSrcweir Function::IsOneway() const
153*cdf0e10cSrcweir     { return bOneWay; }
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir }   // namespace idl
159*cdf0e10cSrcweir }   // namespace ary
160*cdf0e10cSrcweir #endif
161