1------------------------------------------------------------------------------ 2-- -- 3-- Matreshka Project -- 4-- -- 5-- Ada Modeling Framework -- 6-- -- 7-- Runtime Library Component -- 8-- -- 9------------------------------------------------------------------------------ 10-- -- 11-- Copyright © 2011-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: 2937 $ $Date: 2012-05-01 21:07:27 +0400 (Tue, 01 May 2012) $ 43------------------------------------------------------------------------------ 44with AMF.Elements; 45with AMF.Internals.Element_Collections; 46with AMF.Internals.Helpers; 47with AMF.Internals.Tables.UML_Attributes; 48with AMF.Visitors.UML_Iterators; 49with AMF.Visitors.UML_Visitors; 50with League.Strings.Internals; 51with Matreshka.Internals.Strings; 52 53package body AMF.Internals.UML_Literal_Booleans is 54 55 ------------------- 56 -- Enter_Element -- 57 ------------------- 58 59 overriding procedure Enter_Element 60 (Self : not null access constant UML_Literal_Boolean_Proxy; 61 Visitor : in out AMF.Visitors.Abstract_Visitor'Class; 62 Control : in out AMF.Visitors.Traverse_Control) is 63 begin 64 if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then 65 AMF.Visitors.UML_Visitors.UML_Visitor'Class 66 (Visitor).Enter_Literal_Boolean 67 (AMF.UML.Literal_Booleans.UML_Literal_Boolean_Access (Self), 68 Control); 69 end if; 70 end Enter_Element; 71 72 ------------------- 73 -- Leave_Element -- 74 ------------------- 75 76 overriding procedure Leave_Element 77 (Self : not null access constant UML_Literal_Boolean_Proxy; 78 Visitor : in out AMF.Visitors.Abstract_Visitor'Class; 79 Control : in out AMF.Visitors.Traverse_Control) is 80 begin 81 if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then 82 AMF.Visitors.UML_Visitors.UML_Visitor'Class 83 (Visitor).Leave_Literal_Boolean 84 (AMF.UML.Literal_Booleans.UML_Literal_Boolean_Access (Self), 85 Control); 86 end if; 87 end Leave_Element; 88 89 ------------------- 90 -- Visit_Element -- 91 ------------------- 92 93 overriding procedure Visit_Element 94 (Self : not null access constant UML_Literal_Boolean_Proxy; 95 Iterator : in out AMF.Visitors.Abstract_Iterator'Class; 96 Visitor : in out AMF.Visitors.Abstract_Visitor'Class; 97 Control : in out AMF.Visitors.Traverse_Control) is 98 begin 99 if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then 100 AMF.Visitors.UML_Iterators.UML_Iterator'Class 101 (Iterator).Visit_Literal_Boolean 102 (Visitor, 103 AMF.UML.Literal_Booleans.UML_Literal_Boolean_Access (Self), 104 Control); 105 end if; 106 end Visit_Element; 107 108 --------------- 109 -- Get_Value -- 110 --------------- 111 112 overriding function Get_Value 113 (Self : not null access constant UML_Literal_Boolean_Proxy) 114 return Boolean is 115 begin 116 return 117 AMF.Internals.Tables.UML_Attributes.Internal_Get_Value 118 (Self.Element); 119 end Get_Value; 120 121 --------------- 122 -- Set_Value -- 123 --------------- 124 125 overriding procedure Set_Value 126 (Self : not null access UML_Literal_Boolean_Proxy; 127 To : Boolean) is 128 begin 129 AMF.Internals.Tables.UML_Attributes.Internal_Set_Value 130 (Self.Element, To); 131 end Set_Value; 132 133 -------------- 134 -- Get_Type -- 135 -------------- 136 137 overriding function Get_Type 138 (Self : not null access constant UML_Literal_Boolean_Proxy) 139 return AMF.UML.Types.UML_Type_Access is 140 begin 141 return 142 AMF.UML.Types.UML_Type_Access 143 (AMF.Internals.Helpers.To_Element 144 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Type 145 (Self.Element))); 146 end Get_Type; 147 148 -------------- 149 -- Set_Type -- 150 -------------- 151 152 overriding procedure Set_Type 153 (Self : not null access UML_Literal_Boolean_Proxy; 154 To : AMF.UML.Types.UML_Type_Access) is 155 begin 156 AMF.Internals.Tables.UML_Attributes.Internal_Set_Type 157 (Self.Element, 158 AMF.Internals.Helpers.To_Element 159 (AMF.Elements.Element_Access (To))); 160 end Set_Type; 161 162 --------------------------- 163 -- Get_Client_Dependency -- 164 --------------------------- 165 166 overriding function Get_Client_Dependency 167 (Self : not null access constant UML_Literal_Boolean_Proxy) 168 return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is 169 begin 170 return 171 AMF.UML.Dependencies.Collections.Wrap 172 (AMF.Internals.Element_Collections.Wrap 173 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency 174 (Self.Element))); 175 end Get_Client_Dependency; 176 177 ------------------------- 178 -- Get_Name_Expression -- 179 ------------------------- 180 181 overriding function Get_Name_Expression 182 (Self : not null access constant UML_Literal_Boolean_Proxy) 183 return AMF.UML.String_Expressions.UML_String_Expression_Access is 184 begin 185 return 186 AMF.UML.String_Expressions.UML_String_Expression_Access 187 (AMF.Internals.Helpers.To_Element 188 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression 189 (Self.Element))); 190 end Get_Name_Expression; 191 192 ------------------------- 193 -- Set_Name_Expression -- 194 ------------------------- 195 196 overriding procedure Set_Name_Expression 197 (Self : not null access UML_Literal_Boolean_Proxy; 198 To : AMF.UML.String_Expressions.UML_String_Expression_Access) is 199 begin 200 AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression 201 (Self.Element, 202 AMF.Internals.Helpers.To_Element 203 (AMF.Elements.Element_Access (To))); 204 end Set_Name_Expression; 205 206 ------------------- 207 -- Get_Namespace -- 208 ------------------- 209 210 overriding function Get_Namespace 211 (Self : not null access constant UML_Literal_Boolean_Proxy) 212 return AMF.UML.Namespaces.UML_Namespace_Access is 213 begin 214 return 215 AMF.UML.Namespaces.UML_Namespace_Access 216 (AMF.Internals.Helpers.To_Element 217 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace 218 (Self.Element))); 219 end Get_Namespace; 220 221 ------------------------ 222 -- Get_Qualified_Name -- 223 ------------------------ 224 225 overriding function Get_Qualified_Name 226 (Self : not null access constant UML_Literal_Boolean_Proxy) 227 return AMF.Optional_String is 228 begin 229 declare 230 use type Matreshka.Internals.Strings.Shared_String_Access; 231 232 Aux : constant Matreshka.Internals.Strings.Shared_String_Access 233 := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element); 234 235 begin 236 if Aux = null then 237 return (Is_Empty => True); 238 239 else 240 return (False, League.Strings.Internals.Create (Aux)); 241 end if; 242 end; 243 end Get_Qualified_Name; 244 245 ----------------------------------- 246 -- Get_Owning_Template_Parameter -- 247 ----------------------------------- 248 249 overriding function Get_Owning_Template_Parameter 250 (Self : not null access constant UML_Literal_Boolean_Proxy) 251 return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is 252 begin 253 return 254 AMF.UML.Template_Parameters.UML_Template_Parameter_Access 255 (AMF.Internals.Helpers.To_Element 256 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter 257 (Self.Element))); 258 end Get_Owning_Template_Parameter; 259 260 ----------------------------------- 261 -- Set_Owning_Template_Parameter -- 262 ----------------------------------- 263 264 overriding procedure Set_Owning_Template_Parameter 265 (Self : not null access UML_Literal_Boolean_Proxy; 266 To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is 267 begin 268 AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter 269 (Self.Element, 270 AMF.Internals.Helpers.To_Element 271 (AMF.Elements.Element_Access (To))); 272 end Set_Owning_Template_Parameter; 273 274 ---------------------------- 275 -- Get_Template_Parameter -- 276 ---------------------------- 277 278 overriding function Get_Template_Parameter 279 (Self : not null access constant UML_Literal_Boolean_Proxy) 280 return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is 281 begin 282 return 283 AMF.UML.Template_Parameters.UML_Template_Parameter_Access 284 (AMF.Internals.Helpers.To_Element 285 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter 286 (Self.Element))); 287 end Get_Template_Parameter; 288 289 ---------------------------- 290 -- Set_Template_Parameter -- 291 ---------------------------- 292 293 overriding procedure Set_Template_Parameter 294 (Self : not null access UML_Literal_Boolean_Proxy; 295 To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is 296 begin 297 AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter 298 (Self.Element, 299 AMF.Internals.Helpers.To_Element 300 (AMF.Elements.Element_Access (To))); 301 end Set_Template_Parameter; 302 303 ------------------- 304 -- Boolean_Value -- 305 ------------------- 306 307 overriding function Boolean_Value 308 (Self : not null access constant UML_Literal_Boolean_Proxy) 309 return Boolean is 310 begin 311 -- Generated stub: replace with real body! 312 pragma Compile_Time_Warning (Standard.True, "Boolean_Value unimplemented"); 313 raise Program_Error with "Unimplemented procedure UML_Literal_Boolean_Proxy.Boolean_Value"; 314 return Boolean_Value (Self); 315 end Boolean_Value; 316 317 ------------------- 318 -- Is_Computable -- 319 ------------------- 320 321 overriding function Is_Computable 322 (Self : not null access constant UML_Literal_Boolean_Proxy) 323 return Boolean is 324 begin 325 -- Generated stub: replace with real body! 326 pragma Compile_Time_Warning (Standard.True, "Is_Computable unimplemented"); 327 raise Program_Error with "Unimplemented procedure UML_Literal_Boolean_Proxy.Is_Computable"; 328 return Is_Computable (Self); 329 end Is_Computable; 330 331 ------------------- 332 -- Boolean_Value -- 333 ------------------- 334 335 overriding function Boolean_Value 336 (Self : not null access constant UML_Literal_Boolean_Proxy) 337 return AMF.Optional_Boolean is 338 begin 339 -- Generated stub: replace with real body! 340 pragma Compile_Time_Warning (Standard.True, "Boolean_Value unimplemented"); 341 raise Program_Error with "Unimplemented procedure UML_Literal_Boolean_Proxy.Boolean_Value"; 342 return Boolean_Value (Self); 343 end Boolean_Value; 344 345 ------------------------ 346 -- Is_Compatible_With -- 347 ------------------------ 348 349 overriding function Is_Compatible_With 350 (Self : not null access constant UML_Literal_Boolean_Proxy; 351 P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) 352 return Boolean is 353 begin 354 -- Generated stub: replace with real body! 355 pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented"); 356 raise Program_Error with "Unimplemented procedure UML_Literal_Boolean_Proxy.Is_Compatible_With"; 357 return Is_Compatible_With (Self, P); 358 end Is_Compatible_With; 359 360 ------------------------- 361 -- All_Owning_Packages -- 362 ------------------------- 363 364 overriding function All_Owning_Packages 365 (Self : not null access constant UML_Literal_Boolean_Proxy) 366 return AMF.UML.Packages.Collections.Set_Of_UML_Package is 367 begin 368 -- Generated stub: replace with real body! 369 pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented"); 370 raise Program_Error with "Unimplemented procedure UML_Literal_Boolean_Proxy.All_Owning_Packages"; 371 return All_Owning_Packages (Self); 372 end All_Owning_Packages; 373 374 ----------------------------- 375 -- Is_Distinguishable_From -- 376 ----------------------------- 377 378 overriding function Is_Distinguishable_From 379 (Self : not null access constant UML_Literal_Boolean_Proxy; 380 N : AMF.UML.Named_Elements.UML_Named_Element_Access; 381 Ns : AMF.UML.Namespaces.UML_Namespace_Access) 382 return Boolean is 383 begin 384 -- Generated stub: replace with real body! 385 pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented"); 386 raise Program_Error with "Unimplemented procedure UML_Literal_Boolean_Proxy.Is_Distinguishable_From"; 387 return Is_Distinguishable_From (Self, N, Ns); 388 end Is_Distinguishable_From; 389 390 --------------- 391 -- Namespace -- 392 --------------- 393 394 overriding function Namespace 395 (Self : not null access constant UML_Literal_Boolean_Proxy) 396 return AMF.UML.Namespaces.UML_Namespace_Access is 397 begin 398 -- Generated stub: replace with real body! 399 pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented"); 400 raise Program_Error with "Unimplemented procedure UML_Literal_Boolean_Proxy.Namespace"; 401 return Namespace (Self); 402 end Namespace; 403 404 --------------------------- 405 -- Is_Template_Parameter -- 406 --------------------------- 407 408 overriding function Is_Template_Parameter 409 (Self : not null access constant UML_Literal_Boolean_Proxy) 410 return Boolean is 411 begin 412 -- Generated stub: replace with real body! 413 pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented"); 414 raise Program_Error with "Unimplemented procedure UML_Literal_Boolean_Proxy.Is_Template_Parameter"; 415 return Is_Template_Parameter (Self); 416 end Is_Template_Parameter; 417 418end AMF.Internals.UML_Literal_Booleans; 419