Debian Codegraph @

gcc/ada/libgnat/g-cppstd.adb

raw
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- G N A T . C P P . S T D --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 2022-2025, AdaCore --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
31
32 -- This package may provide an Ada interface for some C++ standard
33 -- entities in the std namespace.
34
35 with GNAT.CPP.Std.Type_Info;
36 with Ada.Unchecked_Conversion;
37 with Interfaces.C.Strings; use Interfaces.C.Strings;
38
39 package body GNAT.CPP.Std is
40 ----------------------
41 -- To_Type_Info_Ptr --
42 ----------------------
43
44 function To_Type_Info_Ptr (S : System.Address) return Type_Info_Ptr is
45 function Impl is
46 new Ada.Unchecked_Conversion (System.Address, Type_Info_Ptr);
47 begin
48 return Impl (S);
49 end To_Type_Info_Ptr;
50
51 ------------
52 -- Name --
53 ------------
54
55 function Name (this : Type_Info_Ptr)
56 return String
57 is (Value (this.all.Name));
58
59 ---------------
60 -- Before ---
61 ---------------
62
63 function Before (this, that : Type_Info_Ptr)
64 -- return Interfaces.C.Extensions.bool;
65 return Boolean
66 is (this.all.Before (that));
67
68 ---------------
69 -- Equals ---
70 ---------------
71
72 function Equals (this, that : Type_Info_Ptr)
73 -- return Interfaces.C.Extensions.bool;
74 return Boolean
75 is (this.all.Equals (that));
76
77 --------------------
78 -- Is_Pointer_P --
79 --------------------
80
81 function Is_Pointer_P (this : Type_Info_Ptr)
82 return Interfaces.C.Extensions.bool
83 is (this.all.Is_Pointer_P);
84
85 ---------------------
86 -- Is_Function_P --
87 ---------------------
88
89 function Is_Function_P (this : Type_Info_Ptr)
90 return Interfaces.C.Extensions.bool
91 is (this.all.Is_Function_P);
92
93 ----------------
94 -- Do_Catch ---
95 ----------------
96
97 function Do_Catch
98 (this : Type_Info_Ptr;
99 thrown_type : Type_Info_Ptr;
100 thrown_object : in out System.Address;
101 outer_count : Interfaces.C.unsigned)
102 return Interfaces.C.Extensions.bool
103 is (this.all.Do_Catch (thrown_type, thrown_object, outer_count));
104
105 -----------------
106 -- Do_Upcast ---
107 -----------------
108
109 function Do_Upcast
110 (this : Type_Info_Ptr;
111 target : Type_Info_Ptr;
112 obj_ptr : in out System.Address)
113 return Interfaces.C.Extensions.bool
114 is (this.all.Do_Upcast (target, obj_ptr));
115
116 end GNAT.CPP.Std;