1------------------------------------------------------------------------------
2--                                                                          --
3--                            Matreshka Project                             --
4--                                                                          --
5--                          Ada Modeling Framework                          --
6--                                                                          --
7--                        Runtime Library Component                         --
8--                                                                          --
9------------------------------------------------------------------------------
10--                                                                          --
11-- Copyright © 2012, Vadim Godunko <vgodunko@gmail.com>                     --
12-- All rights reserved.                                                     --
13--                                                                          --
14-- Redistribution and use in source and binary forms, with or without       --
15-- modification, are permitted provided that the following conditions       --
16-- are met:                                                                 --
17--                                                                          --
18--  * Redistributions of source code must retain the above copyright        --
19--    notice, this list of conditions and the following disclaimer.         --
20--                                                                          --
21--  * Redistributions in binary form must reproduce the above copyright     --
22--    notice, this list of conditions and the following disclaimer in the   --
23--    documentation and/or other materials provided with the distribution.  --
24--                                                                          --
25--  * Neither the name of the Vadim Godunko, IE nor the names of its        --
26--    contributors may be used to endorse or promote products derived from  --
27--    this software without specific prior written permission.              --
28--                                                                          --
29-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS      --
30-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT        --
31-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR    --
32-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT     --
33-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,   --
34-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
35-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR   --
36-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF   --
37-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING     --
38-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS       --
39-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.             --
40--                                                                          --
41------------------------------------------------------------------------------
42--  $Revision: 3436 $ $Date: 2012-11-14 10:14:34 +0400 (Wed, 14 Nov 2012) $
43------------------------------------------------------------------------------
44with AMF.Elements;
45with AMF.Internals.Helpers;
46with AMF.Internals.Tables.UML_Attributes;
47with AMF.Visitors.UMLDI_Iterators;
48with AMF.Visitors.UMLDI_Visitors;
49with League.Strings.Internals;
50
51package body AMF.Internals.UMLDI_UML_Labels is
52
53   --------------
54   -- Get_Text --
55   --------------
56
57   overriding function Get_Text
58    (Self : not null access constant UMLDI_UML_Label_Proxy)
59       return League.Strings.Universal_String is
60   begin
61      null;
62      return
63        League.Strings.Internals.Create
64         (AMF.Internals.Tables.UML_Attributes.Internal_Get_Text (Self.Element));
65   end Get_Text;
66
67   --------------
68   -- Set_Text --
69   --------------
70
71   overriding procedure Set_Text
72    (Self : not null access UMLDI_UML_Label_Proxy;
73     To   : League.Strings.Universal_String) is
74   begin
75      AMF.Internals.Tables.UML_Attributes.Internal_Set_Text
76       (Self.Element,
77        League.Strings.Internals.Internal (To));
78   end Set_Text;
79
80   -----------------
81   -- Get_Is_Icon --
82   -----------------
83
84   overriding function Get_Is_Icon
85    (Self : not null access constant UMLDI_UML_Label_Proxy)
86       return Boolean is
87   begin
88      return
89        AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Icon
90         (Self.Element);
91   end Get_Is_Icon;
92
93   -----------------
94   -- Set_Is_Icon --
95   -----------------
96
97   overriding procedure Set_Is_Icon
98    (Self : not null access UMLDI_UML_Label_Proxy;
99     To   : Boolean) is
100   begin
101      AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Icon
102       (Self.Element, To);
103   end Set_Is_Icon;
104
105   ---------------------
106   -- Get_Local_Style --
107   ---------------------
108
109   overriding function Get_Local_Style
110    (Self : not null access constant UMLDI_UML_Label_Proxy)
111       return AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access is
112   begin
113      return
114        AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access
115         (AMF.Internals.Helpers.To_Element
116           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Style
117             (Self.Element)));
118   end Get_Local_Style;
119
120   ---------------------
121   -- Set_Local_Style --
122   ---------------------
123
124   overriding procedure Set_Local_Style
125    (Self : not null access UMLDI_UML_Label_Proxy;
126     To   : AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access) is
127   begin
128      AMF.Internals.Tables.UML_Attributes.Internal_Set_Local_Style
129       (Self.Element,
130        AMF.Internals.Helpers.To_Element
131         (AMF.Elements.Element_Access (To)));
132   end Set_Local_Style;
133
134   -----------------------
135   -- Get_Model_Element --
136   -----------------------
137
138   overriding function Get_Model_Element
139    (Self : not null access constant UMLDI_UML_Label_Proxy)
140       return AMF.UML.Elements.Collections.Set_Of_UML_Element is
141   begin
142      raise Program_Error;
143      return X : AMF.UML.Elements.Collections.Set_Of_UML_Element;
144--      return
145--        AMF.UML.Elements.Collections.Wrap
146--         (AMF.Internals.Element_Collections.Wrap
147--           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Model_Element
148--             (Self.Element)));
149   end Get_Model_Element;
150
151   -----------------------
152   -- Get_Model_Element --
153   -----------------------
154
155   overriding function Get_Model_Element
156    (Self : not null access constant UMLDI_UML_Label_Proxy)
157       return AMF.CMOF.Elements.CMOF_Element_Access is
158   begin
159      return
160        AMF.CMOF.Elements.CMOF_Element_Access
161         (AMF.Internals.Helpers.To_Element
162           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Model_Element
163             (Self.Element)));
164   end Get_Model_Element;
165
166   ---------------------
167   -- Get_Local_Style --
168   ---------------------
169
170   overriding function Get_Local_Style
171    (Self : not null access constant UMLDI_UML_Label_Proxy)
172       return AMF.DI.Styles.DI_Style_Access is
173   begin
174      return
175        AMF.DI.Styles.DI_Style_Access
176         (AMF.Internals.Helpers.To_Element
177           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Style
178             (Self.Element)));
179   end Get_Local_Style;
180
181   ---------------------
182   -- Set_Local_Style --
183   ---------------------
184
185   overriding procedure Set_Local_Style
186    (Self : not null access UMLDI_UML_Label_Proxy;
187     To   : AMF.DI.Styles.DI_Style_Access) is
188   begin
189      AMF.Internals.Tables.UML_Attributes.Internal_Set_Local_Style
190       (Self.Element,
191        AMF.Internals.Helpers.To_Element
192         (AMF.Elements.Element_Access (To)));
193   end Set_Local_Style;
194
195   -------------------
196   -- Enter_Element --
197   -------------------
198
199   overriding procedure Enter_Element
200    (Self    : not null access constant UMLDI_UML_Label_Proxy;
201     Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
202     Control : in out AMF.Visitors.Traverse_Control) is
203   begin
204      if Visitor in AMF.Visitors.UMLDI_Visitors.UMLDI_Visitor'Class then
205         AMF.Visitors.UMLDI_Visitors.UMLDI_Visitor'Class
206          (Visitor).Enter_UML_Label
207            (AMF.UMLDI.UML_Labels.UMLDI_UML_Label_Access (Self),
208           Control);
209      end if;
210   end Enter_Element;
211
212   -------------------
213   -- Leave_Element --
214   -------------------
215
216   overriding procedure Leave_Element
217    (Self    : not null access constant UMLDI_UML_Label_Proxy;
218     Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
219     Control : in out AMF.Visitors.Traverse_Control) is
220   begin
221      if Visitor in AMF.Visitors.UMLDI_Visitors.UMLDI_Visitor'Class then
222         AMF.Visitors.UMLDI_Visitors.UMLDI_Visitor'Class
223          (Visitor).Leave_UML_Label
224            (AMF.UMLDI.UML_Labels.UMLDI_UML_Label_Access (Self),
225           Control);
226      end if;
227   end Leave_Element;
228
229   -------------------
230   -- Visit_Element --
231   -------------------
232
233   overriding procedure Visit_Element
234    (Self     : not null access constant UMLDI_UML_Label_Proxy;
235     Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
236     Visitor  : in out AMF.Visitors.Abstract_Visitor'Class;
237     Control  : in out AMF.Visitors.Traverse_Control) is
238   begin
239      if Iterator in AMF.Visitors.UMLDI_Iterators.UMLDI_Iterator'Class then
240         AMF.Visitors.UMLDI_Iterators.UMLDI_Iterator'Class
241          (Iterator).Visit_UML_Label
242            (Visitor,
243             AMF.UMLDI.UML_Labels.UMLDI_UML_Label_Access (Self),
244           Control);
245      end if;
246   end Visit_Element;
247
248end AMF.Internals.UMLDI_UML_Labels;
249