On Sat, 8 Jan 100, Andre Poenitz wrote:
> > How do we define/interpret property strings?
>
> <objectname prop1="...." prop2="..." ... />
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> or just this part.
> This way it could be read by something that reads XML, too ;-)
Which is mainly why I wrote it like:
> > "target=PRINTER p_name=lp1 reverse_order=true count_copies=5"
in the first place. I was thinking of libxml although from what I've seen
of it it looks a bit confusing and much lower level than I expected. Then
again I'm not sure what I want from libxml anyway.
> > constructor and I'm wondering if there's a neater way. Maybe a generic
> > Lexer (a template?) that given a struct and a table of keyword_items (like
> > LyXLex uses) could fill in any arbitrary struct.
>
> You could fill a mapping prop->value first and extract ints... later.
Yes but I'm trying to avoid having to write almost identical code for each
new data struct that comes along where we end up cutting and pasting from
a previous similar implementation to make the job quicker. I was hoping
to come up with either a very generic generator that sorted everything at
runtime (and was just a single code entity) but instead it's probably
easier and much safer (typesafer in particular) to generate the code using
m4 with autogen.sh. Then again maybe I've been on the gtk-- list too long
and their code generation fetishes are contagious.
> You could look at it the other way round. Instead of taking a property
> string and try to construct any object from it, default-construct and
> let the object read its contents from the property "string"...
I thought that's what my sample code at the bottom of my original email
did :-)
Allan. (ARRae)