Debian Codegraph @

gcc/ada/libgnat/g-cppexc.ads

raw
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- G N A T . C P P _ E X C E P T I O N S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2013-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 provides an interface for raising and handling C++ exceptions
33
34 with System;
35 with Ada.Exceptions; use Ada.Exceptions;
36 with GNAT.CPP.Std; use GNAT.CPP.Std;
37
38 package GNAT.CPP_Exceptions is
39 generic
40 type T is private;
41 procedure Raise_Cpp_Exception (Id : Exception_Id; Value : T);
42 -- Raise a C++ exception identified by Id. Associate Value with this
43 -- occurrence. Id must refer to an exception that has the Cpp convention.
44
45 function Get_Object_Address
46 (X : Exception_Occurrence) return System.Address;
47 -- Extract the address of the object associated with X. The
48 -- exception of the occurrence X must have a Cpp Convention. When
49 -- the exception handler catches a base type of the raised object,
50 -- the returned address is that of the base type part of the
51 -- object, the type explicitly expected by the handler.
52
53 generic
54 type T is private;
55 function Get_Object (X : Exception_Occurrence) return T;
56 -- Extract the object associated with X. The exception of the
57 -- occurrence X must have a Cpp Convention. When the exception
58 -- handler catches a base type of the raised object, the returned
59 -- object is (a copy of) the base type portion of the object.
60
61 generic
62 type T is limited private;
63 function Get_Access_To_Object (X : Exception_Occurrence)
64 return access T;
65 -- Extract the object associated with X. The exception of the
66 -- occurrence X must have a Cpp Convention. When the exception
67 -- handler catches a base type of the raised object, access is
68 -- returned to the base type part of the object, the type
69 -- explicitly expected by the handler.
70
71 generic
72 type T is abstract tagged limited private;
73 function Get_Access_To_Tagged_Object (X : Exception_Occurrence)
74 return access T'Class;
75 -- Extract the object associated with X. The exception of the
76 -- occurrence X must have a Cpp Convention. When the exception
77 -- handler catches a base type of the raised object, access is
78 -- returned to the base type part of the object, the type
79 -- explicitly expected by the handler.
80
81 function Get_Type_Info (X : Exception_Occurrence) return Type_Info_Ptr;
82 -- Obtain the type information of the full C++ object raised as X.
83 -- When the exception is caught using a base-type match exception,
84 -- this may be a derived class from that named for the exception.
85
86 function Get_Type_Info (Id : Exception_Id) return Type_Info_Ptr;
87 -- Obtain the type information of a C++ exception type. This will
88 -- be the std::type_info object named in the exception
89 -- declaration, even if ID is taken from an exception occurrence
90 -- containing an object of a derived type.
91
92 end GNAT.CPP_Exceptions;