comp.lang.ada
 help / color / mirror / Atom feed
From: Sébastien <seb.morand@gmail.com>
Subject: Re: String declaration and initialization
Date: Fri, 23 May 2008 09:33:44 +0000
Date: 2008-05-23T09:33:44+00:00	[thread overview]
Message-ID: <48368F78.1010604@gmail.com> (raw)
In-Reply-To: 


> No. Make a record of the test name and the test type:
> 
> declare
>    type Test_Type is range 1..20;
>    type Test_Case (Length : Positive) is record
>       Kind : Test_Type;
>       Name : String (1..Length);
>    end record;
>    function Test return Test_Case is -- Ada has scoped subprograms
>    begin
>       case Some_Test is
>          when Test_1 => return (Length => 5, Name => "Test1", Kind => 3);
>          ...
>       end case;
>    end Test;
>    Buffer: constant Test_Case := Test;
>  begin
>     My_Treatment_1 (Buffer.Name);
> 
> [ Observe, that the function Test is nothing but a classical factory. ]

Ok got it, I like this one, nice and efficient.

Thanks for your help.

Sebastien



  reply	other threads:[~2008-05-23  9:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-22 15:47 String declaration and initialization Sébastien
2008-05-22 16:05 ` Dmitry A. Kazakov
2008-05-22 16:47   ` Sébastien
2008-05-23  8:18     ` Dmitry A. Kazakov
2008-05-23  9:33       ` Sébastien [this message]
2008-05-22 16:16 ` Matthew Heaney
2008-05-22 16:58   ` Sébastien
2008-05-22 17:11     ` Robert A Duff
2008-05-22 18:16     ` Matthew Heaney
2008-05-22 20:01     ` Jeffrey R. Carter
2008-05-22 16:40 ` Jean-Pierre Rosen
2008-05-22 18:09 ` Martin Krischik
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox