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: 2868 $ $Date: 2012-04-14 11:38:20 +0400 (Sat, 14 Apr 2012) $
43------------------------------------------------------------------------------
44with AMF.Internals.Tables.UML_Attributes;
45
46package body AMF.Internals.UML_Packageable_Elements is
47
48   --------------------
49   -- Get_Visibility --
50   --------------------
51
52   overriding function Get_Visibility
53    (Self : not null access constant UML_Packageable_Element_Proxy)
54       return AMF.UML.UML_Visibility_Kind is
55   begin
56      return
57        UML_Packageable_Element_Proxy'Class (Self.all).Get_Visibility.Value;
58   end Get_Visibility;
59
60   --------------------
61   -- Set_Visibility --
62   --------------------
63
64   overriding procedure Set_Visibility
65    (Self : not null access UML_Packageable_Element_Proxy;
66     To   : AMF.UML.Optional_UML_Visibility_Kind) is
67   begin
68      --  [UML241] 7.3.39 PackageableElement (from Kernel)
69      --
70      --  visibility: VisibilityKind [1]
71      --
72      --  Indicates that packageable elements must always have a visibility
73      --  (i.e., visibility is not optional). Redefines
74      --  NamedElement::visibility. Default value is public.
75
76      if To.Is_Empty then
77         raise Constraint_Error;
78      end if;
79
80      AMF.Internals.Tables.UML_Attributes.Internal_Set_Visibility
81       (Self.Element, To);
82   end Set_Visibility;
83
84   --------------------
85   -- Set_Visibility --
86   --------------------
87
88   overriding procedure Set_Visibility
89    (Self : not null access UML_Packageable_Element_Proxy;
90     To   : AMF.UML.UML_Visibility_Kind) is
91   begin
92      UML_Packageable_Element_Proxy'Class
93       (Self.all).Set_Visibility ((False, To));
94   end Set_Visibility;
95
96end AMF.Internals.UML_Packageable_Elements;
97