[Qt-interest] what is wrong with this Complex Data Structure

Meir Yanovich meiry242 at gmail.com
Tue May 11 10:49:31 CEST 2010


Hi
Thanks for the tip , and yes i will use data-type in the final code , this
is only test
by the way i will happy to hear about ideas on best way to store JSON in
Structure
maybe it need different thread ?

On Tue, May 11, 2010 at 11:29 AM, Andre Somers <andre at familiesomers.nl>wrote:

>  On 11-5-2010 10:22, Meir Yanovich wrote:
>
> i guess i need glasses , and more coffee
> sorry
> ):
> Thanks
>
>
> Small tip:
> use typedefs for such nested template types. Makes it much easier to read
> and write your code in the end.
>
> So, instead of writing
>
>     QMap<QString,QList<QMap<QString,QString > > > ResultMap;
>     QList<QMap<QString,QString > > result_set;
>
> you could write something like:
>
> //somewhere in a header
> typedef Result QMap<QString, QString>;
> typedef ResultList QList<Result>;
> typedef ResultListMap QMap<QString, ResultList>;
>
> //in your source;
> ResultListMap resultMap;
> ResultList resultList;
>
>
>   for(int i = 3;i<3;i++)
>     {
>        Result result("www","wwwww");
>        resultList.append(result);
>     }
>
> This also makes passing these things in functions much more readable.
>
> André
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100511/aa222168/attachment.html 


More information about the Qt-interest-old mailing list