Re: Access types to records containing strings
From: Xavier Serrand (xavier.serrand_at_free.fr)
Date: 02/15/05
- Next message: Dmitry A. Kazakov: "Re: pointers and genericity"
- Previous message: Xavier Serrand: "pointers and genericity"
- Next in thread: Dmitry A. Kazakov: "Re: Access types to records containing strings"
- Reply: Dmitry A. Kazakov: "Re: Access types to records containing strings"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 15 Feb 2005 04:17:13 -0800
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;
- Next message: Dmitry A. Kazakov: "Re: pointers and genericity"
- Previous message: Xavier Serrand: "pointers and genericity"
- Next in thread: Dmitry A. Kazakov: "Re: Access types to records containing strings"
- Reply: Dmitry A. Kazakov: "Re: Access types to records containing strings"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|