xref: /trunk/main/autodoc/source/ary/idl/i_enum.cxx (revision d291ea28)
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 #include <precomp.h>
23 #include <ary/idl/i_enum.hxx>
24 #include <ary/idl/ik_enum.hxx>
25 
26 
27 // NOT FULLY DECLARED SERVICES
28 #include <cosv/tpl/processor.hxx>
29 #include <sci_impl.hxx>
30 #include "i2s_calculator.hxx"
31 
32 
33 namespace ary
34 {
35 namespace idl
36 {
37 
Enum(const String & i_sName,Ce_id i_nOwner)38 Enum::Enum( const String &      i_sName,
39             Ce_id               i_nOwner )
40     :   sName(i_sName),
41         nOwner(i_nOwner),
42         aValues()
43 {
44 }
45 
~Enum()46 Enum::~Enum()
47 {
48 }
49 
50 void
do_Accept(csv::ProcessorIfc & io_processor) const51 Enum::do_Accept( csv::ProcessorIfc & io_processor ) const
52 {
53     csv::CheckedCall(io_processor, *this);
54 }
55 
56 ClassId
get_AryClass() const57 Enum::get_AryClass() const
58 {
59     return class_id;
60 }
61 
62 const String &
inq_LocalName() const63 Enum::inq_LocalName() const
64 {
65     return sName;
66 }
67 
68 Ce_id
inq_NameRoom() const69 Enum::inq_NameRoom() const
70 {
71     return nOwner;
72 }
73 
74 Ce_id
inq_Owner() const75 Enum::inq_Owner() const
76 {
77     return nOwner;
78 }
79 
80 E_SightLevel
inq_SightLevel() const81 Enum::inq_SightLevel() const
82 {
83     return sl_File;
84 }
85 
86 
87 namespace ifc_enum
88 {
89 
90 inline const Enum &
enum_cast(const CodeEntity & i_ce)91 enum_cast( const CodeEntity & i_ce )
92 {
93     csv_assert( i_ce.AryClass() == Enum::class_id );
94 	return static_cast< const Enum& >(i_ce);
95 }
96 
97 void
Get_Values(Dyn_CeIterator & o_result,const CodeEntity & i_ce)98 attr::Get_Values( Dyn_CeIterator &    o_result,
99                   const CodeEntity &  i_ce )
100 {
101     o_result = new SCI_Vector<Ce_id>(enum_cast(i_ce).aValues);
102 }
103 
104 
105 void
Get_SynonymTypedefs(Dyn_CeIterator & o_result,const CodeEntity & i_ce)106 xref::Get_SynonymTypedefs( Dyn_CeIterator &    o_result,
107                            const CodeEntity &  i_ce )
108 {
109     o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(enum_2s_SynonymTypedefs));
110 }
111 
112 void
Get_AsReturns(Dyn_CeIterator & o_result,const CodeEntity & i_ce)113 xref::Get_AsReturns( Dyn_CeIterator &    o_result,
114                      const CodeEntity &  i_ce )
115 {
116     o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(enum_2s_AsReturns));
117 }
118 
119 void
Get_AsParameters(Dyn_CeIterator & o_result,const CodeEntity & i_ce)120 xref::Get_AsParameters( Dyn_CeIterator &    o_result,
121                         const CodeEntity &  i_ce )
122 {
123     o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(enum_2s_AsParameters));
124 }
125 
126 void
Get_AsDataTypes(Dyn_CeIterator & o_result,const CodeEntity & i_ce)127 xref::Get_AsDataTypes( Dyn_CeIterator &    o_result,
128                        const CodeEntity &  i_ce )
129 {
130     o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(enum_2s_AsDataTypes));
131 }
132 
133 } // namespace ifc_enum
134 
135 
136 }   //  namespace   idl
137 }   //  namespace   ary
138