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/cpp/c_enum.hxx>
24
25
26 // NOT FULLY DECLARED SERVICES
27 #include <slots.hxx>
28 #include "c_slots.hxx"
29
30
31
32
33 namespace ary
34 {
35 namespace cpp
36 {
37
Enum(const String & i_sLocalName,Ce_id i_nOwner,E_Protection i_eProtection,Lid i_nFile)38 Enum::Enum( const String & i_sLocalName,
39 Ce_id i_nOwner,
40 E_Protection i_eProtection,
41 Lid i_nFile )
42 : aEssentials( i_sLocalName,
43 i_nOwner,
44 i_nFile ),
45 aValues(),
46 eProtection(i_eProtection)
47 {
48 }
49
~Enum()50 Enum::~Enum()
51 {
52 }
53
54 void
Add_Value(Ce_id i_nId)55 Enum::Add_Value( Ce_id i_nId )
56 {
57 aValues.Add( i_nId );
58 }
59
60 const String &
inq_LocalName() const61 Enum::inq_LocalName() const
62 {
63 return aEssentials.LocalName();
64 }
65
66 Cid
inq_Owner() const67 Enum::inq_Owner() const
68 {
69 return aEssentials.Owner();
70 }
71
72 Lid
inq_Location() const73 Enum::inq_Location() const
74 {
75 return aEssentials.Location();
76 }
77
78 void
do_Accept(csv::ProcessorIfc & io_processor) const79 Enum::do_Accept(csv::ProcessorIfc & io_processor) const
80 {
81 csv::CheckedCall(io_processor,*this);
82 }
83
84 ClassId
get_AryClass() const85 Enum::get_AryClass() const
86 {
87 return class_id;
88 }
89
90 Gid
inq_Id_Group() const91 Enum::inq_Id_Group() const
92 {
93 return static_cast<Gid>(Id());
94 }
95
96 const ary::cpp::CppEntity &
inq_RE_Group() const97 Enum::inq_RE_Group() const
98 {
99 return *this;
100 }
101
102 const group::SlotList &
inq_Slots() const103 Enum::inq_Slots() const
104 {
105 static const SlotAccessId aProjectSlotData[]
106 = { SLOT_Values };
107 static const std::vector< SlotAccessId >
108 aSlots( &aProjectSlotData[0],
109 &aProjectSlotData[0]
110 + sizeof aProjectSlotData / sizeof (SlotAccessId) );
111 return aSlots;
112 }
113
114 DYN Slot *
inq_Create_Slot(SlotAccessId i_nSlot) const115 Enum::inq_Create_Slot( SlotAccessId i_nSlot ) const
116 {
117 switch ( i_nSlot )
118 {
119 case SLOT_Values: return new Slot_SequentialIds<Ce_id>(aValues);
120 default:
121 return new Slot_Null;
122 } // end switch
123 }
124
125
126
127 } // namespace cpp
128 } // namespace ary
129