xref: /aoo42x/main/autodoc/source/ary/idl/i_struct.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_struct.hxx>
30 #include <ary/idl/ik_struct.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 Struct::Struct( const String &      i_sName,
45                 Ce_id               i_nOwner,
46                 Type_id             i_nBase,
47                 const String &      i_sTemplateParameter,
48                 Type_id             i_nTemplateParameterType )
49     :   sName(i_sName),
50         nOwner(i_nOwner),
51         nBase(i_nBase),
52         sTemplateParameter(i_sTemplateParameter),
53         nTemplateParameterType(i_nTemplateParameterType),
54         aElements()
55 {
56 }
57 
58 Struct::~Struct()
59 {
60 }
61 
62 void
63 Struct::do_Accept( csv::ProcessorIfc & io_processor ) const
64 {
65     csv::CheckedCall(io_processor, *this);
66 }
67 
68 ClassId
69 Struct::get_AryClass() const
70 {
71     return class_id;
72 }
73 
74 const String &
75 Struct::inq_LocalName() const
76 {
77     return sName;
78 }
79 
80 Ce_id
81 Struct::inq_NameRoom() const
82 {
83     return nOwner;
84 }
85 
86 Ce_id
87 Struct::inq_Owner() const
88 {
89     return nOwner;
90 }
91 
92 E_SightLevel
93 Struct::inq_SightLevel() const
94 {
95     return sl_File;
96 }
97 
98 
99 namespace ifc_struct
100 {
101 
102 inline const Struct &
103 struct_cast( const CodeEntity &  i_ce )
104 {
105     csv_assert( i_ce.AryClass() == Struct::class_id );
106 	return static_cast< const Struct& >(i_ce);
107 }
108 
109 Type_id
110 attr::Base( const CodeEntity & i_ce )
111 {
112     return struct_cast(i_ce).nBase;
113 }
114 
115 void
116 attr::Get_Elements( Dyn_CeIterator &    o_result,
117                     const CodeEntity &  i_ce )
118 {
119     o_result = new SCI_Vector<Ce_id>( struct_cast(i_ce).aElements );
120 }
121 
122 
123 void
124 xref::Get_Derivations( Dyn_CeIterator &    o_result,
125                        const CodeEntity &  i_ce )
126 {
127     o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(struct_2s_Derivations));
128 }
129 
130 void
131 xref::Get_SynonymTypedefs( Dyn_CeIterator &    o_result,
132                            const CodeEntity &  i_ce )
133 {
134     o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(struct_2s_SynonymTypedefs));
135 }
136 
137 void
138 xref::Get_AsReturns( Dyn_CeIterator &    o_result,
139                      const CodeEntity &  i_ce )
140 {
141     o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(struct_2s_AsReturns));
142 }
143 
144 void
145 xref::Get_AsParameters( Dyn_CeIterator &    o_result,
146                         const CodeEntity &  i_ce )
147 {
148     o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(struct_2s_AsParameters));
149 }
150 
151 void
152 xref::Get_AsDataTypes( Dyn_CeIterator &    o_result,
153                        const CodeEntity &  i_ce )
154 {
155     o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(struct_2s_AsDataTypes));
156 }
157 
158 } // namespace ifc_struct
159 
160 
161 
162 }   //  namespace   idl
163 }   //  namespace   ary
164