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_Enumeration_Literals is 54 55 ------------------- 56 -- Enter_Element -- 57 ------------------- 58 59 overriding procedure Enter_Element 60 (Self : not null access constant UML_Enumeration_Literal_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_Enumeration_Literal 67 (AMF.UML.Enumeration_Literals.UML_Enumeration_Literal_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_Enumeration_Literal_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_Enumeration_Literal 84 (AMF.UML.Enumeration_Literals.UML_Enumeration_Literal_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_Enumeration_Literal_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_Enumeration_Literal 102 (Visitor, 103 AMF.UML.Enumeration_Literals.UML_Enumeration_Literal_Access (Self), 104 Control); 105 end if; 106 end Visit_Element; 107 108 -------------------- 109 -- Get_Classifier -- 110 -------------------- 111 112 overriding function Get_Classifier 113 (Self : not null access constant UML_Enumeration_Literal_Proxy) 114 return AMF.UML.Enumerations.UML_Enumeration_Access is 115 begin 116 return 117 AMF.UML.Enumerations.UML_Enumeration_Access 118 (AMF.Internals.Helpers.To_Element 119 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Classifier 120 (Self.Element))); 121 end Get_Classifier; 122 123 --------------------- 124 -- Get_Enumeration -- 125 --------------------- 126 127 overriding function Get_Enumeration 128 (Self : not null access constant UML_Enumeration_Literal_Proxy) 129 return AMF.UML.Enumerations.UML_Enumeration_Access is 130 begin 131 return 132 AMF.UML.Enumerations.UML_Enumeration_Access 133 (AMF.Internals.Helpers.To_Element 134 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Enumeration 135 (Self.Element))); 136 end Get_Enumeration; 137 138 --------------------- 139 -- Set_Enumeration -- 140 --------------------- 141 142 overriding procedure Set_Enumeration 143 (Self : not null access UML_Enumeration_Literal_Proxy; 144 To : AMF.UML.Enumerations.UML_Enumeration_Access) is 145 begin 146 AMF.Internals.Tables.UML_Attributes.Internal_Set_Enumeration 147 (Self.Element, 148 AMF.Internals.Helpers.To_Element 149 (AMF.Elements.Element_Access (To))); 150 end Set_Enumeration; 151 152 -------------------- 153 -- Get_Classifier -- 154 -------------------- 155 156 overriding function Get_Classifier 157 (Self : not null access constant UML_Enumeration_Literal_Proxy) 158 return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is 159 begin 160 return 161 AMF.UML.Classifiers.Collections.Wrap 162 (AMF.Internals.Element_Collections.Wrap 163 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Classifier 164 (Self.Element))); 165 end Get_Classifier; 166 167 -------------- 168 -- Get_Slot -- 169 -------------- 170 171 overriding function Get_Slot 172 (Self : not null access constant UML_Enumeration_Literal_Proxy) 173 return AMF.UML.Slots.Collections.Set_Of_UML_Slot is 174 begin 175 return 176 AMF.UML.Slots.Collections.Wrap 177 (AMF.Internals.Element_Collections.Wrap 178 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Slot 179 (Self.Element))); 180 end Get_Slot; 181 182 ----------------------- 183 -- Get_Specification -- 184 ----------------------- 185 186 overriding function Get_Specification 187 (Self : not null access constant UML_Enumeration_Literal_Proxy) 188 return AMF.UML.Value_Specifications.UML_Value_Specification_Access is 189 begin 190 return 191 AMF.UML.Value_Specifications.UML_Value_Specification_Access 192 (AMF.Internals.Helpers.To_Element 193 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Specification 194 (Self.Element))); 195 end Get_Specification; 196 197 ----------------------- 198 -- Set_Specification -- 199 ----------------------- 200 201 overriding procedure Set_Specification 202 (Self : not null access UML_Enumeration_Literal_Proxy; 203 To : AMF.UML.Value_Specifications.UML_Value_Specification_Access) is 204 begin 205 AMF.Internals.Tables.UML_Attributes.Internal_Set_Specification 206 (Self.Element, 207 AMF.Internals.Helpers.To_Element 208 (AMF.Elements.Element_Access (To))); 209 end Set_Specification; 210 211 -------------------------- 212 -- Get_Deployed_Element -- 213 -------------------------- 214 215 overriding function Get_Deployed_Element 216 (Self : not null access constant UML_Enumeration_Literal_Proxy) 217 return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is 218 begin 219 return 220 AMF.UML.Packageable_Elements.Collections.Wrap 221 (AMF.Internals.Element_Collections.Wrap 222 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Deployed_Element 223 (Self.Element))); 224 end Get_Deployed_Element; 225 226 -------------------- 227 -- Get_Deployment -- 228 -------------------- 229 230 overriding function Get_Deployment 231 (Self : not null access constant UML_Enumeration_Literal_Proxy) 232 return AMF.UML.Deployments.Collections.Set_Of_UML_Deployment is 233 begin 234 return 235 AMF.UML.Deployments.Collections.Wrap 236 (AMF.Internals.Element_Collections.Wrap 237 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Deployment 238 (Self.Element))); 239 end Get_Deployment; 240 241 --------------------------- 242 -- Get_Client_Dependency -- 243 --------------------------- 244 245 overriding function Get_Client_Dependency 246 (Self : not null access constant UML_Enumeration_Literal_Proxy) 247 return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is 248 begin 249 return 250 AMF.UML.Dependencies.Collections.Wrap 251 (AMF.Internals.Element_Collections.Wrap 252 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency 253 (Self.Element))); 254 end Get_Client_Dependency; 255 256 ------------------------- 257 -- Get_Name_Expression -- 258 ------------------------- 259 260 overriding function Get_Name_Expression 261 (Self : not null access constant UML_Enumeration_Literal_Proxy) 262 return AMF.UML.String_Expressions.UML_String_Expression_Access is 263 begin 264 return 265 AMF.UML.String_Expressions.UML_String_Expression_Access 266 (AMF.Internals.Helpers.To_Element 267 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression 268 (Self.Element))); 269 end Get_Name_Expression; 270 271 ------------------------- 272 -- Set_Name_Expression -- 273 ------------------------- 274 275 overriding procedure Set_Name_Expression 276 (Self : not null access UML_Enumeration_Literal_Proxy; 277 To : AMF.UML.String_Expressions.UML_String_Expression_Access) is 278 begin 279 AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression 280 (Self.Element, 281 AMF.Internals.Helpers.To_Element 282 (AMF.Elements.Element_Access (To))); 283 end Set_Name_Expression; 284 285 ------------------- 286 -- Get_Namespace -- 287 ------------------- 288 289 overriding function Get_Namespace 290 (Self : not null access constant UML_Enumeration_Literal_Proxy) 291 return AMF.UML.Namespaces.UML_Namespace_Access is 292 begin 293 return 294 AMF.UML.Namespaces.UML_Namespace_Access 295 (AMF.Internals.Helpers.To_Element 296 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace 297 (Self.Element))); 298 end Get_Namespace; 299 300 ------------------------ 301 -- Get_Qualified_Name -- 302 ------------------------ 303 304 overriding function Get_Qualified_Name 305 (Self : not null access constant UML_Enumeration_Literal_Proxy) 306 return AMF.Optional_String is 307 begin 308 declare 309 use type Matreshka.Internals.Strings.Shared_String_Access; 310 311 Aux : constant Matreshka.Internals.Strings.Shared_String_Access 312 := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element); 313 314 begin 315 if Aux = null then 316 return (Is_Empty => True); 317 318 else 319 return (False, League.Strings.Internals.Create (Aux)); 320 end if; 321 end; 322 end Get_Qualified_Name; 323 324 ----------------------------------- 325 -- Get_Owning_Template_Parameter -- 326 ----------------------------------- 327 328 overriding function Get_Owning_Template_Parameter 329 (Self : not null access constant UML_Enumeration_Literal_Proxy) 330 return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is 331 begin 332 return 333 AMF.UML.Template_Parameters.UML_Template_Parameter_Access 334 (AMF.Internals.Helpers.To_Element 335 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter 336 (Self.Element))); 337 end Get_Owning_Template_Parameter; 338 339 ----------------------------------- 340 -- Set_Owning_Template_Parameter -- 341 ----------------------------------- 342 343 overriding procedure Set_Owning_Template_Parameter 344 (Self : not null access UML_Enumeration_Literal_Proxy; 345 To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is 346 begin 347 AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter 348 (Self.Element, 349 AMF.Internals.Helpers.To_Element 350 (AMF.Elements.Element_Access (To))); 351 end Set_Owning_Template_Parameter; 352 353 ---------------------------- 354 -- Get_Template_Parameter -- 355 ---------------------------- 356 357 overriding function Get_Template_Parameter 358 (Self : not null access constant UML_Enumeration_Literal_Proxy) 359 return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is 360 begin 361 return 362 AMF.UML.Template_Parameters.UML_Template_Parameter_Access 363 (AMF.Internals.Helpers.To_Element 364 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter 365 (Self.Element))); 366 end Get_Template_Parameter; 367 368 ---------------------------- 369 -- Set_Template_Parameter -- 370 ---------------------------- 371 372 overriding procedure Set_Template_Parameter 373 (Self : not null access UML_Enumeration_Literal_Proxy; 374 To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is 375 begin 376 AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter 377 (Self.Element, 378 AMF.Internals.Helpers.To_Element 379 (AMF.Elements.Element_Access (To))); 380 end Set_Template_Parameter; 381 382 ---------------- 383 -- Classifier -- 384 ---------------- 385 386 overriding function Classifier 387 (Self : not null access constant UML_Enumeration_Literal_Proxy) 388 return AMF.UML.Enumerations.UML_Enumeration_Access is 389 begin 390 -- Generated stub: replace with real body! 391 pragma Compile_Time_Warning (Standard.True, "Classifier unimplemented"); 392 raise Program_Error with "Unimplemented procedure UML_Enumeration_Literal_Proxy.Classifier"; 393 return Classifier (Self); 394 end Classifier; 395 396 ---------------------- 397 -- Deployed_Element -- 398 ---------------------- 399 400 overriding function Deployed_Element 401 (Self : not null access constant UML_Enumeration_Literal_Proxy) 402 return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is 403 begin 404 -- Generated stub: replace with real body! 405 pragma Compile_Time_Warning (Standard.True, "Deployed_Element unimplemented"); 406 raise Program_Error with "Unimplemented procedure UML_Enumeration_Literal_Proxy.Deployed_Element"; 407 return Deployed_Element (Self); 408 end Deployed_Element; 409 410 ------------------------- 411 -- All_Owning_Packages -- 412 ------------------------- 413 414 overriding function All_Owning_Packages 415 (Self : not null access constant UML_Enumeration_Literal_Proxy) 416 return AMF.UML.Packages.Collections.Set_Of_UML_Package is 417 begin 418 -- Generated stub: replace with real body! 419 pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented"); 420 raise Program_Error with "Unimplemented procedure UML_Enumeration_Literal_Proxy.All_Owning_Packages"; 421 return All_Owning_Packages (Self); 422 end All_Owning_Packages; 423 424 ----------------------------- 425 -- Is_Distinguishable_From -- 426 ----------------------------- 427 428 overriding function Is_Distinguishable_From 429 (Self : not null access constant UML_Enumeration_Literal_Proxy; 430 N : AMF.UML.Named_Elements.UML_Named_Element_Access; 431 Ns : AMF.UML.Namespaces.UML_Namespace_Access) 432 return Boolean is 433 begin 434 -- Generated stub: replace with real body! 435 pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented"); 436 raise Program_Error with "Unimplemented procedure UML_Enumeration_Literal_Proxy.Is_Distinguishable_From"; 437 return Is_Distinguishable_From (Self, N, Ns); 438 end Is_Distinguishable_From; 439 440 --------------- 441 -- Namespace -- 442 --------------- 443 444 overriding function Namespace 445 (Self : not null access constant UML_Enumeration_Literal_Proxy) 446 return AMF.UML.Namespaces.UML_Namespace_Access is 447 begin 448 -- Generated stub: replace with real body! 449 pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented"); 450 raise Program_Error with "Unimplemented procedure UML_Enumeration_Literal_Proxy.Namespace"; 451 return Namespace (Self); 452 end Namespace; 453 454 ------------------------ 455 -- Is_Compatible_With -- 456 ------------------------ 457 458 overriding function Is_Compatible_With 459 (Self : not null access constant UML_Enumeration_Literal_Proxy; 460 P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) 461 return Boolean is 462 begin 463 -- Generated stub: replace with real body! 464 pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented"); 465 raise Program_Error with "Unimplemented procedure UML_Enumeration_Literal_Proxy.Is_Compatible_With"; 466 return Is_Compatible_With (Self, P); 467 end Is_Compatible_With; 468 469 --------------------------- 470 -- Is_Template_Parameter -- 471 --------------------------- 472 473 overriding function Is_Template_Parameter 474 (Self : not null access constant UML_Enumeration_Literal_Proxy) 475 return Boolean is 476 begin 477 -- Generated stub: replace with real body! 478 pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented"); 479 raise Program_Error with "Unimplemented procedure UML_Enumeration_Literal_Proxy.Is_Template_Parameter"; 480 return Is_Template_Parameter (Self); 481 end Is_Template_Parameter; 482 483end AMF.Internals.UML_Enumeration_Literals; 484