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