help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Something like an array (list) of a class


From: Decebal
Subject: Re: Something like an array (list) of a class
Date: Sun, 12 Apr 2009 00:25:17 -0700 (PDT)
User-agent: G2/1.0

On Apr 11, 10:08 am, address@hidden wrote:
> > I would like to make some datadriven functionality. Is there a way to
> > make sure a list is filled with a certain type of data. I would like
> > to make sure that every element of my list contains: a type, a
> > description, a functionname and room to store a string. Is this
> > possible?
>
> Maybe that help?
> ,----
> | ELISP> (setq B '(2 "some text" message nil))
> | (2 "some text" message nil)
> |
> | ELISP> (if (and (find-if 'numberp B)
> |                 (find-if 'stringp B)
> |                 (find-if 'functionp B)
> |                 (null (car (last B))))
> |            t
> |            nil)
> | t
> `----

Partly. This is an 'object' and not a list of objects. But I
understand correctly that it is not possible to define real objects?
What I would like is something like (C++ code):

class Object {
    String type;
    String description;
    String functionname;
    String displayString;
}

std::vector <Object> objectVector;

When given a certain type I then need to retreive the 'object' from
the list to use.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]