From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Access types to records containing strings
Date: Sat, 29 Jan 2005 11:03:05 +0100
Date: 2005-01-29T11:03:05+01:00 [thread overview]
Message-ID: <8uvcyoh3nvbe$.fy9vv8opob1a.dlg@40tude.net> (raw)
In-Reply-To: 3611gpF4qnb9hU1@individual.net
On Sat, 29 Jan 2005 09:58:55 +0100, Stefan Merwitz wrote:
> it's me again. I need to implement a list containing strings using
> access types. Is there a way to implement this using variable length
> strings:
>
> private type list;
> private type listobject is record
> sContent: string(1..30);
> Next := list;
> end record;
> private type list is access listobject;
>
> With the knowledge I have till now, I think it's only possible with
> fixed length strings. Am I right or is there any other way?
type List_Object;
type List is access List_Object;
type List_Object (Length : Natural) is record
Content : String (1..Length);
Next : List;
end record;
or else
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
...
type List_Object;
type List is access List_Object;
type List_Object is record
Content : Unbounded_String;
Next : List;
end record;
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2005-01-29 10:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-29 8:58 Access types to records containing strings Stefan Merwitz
2005-01-29 9:32 ` Martin Krischik
2005-01-29 10:03 ` Dmitry A. Kazakov [this message]
2005-02-15 12:17 ` Xavier Serrand
2005-02-15 13:20 ` Dmitry A. Kazakov
2005-02-15 16:18 ` Matthew Heaney
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox