[Development] QLocale private members

Thiago Macieira thiago.macieira at intel.com
Mon Mar 5 00:55:42 CET 2012


On domingo, 4 de março de 2012 23.49.03, John Layt wrote:
> In the QLocale header we have the following code:
> 
>     //private:
>     // this should be private, but can't be
>         struct Data {
>             quint16 index;
>             quint16 numberOptions;
>         };
>     private:
>         friend struct QLocalePrivate;
>         // ### We now use this field to pack an index into locale_data
>         //     and NumberOptions.
>         // ### Qt 5: change to a QLocaleData *d; uint numberOptions.
>         union {
>             void *v;
>             Data p;
>         };
>         const QLocalePrivate *d() const;
> 
> 
> Can anyone enlighten me about why this is organised this way and what the
> plan was for Qt5?

It was like that because in Qt 4.0, a QLocale could only refer to one of the 
many internal locales, which are fully defined by those two numbers. Somewhere 
along the way, we needed to store more information, which is where the void 
pointer appeared.

Note that a pointer is bigger than two quint16 variables on 64-bit archs, so 
either we broke BC or that void* was there in 4.0.

> I'd like to clean this up for 5.0 and try have only a *d as in 5.1 we'll get
> rid of the locale_data and use libicu instead.

Go ahead, make it the best possible for referring to the ICU data, without 
compromising future extensions. Also note you want to remove the inline 
operator==.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120304/d0ef80cd/attachment.sig>


More information about the Development mailing list