comp.lang.ada
 help / color / mirror / Atom feed
From: daelen@my-deja.com
Subject: attributes in generic procedure
Date: 1999/11/21
Date: 1999-11-21T00:00:00+00:00	[thread overview]
Message-ID: <818esd$t6l$1@nnrp1.deja.com> (raw)

I would like to create a generic procedure as shown below which will only be
used for scalar types. Does anybody have a hint how to accomplish this?

generic
   type A_Type is private;
procedure Update (Par : in out A_Type; Value : String);
procedure Update (Par : in out A_Type; Value : String) is
begin
   if Value = "+" then
      if Par = A_Type'Last then
         Par := A_Type'First;
      else
         Par := A_Type'Succ (Par);
      end if;
   elsif Value = "++" then
      Par := A_Type'Last;
   elsif Value = "-" then
      if Par = A_Type'First then
         Par := A_Type'Last;
      else
         Par := A_Type'Pred (Par);
      end if;
   elsif Value = "--" then
      Par := A_Type'First;
   elsif Value /= "" then
      Par := A_Type'Value (Value);
   end if;
end Update;


Sent via Deja.com http://www.deja.com/
Before you buy.




             reply	other threads:[~1999-11-21  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-21  0:00 daelen [this message]
1999-11-21  0:00 ` attributes in generic procedure Matthew Heaney
1999-11-25  0:00 ` Nick Roberts
1999-11-29  0:00   ` Niklas Holsti
1999-11-29  0:00     ` Robert Dewar
1999-12-03  0:00       ` Nick Roberts
replies disabled

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