mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
make most detach methods private [ci reset]
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
00c4281f99
commit
393186b696
16 changed files with 17 additions and 52 deletions
|
@ -228,11 +228,6 @@ void QBitArray::fill(bool value, int begin, int end)
|
|||
setBit(begin++, value);
|
||||
}
|
||||
|
||||
/*! \fn void QBitArray::detach()
|
||||
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*! \fn void QBitArray::clear()
|
||||
|
||||
Clears the contents of the bit array and makes it empty.
|
||||
|
|
|
@ -59,7 +59,6 @@ public:
|
|||
|
||||
void resize(int size);
|
||||
|
||||
inline void detach() { d.detach(); }
|
||||
inline void clear() { d.clear(); }
|
||||
|
||||
bool testBit(int i) const;
|
||||
|
|
|
@ -120,7 +120,6 @@ public:
|
|||
char *data();
|
||||
const char *data() const;
|
||||
inline const char *constData() const;
|
||||
inline void detach();
|
||||
void clear();
|
||||
|
||||
char at(int i) const;
|
||||
|
@ -296,6 +295,7 @@ private:
|
|||
static void freeData(Data *);
|
||||
void reallocData(int alloc);
|
||||
QByteArray nulTerminated() const;
|
||||
inline void detach();
|
||||
|
||||
friend class QByteRef;
|
||||
friend class QString;
|
||||
|
|
|
@ -75,8 +75,6 @@ public:
|
|||
|
||||
inline ~QContiguousCache() { if (!d) return; if (!d->ref.deref()) free(p); }
|
||||
|
||||
inline void detach() { if (d->ref != 1) detach_helper(); }
|
||||
|
||||
QContiguousCache<T> &operator=(const QContiguousCache<T> &other);
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
inline QContiguousCache<T> &operator=(QContiguousCache<T> &&other)
|
||||
|
@ -128,6 +126,7 @@ public:
|
|||
void dump() const { p->dump(); }
|
||||
#endif
|
||||
private:
|
||||
inline void detach() { if (d->ref != 1) detach_helper(); }
|
||||
void detach_helper();
|
||||
|
||||
QContiguousCacheData *allocate(int aalloc);
|
||||
|
|
|
@ -188,8 +188,6 @@ public:
|
|||
void reserve(int size);
|
||||
inline void squeeze() { reserve(1); }
|
||||
|
||||
inline void detach() { if (d->ref != 1) detach_helper(); }
|
||||
|
||||
void clear();
|
||||
|
||||
int remove(const Key &key);
|
||||
|
@ -368,6 +366,7 @@ public:
|
|||
#endif
|
||||
|
||||
private:
|
||||
inline void detach() { if (d->ref != 1) detach_helper(); }
|
||||
void detach_helper();
|
||||
void freeData(QHashData *d);
|
||||
Node **findNode(const Key &key, uint *hp = nullptr) const;
|
||||
|
|
|
@ -69,9 +69,6 @@ public:
|
|||
inline bool operator!=(const QLinkedList<T> &l) const { return !(*this == l); }
|
||||
|
||||
inline int size() const { return d->size; }
|
||||
inline void detach()
|
||||
{ if (d->ref != 1) detach_helper(); }
|
||||
|
||||
inline bool isEmpty() const { return d->size == 0; }
|
||||
|
||||
void clear();
|
||||
|
@ -206,6 +203,7 @@ public:
|
|||
inline QLinkedList<T> &operator<<(const QLinkedList<T> &l) { *this += l; return *this; }
|
||||
|
||||
private:
|
||||
inline void detach() { if (d->ref != 1) detach_helper(); }
|
||||
void detach_helper();
|
||||
void freeData(QLinkedListData*);
|
||||
};
|
||||
|
|
|
@ -100,9 +100,6 @@ public:
|
|||
inline bool operator!=(const QList<T> &l) const { return !(*this == l); }
|
||||
|
||||
inline int size() const { return p.size(); }
|
||||
|
||||
inline void detach() { if (d->ref != 1) detach_helper(d->alloc); }
|
||||
|
||||
inline bool isEmpty() const { return p.isEmpty(); }
|
||||
|
||||
void clear();
|
||||
|
@ -288,6 +285,7 @@ public:
|
|||
{ std::list<T> tmp; qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; }
|
||||
|
||||
private:
|
||||
inline void detach() { if (d->ref != 1) detach_helper(d->alloc); }
|
||||
void detach_helper(int alloc);
|
||||
|
||||
void node_construct(Node *n, const T &t);
|
||||
|
|
|
@ -159,7 +159,6 @@ public:
|
|||
inline bool operator!=(const QMap<Key, T> &other) const { return !(*this == other); }
|
||||
|
||||
inline int size() const { return d->size; }
|
||||
|
||||
inline bool isEmpty() const { return d->size == 0; }
|
||||
|
||||
inline void detach() { if (d->ref != 1) detach_helper(); }
|
||||
|
|
|
@ -59,8 +59,6 @@ public:
|
|||
|
||||
inline void squeeze() { q_hash.squeeze(); }
|
||||
|
||||
inline void detach() { q_hash.detach(); }
|
||||
|
||||
inline void clear() { q_hash.clear(); }
|
||||
|
||||
inline bool remove(const T &value) { return q_hash.remove(value) != 0; }
|
||||
|
|
|
@ -215,15 +215,6 @@
|
|||
\sa reserve(), capacity()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QSet::detach()
|
||||
|
||||
\internal
|
||||
|
||||
Detaches this set from any other sets with which it may share
|
||||
data.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QSet::clear()
|
||||
|
||||
|
|
|
@ -80,7 +80,6 @@ public:
|
|||
inline const QChar *data() const;
|
||||
inline const QChar *constData() const;
|
||||
|
||||
inline void detach();
|
||||
void clear();
|
||||
|
||||
inline const QChar at(int i) const;
|
||||
|
@ -472,6 +471,7 @@ private:
|
|||
static void freeData(Data *);
|
||||
void reallocData(int alloc);
|
||||
void expand(int i);
|
||||
inline void detach();
|
||||
QString multiArg(int numArgs, const QString **args) const;
|
||||
static int compare_helper(const QChar *data1, int length1,
|
||||
const QChar *data2, int length2,
|
||||
|
|
|
@ -91,8 +91,6 @@ public:
|
|||
void reserve(int size);
|
||||
inline void squeeze() { reallocData(d->size, d->size); d->capacity = false; }
|
||||
|
||||
inline void detach() { if (d->ref != 1) detach_helper(); }
|
||||
|
||||
inline T *data() { detach(); return p->array; }
|
||||
inline const T *data() const { return p->array; }
|
||||
inline const T *constData() const { return p->array; }
|
||||
|
@ -252,7 +250,9 @@ public:
|
|||
{ QVector<T> tmp; tmp.reserve(int(vector.size())); qCopy(vector.begin(), vector.end(), std::back_inserter(tmp)); return tmp; }
|
||||
inline std::vector<T> toStdVector() const
|
||||
{ std::vector<T> tmp; tmp.reserve(size()); qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; }
|
||||
|
||||
private:
|
||||
inline void detach() { if (d->ref != 1) detach_helper(); }
|
||||
void detach_helper();
|
||||
QVectorData *mallocData(int alloc);
|
||||
void reallocData(int size, int alloc);
|
||||
|
|
|
@ -57,10 +57,16 @@ public:
|
|||
void setOption(const QString &opt, const QVariant &value);
|
||||
|
||||
bool isNull() const;
|
||||
void detach();
|
||||
private:
|
||||
friend class QAuthenticatorPrivate;
|
||||
void detach();
|
||||
|
||||
QAuthenticatorPrivate *d;
|
||||
|
||||
friend class QAuthenticatorPrivate;
|
||||
friend class QHttpPrivate;
|
||||
friend class QHttpNetworkConnectionPrivate;
|
||||
friend class QHttpSocketEngine;
|
||||
friend class QHttpNetworkConnectionChannel;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
@ -299,7 +299,6 @@ void tst_QHash::insert1()
|
|||
}
|
||||
{
|
||||
Hash hash2 = hash;
|
||||
hash2.detach();
|
||||
hash2.remove(1);
|
||||
QVERIFY(hash2.size() == 1);
|
||||
hash2.remove(1);
|
||||
|
@ -311,8 +310,6 @@ void tst_QHash::insert1()
|
|||
QVERIFY(hash.size() == 2);
|
||||
}
|
||||
|
||||
hash.detach();
|
||||
|
||||
{
|
||||
Hash::iterator it1 = hash.find(1);
|
||||
QVERIFY(it1 != hash.end());
|
||||
|
|
|
@ -51,7 +51,6 @@ private slots:
|
|||
void capacity();
|
||||
void reserve();
|
||||
void squeeze();
|
||||
void detach();
|
||||
void clear();
|
||||
void remove();
|
||||
void contains();
|
||||
|
@ -250,19 +249,6 @@ void tst_QSet::squeeze()
|
|||
QVERIFY(set.capacity() < 100);
|
||||
}
|
||||
|
||||
void tst_QSet::detach()
|
||||
{
|
||||
QSet<int> set;
|
||||
set.detach();
|
||||
|
||||
set.insert(1);
|
||||
set.insert(2);
|
||||
set.detach();
|
||||
|
||||
QSet<int> copy = set;
|
||||
set.detach();
|
||||
}
|
||||
|
||||
void tst_QSet::clear()
|
||||
{
|
||||
QSet<QString> set1, set2;
|
||||
|
|
|
@ -150,7 +150,7 @@ void tst_QString::fromLatin1() const
|
|||
|
||||
QByteArray copy1 = latin1, copy2 = latin1, copy3 = latin1;
|
||||
copy1.chop(1);
|
||||
copy2.detach();
|
||||
copy2.chop(1);
|
||||
copy3 += latin1; // longer length
|
||||
copy2.clear();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue