1
2
3
4
5
6
7
8
9
|
------------------------------------------------------------------------------
-- Copyright (c) 2015, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
|
|
|
1
2
3
4
5
6
7
8
9
|
------------------------------------------------------------------------------
-- Copyright (c) 2015-2019, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
|
56
57
58
59
60
61
62
63
64
65
66
|
return To_Atom (Enum'Image (T));
end Image;
function Value (Data : Atom) return Enum is
begin
return Enum'Value (To_Image (Data));
end Value;
end Typed_IO;
end Natools.S_Expressions.Enumeration_IO;
|
>
>
>
>
>
>
>
>
>
|
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
return To_Atom (Enum'Image (T));
end Image;
function Value (Data : Atom) return Enum is
begin
return Enum'Value (To_Image (Data));
end Value;
function Value (Data : Atom; Default : Enum) return Enum is
Img : constant String := To_Image (Data);
begin
return Enum'Value (Img);
exception
when Constraint_Error =>
return Default;
end Value;
end Typed_IO;
end Natools.S_Expressions.Enumeration_IO;
|