[Development] QLocale private members

2012-03-04 Thread John Layt
Hi,

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?

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.

Cheers!

John.
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] QLocale private members

2012-03-04 Thread Thiago Macieira
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


signature.asc
Description: This is a digitally signed message part.
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development