xref: /aoo41x/main/autodoc/source/ary/idl/i_service.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_service.hxx>
30 
31 
32 // NOT FULLY DECLARED SERVICES
33 #include <cosv/tpl/processor.hxx>
34 #include <ary/idl/ik_service.hxx>
35 #include <ary/doc/d_oldidldocu.hxx>
36 #include <sci_impl.hxx>
37 #include "i2s_calculator.hxx"
38 
39 
40 namespace ary
41 {
42 namespace idl
43 {
44 
45 Service::Service( const String &      i_sName,
46                   Ce_id               i_nOwner )
47     :   sName(i_sName),
48         nOwner(i_nOwner),
49         aIncludedServices(),
50         aSupportedInterfaces(),
51         aProperties()
52 {
53 }
54 
55 Service::~Service()
56 {
57     for ( RelationList::iterator it = aIncludedServices.begin();
58           it != aIncludedServices.end();
59           ++it )
60     {
61         delete (*it).Info();
62     }
63 
64     for ( RelationList::iterator it = aSupportedInterfaces.begin();
65           it != aSupportedInterfaces.end();
66           ++it )
67     {
68         delete (*it).Info();
69     }
70 }
71 
72 void
73 Service::Get_SupportedInterfaces( Dyn_StdConstIterator<CommentedRelation> & o_rResult ) const
74 {
75     o_rResult = new SCI_Vector<CommentedRelation>(aSupportedInterfaces);
76 }
77 
78 void
79 Service::Get_IncludedServices( Dyn_StdConstIterator<CommentedRelation> & o_rResult ) const
80 {
81     o_rResult = new SCI_Vector<CommentedRelation>(aIncludedServices);
82 }
83 
84 void
85 Service::do_Accept( csv::ProcessorIfc & io_processor ) const
86 {
87     csv::CheckedCall(io_processor, *this);
88 }
89 
90 ClassId
91 Service::get_AryClass() const
92 {
93     return class_id;
94 }
95 
96 const String &
97 Service::inq_LocalName() const
98 {
99     return sName;
100 }
101 
102 Ce_id
103 Service::inq_NameRoom() const
104 {
105     return nOwner;
106 }
107 
108 Ce_id
109 Service::inq_Owner() const
110 {
111     return nOwner;
112 }
113 
114 E_SightLevel
115 Service::inq_SightLevel() const
116 {
117     return sl_File;
118 }
119 
120 
121 namespace ifc_service
122 {
123 
124 inline const Service &
125 service_cast( const CodeEntity &  i_ce )
126 {
127     csv_assert( i_ce.AryClass() == Service::class_id );
128 	return static_cast< const Service& >(i_ce);
129 }
130 
131 void
132 attr::Get_IncludedServices( Dyn_StdConstIterator<CommentedRelation> & o_result,
133                             const CodeEntity &						  i_ce )
134 {
135     o_result = new SCI_Vector<CommentedRelation>( service_cast(i_ce).aIncludedServices );
136 }
137 
138 void
139 attr::Get_ExportedInterfaces( Dyn_StdConstIterator<CommentedRelation> & o_result,
140                               const CodeEntity &							i_ce )
141 {
142     o_result = new SCI_Vector<CommentedRelation>( service_cast(i_ce).aSupportedInterfaces );
143 }
144 
145 void
146 attr::Get_Properties( Dyn_CeIterator &    o_result,
147                       const CodeEntity &  i_ce )
148 {
149     o_result = new SCI_Vector<Ce_id>( service_cast(i_ce).aProperties );
150 }
151 
152 void
153 xref::Get_IncludingServices( Dyn_CeIterator &    o_result,
154                              const CodeEntity &  i_ce )
155 {
156     o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(service_2s_IncludingServices));
157 }
158 
159 void
160 xref::Get_InstantiatingSingletons( Dyn_CeIterator &    o_result,
161                                    const CodeEntity &  i_ce )
162 {
163     o_result = new SCI_Vector<Ce_id>(i_ce.Secondaries().List(service_2s_InstantiatingSingletons));
164 }
165 
166 
167 } // namespace ifc_service
168 
169 
170 }   //  namespace   idl
171 }   //  namespace   ary
172