<div dir="ltr"><div dir="ltr"><div>Hi,</div><div><br></div><div>please have a look to <a href="https://github.com/qgis/QGIS/pull/9832">https://github.com/qgis/QGIS/pull/9832</a></div><br></div><div dir="ltr">I think it's a good opportunity to start (or re-start in case i missed it) a discussion about:</div><div dir="ltr"><br></div><div dir="ltr">1. introducing new libraries where QT already provides an implementation when there is a good reason to</div><div>2. using STL and other "modern C++" idioms and deviate from QT when there is a good reason to<br></div><div><br></div><div>In the particular case of this PR I started from the consideration that generating json "manually" by string concatenation was not a good idea because it is error prone and not particularly efficient.</div><div>So i started by using QJson* from QT but it was not only very slow but also it used an ugly syntax.</div><div><br></div><div>Moreover, json is becoming the preferred format especially for OGC API (wfs3) and it is therefore important that we have a solid, efficient and easy to use library for our json operations.</div><div><br></div><div>But, the library that IMO suited best the needs is not from the QT ecosystem, for example, it uses std::string instead of QString, this is not a problem for QGIS server because it already has overrides that take C strings through QIODevive (note that despite the small overhead for the conversion to/from QString, the new json implementation is still faster than QJson). <br></div><div>To avoid unnecessary QString<->srd::string conversions, there will probably be more server-specific overrides in the future.</div><div><br></div><div>Even if I started this work with the server in mind, similar considerations will probably apply to some extent to the desktop as well.</div><div><br></div><div>The STL discussion is somewhat related (deviating from QT) but it is an independent topic, I think we already started to deviate from QT when we introduced std::unique_ptr, but I'd really like to go further and see more automatic memory management and more usage of something like (a bit verbose without typedefs):<br></div><div><br></div><div>std::unique_ptr<std::vector<std::unique_ptr<QgsSomeCoreClass>>></div><div><br></div><div>This of course introduce problems with SIP bindings but this is another story and we could start by using those idioms for internal implementation and not for the API.</div><div><br></div><div>I'd be interested in what you guys think about these topics, I'm pretty sure you have also thought about it some times.<br></div><div><br></div><div>Thanks in advance for your feedback!<br></div><div><br></div><div dir="ltr">-- <br><div dir="ltr" class="gmail_signature">Alessandro Pasotti<br>w3:   <a href="http://www.itopen.it" target="_blank">www.itopen.it</a></div></div></div>