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