[mapserver-dev] typedef struct versus struct in mapserver.h

Even Rouault even.rouault at spatialys.com
Sun May 24 13:56:51 PDT 2020

On dimanche 24 mai 2020 21:33:25 CEST Seth G wrote:
> Hi all,
> While going through documenting the various objects available in MapScript I
> notice some objects in mapserver.h are declared:
> typedef struct {
> ..
> } symbolSetObj;
> and some are declared:
> struct styleObj{
> ...
> }
> The former has the minor benefit the class can be documented by SWIG within
> the struct, whereas the latter must be documented before it. Does anyone
> know if there is a reason for the differences?
> It would be nice to have them using a consistent declaration but changing
> classObj to the first style breaks the code (see branch at [1]) due to
> redefinitions in the mapserver-api.h (which is the "public MapServer API"
> as described on the mailing list post [2]). Maybe best to leave alone if
> this API is used throughout other projects [3]? Or is there a way to easily
> update the public API?

I don't think this public API is much used, if it used at all outside of MapServer, given that it 
looks to be only embryonic. That said, the intent was good, and having the opaque typedef in 
mapserver-api.h was a good principle. It doesn't look to me to be a big deal to have the doc 
for the struct to be before it. I find this even a bit cleaner / closer to Doxygen.

Speaking about that, having SWIG docstring in .h is a bit messy. Have you considered using 
Doxygen instead ? It looks from http://www.swig.org/Doc4.0/Doxygen.html that there might 
be a possibility to make SWIG extra from Doxygen, but I didn't try it. Sorry if this has been 
discussed before and I didn't catch up.

Spatialys - Geospatial professional services
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20200524/c88e88b2/attachment.html>

More information about the mapserver-dev mailing list