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_attribute.hxx>
30 #include <ary/idl/ik_attribute.hxx>
31 
32 
33 // NOT FULLY DECLARED SERVICES
34 #include <cosv/tpl/processor.hxx>
35 #include <ary/getncast.hxx>
36 #include <sci_impl.hxx>
37 
38 
39 namespace ary
40 {
41 namespace idl
42 {
43 
44 
45 Attribute::Attribute( const String &      i_sName,
46                       Ce_id               i_nService,
47 					  Ce_id               i_nModule,
48 					  Type_id             i_nType,
49 					  bool                i_bReadonly,
50 					  bool                i_bBound )
51     :   sName(i_sName),
52         nOwner(i_nService),
53         nNameRoom(i_nModule),
54         nType(i_nType),
55         aGetExceptions(),
56         aSetExceptions(),
57         bReadonly(i_bReadonly),
58         bBound(i_bBound)
59 {
60 }
61 
62 Attribute::~Attribute()
63 {
64 }
65 
66 
67 void
68 Attribute::do_Accept(csv::ProcessorIfc & io_processor) const
69 {
70     csv::CheckedCall(io_processor,*this);
71 }
72 
73 ClassId
74 Attribute::get_AryClass() const
75 {
76     return class_id;
77 }
78 
79 const String &
80 Attribute::inq_LocalName() const
81 {
82     return sName;
83 }
84 
85 Ce_id
86 Attribute::inq_NameRoom() const
87 {
88     return nNameRoom;
89 }
90 
91 Ce_id
92 Attribute::inq_Owner() const
93 {
94     return nOwner;
95 }
96 
97 E_SightLevel
98 Attribute::inq_SightLevel() const
99 {
100     return sl_Member;
101 }
102 
103 namespace ifc_attribute
104 {
105 
106 inline const Attribute &
107 attribute_cast( const CodeEntity &  i_ce )
108 {
109     csv_assert( is_type<Attribute>(i_ce) );
110 	return static_cast< const Attribute& >(i_ce);
111 }
112 
113 bool
114 attr::HasAnyStereotype( const CodeEntity & i_ce )
115 {
116     const Attribute & rAttr = attribute_cast(i_ce);
117     return rAttr.bReadonly OR rAttr.bBound;
118 }
119 
120 bool
121 attr::IsReadOnly( const CodeEntity & i_ce )
122 {
123     return attribute_cast(i_ce).bReadonly;
124 }
125 
126 bool
127 attr::IsBound( const CodeEntity & i_ce )
128 {
129     return attribute_cast(i_ce).bBound;
130 }
131 
132 Type_id
133 attr::Type( const CodeEntity & i_ce )
134 {
135     return attribute_cast(i_ce).nType;
136 }
137 
138 void
139 attr::Get_GetExceptions( Dyn_TypeIterator &  o_result,
140                          const CodeEntity &  i_ce )
141 {
142     o_result
143         = new SCI_Vector<Type_id>( attribute_cast(i_ce).aGetExceptions );
144 }
145 
146 void
147 attr::Get_SetExceptions( Dyn_TypeIterator &  o_result,
148                          const CodeEntity &  i_ce )
149 {
150     o_result
151         = new SCI_Vector<Type_id>( attribute_cast(i_ce).aSetExceptions );
152 }
153 
154 
155 } // namespace ifc_attribute
156 
157 
158 }   //  namespace   idl
159 }   //  namespace   ary
160