Natools

natools-s_expressions-templates-generic_discrete_render.ads at [3b9dae1e75]
Login

File src/natools-s_expressions-templates-generic_discrete_render.ads artifact 6aed9b558e part of check-in 3b9dae1e75


------------------------------------------------------------------------------
-- Copyright (c) 2014, 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         --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR  --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES   --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN    --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF  --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.           --
------------------------------------------------------------------------------

------------------------------------------------------------------------------
-- Natools.S_Expressions.Templates.Generic_Discrete_Render provides a       --
-- S-expression template renderer for discrete types.                       --
-- The template is a list of atoms, representing images in the order of the --
-- formal discrete type, optionally followed by a list whose atoms are      --
-- concatenated to form a fallback image for all others values. When        --
-- fallback image is not provided, formal Default_Image function is used.   --
------------------------------------------------------------------------------

with Ada.Streams;
with Natools.S_Expressions.Lockable;

generic
   type T is (<>);
   with function Default_Image (Object : T) return String is T'Image;
   with function "=" (Left, Right : T) return Boolean is <>;
procedure Natools.S_Expressions.Templates.Generic_Discrete_Render
  (Output : in out Ada.Streams.Root_Stream_Type'Class;
   Template : in out Lockable.Descriptor'Class;
   Value : in T);
pragma Preelaborate (Natools.S_Expressions.Templates.Generic_Discrete_Render);