Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | s_expressions-enumeration_io: improve argument names of the new Value primitive | 
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk | 
| Files: | files | file ages | folders | 
| SHA1: | 
c7fcf143637021b06086b401ad6dde99 | 
| User & Date: | nat 2019-04-09 18:56:41.434 | 
Context
| 
   2019-04-10 
 | ||
| 19:49 | s_expressions-enumeration_io-tests: test Value of invalid enum atoms check-in: b63c559d17 user: nat tags: trunk | |
| 
   2019-04-09 
 | ||
| 18:56 | s_expressions-enumeration_io: improve argument names of the new Value primitive check-in: c7fcf14363 user: nat tags: trunk | |
| 
   2019-04-08 
 | ||
| 21:24 | s_expressions-enumeration_io: add a Value primitive with default check-in: a5f4c35865 user: nat tags: trunk | |
Changes
Changes to src/natools-s_expressions-enumeration_io.adb.
| ︙ | ︙ | |||
57 58 59 60 61 62 63  | 
      end Image;
      function Value (Data : Atom) return Enum is
      begin
         return Enum'Value (To_Image (Data));
      end Value;
 | | |  | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75  | 
      end Image;
      function Value (Data : Atom) return Enum is
      begin
         return Enum'Value (To_Image (Data));
      end Value;
      function Value (Data : Atom; Fallback : Enum) return Enum is
         Img : constant String := To_Image (Data);
      begin
         return Enum'Value (Img);
      exception
         when Constraint_Error =>
            return Fallback;
      end Value;
   end Typed_IO;
end Natools.S_Expressions.Enumeration_IO;
 | 
Changes to src/natools-s_expressions-enumeration_io.ads.
| ︙ | ︙ | |||
37 38 39 40 41 42 43  | 
      function Image (T : Enum) return Atom;
         --  Convert an enumeration value into an atom
      function Value (Data : Atom) return Enum;
         --  Convert an atom into an enumeration value
 | | |  | 37 38 39 40 41 42 43 44 45 46 47 48 49 50  | 
      function Image (T : Enum) return Atom;
         --  Convert an enumeration value into an atom
      function Value (Data : Atom) return Enum;
         --  Convert an atom into an enumeration value
      function Value (Data : Atom; Fallback : Enum) return Enum;
         --  Convert an atom into an enumeration value,
         --  with a fallback value on invalid atom images
   end Typed_IO;
end Natools.S_Expressions.Enumeration_IO;
 |