[mapserver-dev] MapScript support for writing mapfile
fragments tostrings.
Steve Lime
Steve.Lime at dnr.state.mn.us
Tue Jul 21 13:40:48 EDT 2009
Hi Tamas: I think this is a reasonable idea. Amount of work scared me away from it. I'm not aware
of a simple workaround to serialize to a string. Seems to me that there is no need to duplicate
the write... functions, rather just make 'em all write to a buffer. Would be cool to have toString()
support for all objects in MapScript then.
Steve
>>> On 7/18/2009 at 10:25 AM, in message
<f3b73b7d0907180825o1605fa10sfe4f1e342747b522 at mail.gmail.com>, Tamas Szekeres
<szekerest at gmail.com> wrote:
> Hi Devs,
>
> Upon implementing a visual mapfile editor, I'm about to establish a support
> for instant visualizing the corresponding mapfile fragments for the
> mapscript object (for the layerObj especially). This effort would involve
> writing the mapfile fragments to strings something like the reverse of the
> msUpdateXXXFromString functions.
>
> So as to implement such an option we should probably rely on the existing
> serializer functions like writeLayer, writeClass etc. but those functions
> are writing the results to a FILE* streams instead of strings or memory
> buffers.
>
> I'd be curious to know whether we'd have a simple workaround to redirect
> those streams into strings like using the following option when implementing
> a hypothetic writeLayerToString function:
>
>
> 1. Replace fprintf-s with msIO_fprintf-s in writeLayer
> 2. Add writLayerToString to the mapscript API. In writLayerToString Call
> msIO_installStdoutToBuffer before calling writeLayer return the IOContext's
> cbData as string.
>
>
> Or alternatively we could just implement a duplicate of writeLayer to use
> sprintf-s instead of fprintf-s (?)
>
>
> Let me know about your thoughts in this topic whether it's reasonable or
> not?
>
>
>
> Best regards,
>
> Tamas
More information about the mapserver-dev
mailing list