comp.lang.ada
 help / color / mirror / Atom feed
From: xavier.serrand@free.fr (Xavier Serrand)
Subject: Re: Access types to records containing strings
Date: 15 Feb 2005 04:17:13 -0800
Date: 2005-02-15T04:17:13-08:00	[thread overview]
Message-ID: <344d0fee.0502150417.39d1d782@posting.google.com> (raw)
In-Reply-To: 8uvcyoh3nvbe$.fy9vv8opob1a.dlg@40tude.net

Hello Dmitry,

Why no use pointer to string !!

type T_Ptr_String is access String;

And now your strings can have the length you want ... but you should
define function to construct your strings tha way (make something like
a class in a package and use it)

It should be as or more flexible than the unbounded strings...

Is it usefull?

Xavier

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message news:<8uvcyoh3nvbe$.fy9vv8opob1a.dlg@40tude.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;



  reply	other threads:[~2005-02-15 12:17 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
2005-02-15 12:17   ` Xavier Serrand [this message]
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