本文整理汇总了C++中QCache::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ QCache::remove方法的具体用法?C++ QCache::remove怎么用?C++ QCache::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCache
的用法示例。
在下文中一共展示了QCache::remove方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: axioms_on_key_type
void tst_QCache::axioms_on_key_type()
{
QCache<KeyType, ValueType> foo;
foo.setMaxCost(1);
foo.clear();
foo.insert(KeyType(123), new ValueType(123));
foo.object(KeyType(123));
foo.contains(KeyType(456));
foo[KeyType(456)];
foo.remove(KeyType(456));
foo.remove(KeyType(123));
foo.take(KeyType(789));
// If this fails, contact the maintaner
QVERIFY(sizeof(QHash<int, int>) == sizeof(void *));
}
示例2: remove
void tst_QCache::remove()
{
QCache<QString, Foo> cache;
cache.remove(QString());
cache.remove("alpha");
QVERIFY(cache.isEmpty());
cache.insert("alpha", new Foo, 10);
QCOMPARE(cache.size(), 1);
cache.insert("beta", new Foo, 20);
QCOMPARE(cache.size(), 2);
for (int i = 0; i < 10; ++i) {
cache.remove("alpha");
QCOMPARE(cache.size(), 1);
QCOMPARE(cache.totalCost(), 20);
}
cache.setMaxCost(1);
QCOMPARE(cache.size(), 0);
cache.remove("beta");
QCOMPARE(cache.size(), 0);
}
示例3: operator_bracket_bracket
void tst_QCache::operator_bracket_bracket()
{
QCache<int, int> cache;
cache.insert(1, new int(2));
QVERIFY(cache[0] == 0);
QVERIFY(cache[1] != 0);
QCOMPARE(*cache[1], 2);
cache.insert(1, new int(4));
QVERIFY(cache[1] != 0);
QCOMPARE(*cache[1], 4);
// check that operator[] doesn't remove the item
QVERIFY(cache[1] != 0);
QCOMPARE(*cache[1], 4);
cache.remove(1);
QVERIFY(cache[1] == 0);
}
示例4: contains
void tst_QCache::contains()
{
QCache<int, int> cache;
QVERIFY(!cache.contains(0));
QVERIFY(!cache.contains(1));
cache.insert(1, new int(1), 1);
QVERIFY(!cache.contains(0));
QVERIFY(cache.contains(1));
cache.remove(0);
cache.remove(1);
QVERIFY(!cache.contains(0));
QVERIFY(!cache.contains(1));
cache.insert(1, new int(1), 1);
QVERIFY(!cache.contains(0));
QVERIFY(cache.contains(1));
cache.clear();
QVERIFY(!cache.contains(0));
QVERIFY(!cache.contains(1));
}
示例5: clearBlurTextureInfo
void QGLBlurTextureCache::clearBlurTextureInfo(quint64 cacheKey)
{
cache.remove(cacheKey);
}