comp.lang.ada
 help / color / mirror / Atom feed
From: Gautier write-only <gautier_niouzes@hotmail.com>
Subject: Re: Question on array of strings
Date: Thu, 29 Oct 2009 15:46:36 -0700 (PDT)
Date: 2009-10-29T15:46:36-07:00	[thread overview]
Message-ID: <80b616b3-15f4-4a0a-802a-c7d3a345e051@p8g2000yqb.googlegroups.com> (raw)
In-Reply-To: b9669986-5b06-4805-9ce3-404b9af7f666@k4g2000yqb.googlegroups.com

Hello!

My usual way of doing that is:

function Event_To_String(Event : in Events_Type) return String is
begin
  case Event is
    when Ev1 => return "ev3434";
    when Ev2 => return "evEnd";
  end case;
end;

You live longer without pointer ;-).

For more complicated cases, I use unbounded strings, like there:

  type External_packer_info is record
    name, title, URL, options: Unbounded_String;
    expanded_options    : Unbounded_String;
    -- options with dynamically expanded tokens
    made_by_version     : Unsigned_16;
    pkzm                : Zip.PKZip_method;
  end record;

  ext: array(External) of External_packer_info:=
    (
      (U("zip.exe"), U("Zip"), U("http://info-zip.org/"), U("-9"), U
(""), 20, Zip.deflate),
       -- Zip 2.32 or later
      ...
     );

HTH
_________________________________________________________
Gautier's Ada programming -- http://sf.net/users/gdemont/
NB: For a direct answer, e-mail address on the Web site!



      parent reply	other threads:[~2009-10-29 22:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-29 20:48 Question on array of strings Peter Mueller
2009-10-29 21:36 ` Jeffrey R. Carter
2009-10-29 21:42   ` Hibou57 (Yannick Duchêne)
2009-10-29 22:58     ` Jeffrey R. Carter
2009-10-29 21:38 ` Hibou57 (Yannick Duchêne)
2009-10-30  0:12   ` Robert A Duff
2009-10-30  9:10   ` Peter Mueller
2009-10-30 10:14     ` Hibou57 (Yannick Duchêne)
2009-10-29 22:46 ` Gautier write-only [this message]
replies disabled

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