[mapserver-dev] MapScript support for writing mapfile fragments to strings.

Tamas Szekeres szekerest at gmail.com
Sat Jul 18 11:25:29 EDT 2009


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20090718/72cff068/attachment.html


More information about the mapserver-dev mailing list