mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 19:02:59 +00:00
QVariant, QByteArrayMatcher, QListData and QString cleanup
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
32406e8e86
commit
d6f5721d4c
5 changed files with 5 additions and 35 deletions
|
@ -76,7 +76,6 @@ class QTextFormat;
|
||||||
class QTextLength;
|
class QTextLength;
|
||||||
class QUrl;
|
class QUrl;
|
||||||
class QVariant;
|
class QVariant;
|
||||||
class QVariantComparisonHelper;
|
|
||||||
class QDebug;
|
class QDebug;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -375,7 +374,6 @@ protected:
|
||||||
friend inline bool qvariant_cast_helper(const QVariant &, QVariant::Type, void *);
|
friend inline bool qvariant_cast_helper(const QVariant &, QVariant::Type, void *);
|
||||||
friend int qRegisterGuiVariant();
|
friend int qRegisterGuiVariant();
|
||||||
friend int qUnregisterGuiVariant();
|
friend int qUnregisterGuiVariant();
|
||||||
friend inline bool operator==(const QVariant &, const QVariantComparisonHelper &);
|
|
||||||
#ifndef QT_NO_DEBUG_STREAM
|
#ifndef QT_NO_DEBUG_STREAM
|
||||||
friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QVariant &);
|
friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QVariant &);
|
||||||
#endif
|
#endif
|
||||||
|
@ -452,30 +450,6 @@ Q_CORE_EXPORT QDataStream& operator>> (QDataStream& s, QVariant::Type& p);
|
||||||
Q_CORE_EXPORT QDataStream& operator<< (QDataStream& s, const QVariant::Type p);
|
Q_CORE_EXPORT QDataStream& operator<< (QDataStream& s, const QVariant::Type p);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Helper class to add one more level of indirection to prevent
|
|
||||||
implicit casts.
|
|
||||||
*/
|
|
||||||
class QVariantComparisonHelper
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
inline QVariantComparisonHelper(const QVariant &var)
|
|
||||||
: v(&var) {}
|
|
||||||
private:
|
|
||||||
friend inline bool operator==(const QVariant &, const QVariantComparisonHelper &);
|
|
||||||
const QVariant *v;
|
|
||||||
};
|
|
||||||
|
|
||||||
inline bool operator==(const QVariant &v1, const QVariantComparisonHelper &v2)
|
|
||||||
{
|
|
||||||
return v1.cmp(*v2.v);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool operator!=(const QVariant &v1, const QVariantComparisonHelper &v2)
|
|
||||||
{
|
|
||||||
return !operator==(v1, v2);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef QT_MOC
|
#ifndef QT_MOC
|
||||||
template<typename T> inline T qvariant_cast(const QVariant &v)
|
template<typename T> inline T qvariant_cast(const QVariant &v)
|
||||||
{
|
{
|
||||||
|
|
|
@ -80,10 +80,7 @@ private:
|
||||||
const uchar *p;
|
const uchar *p;
|
||||||
int l;
|
int l;
|
||||||
};
|
};
|
||||||
union {
|
|
||||||
uint dummy[256];
|
|
||||||
Data p;
|
Data p;
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
|
@ -68,7 +68,7 @@ struct Q_CORE_EXPORT QListData {
|
||||||
struct Data {
|
struct Data {
|
||||||
QAtomicInt ref;
|
QAtomicInt ref;
|
||||||
int alloc, begin, end;
|
int alloc, begin, end;
|
||||||
uint sharable : 1;
|
bool sharable;
|
||||||
void *array[1];
|
void *array[1];
|
||||||
};
|
};
|
||||||
enum { DataHeaderSize = sizeof(Data) - sizeof(void *) };
|
enum { DataHeaderSize = sizeof(Data) - sizeof(void *) };
|
||||||
|
|
|
@ -658,9 +658,9 @@ static int findChar(const QChar *str, int len, QChar ch, int from,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QString::Data QString::shared_null = { QAtomicInt(1),
|
QString::Data QString::shared_null = { QAtomicInt(1),
|
||||||
0, 0, shared_null.array, 0, {0} };
|
0, 0, 0, shared_null.array, {0} };
|
||||||
QString::Data QString::shared_empty = { QAtomicInt(1),
|
QString::Data QString::shared_empty = { QAtomicInt(1),
|
||||||
0, 0, shared_empty.array, 0, {0} };
|
0, 0, 0, shared_empty.array, {0} };
|
||||||
|
|
||||||
int QString::grow(int size)
|
int QString::grow(int size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -493,9 +493,8 @@ private:
|
||||||
|
|
||||||
struct Data {
|
struct Data {
|
||||||
QAtomicInt ref;
|
QAtomicInt ref;
|
||||||
int alloc, size;
|
int alloc, size, capacity;
|
||||||
ushort *data;
|
ushort *data;
|
||||||
ushort capacity : 1;
|
|
||||||
ushort array[1];
|
ushort array[1];
|
||||||
};
|
};
|
||||||
static Data shared_null;
|
static Data shared_null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue