本文整理汇总了C++中Identifier::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ Identifier::isEmpty方法的具体用法?C++ Identifier::isEmpty怎么用?C++ Identifier::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Identifier
的用法示例。
在下文中一共展示了Identifier::isEmpty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StringImpl
String::String(const Identifier& str)
{
if (str.isNull())
return;
if (str.isEmpty())
m_impl = StringImpl::empty();
else
m_impl = new StringImpl(reinterpret_cast<const UChar*>(str.data()), str.size());
}
示例2: testIdentifier
void TestIdentifier::testIdentifier()
{
QFETCH(QString, stringId);
const IndexedString indexedStringId(stringId);
Identifier id(stringId);
QCOMPARE(id.isEmpty(), stringId.isEmpty());
QCOMPARE(id, Identifier(stringId));
QVERIFY(!(id != Identifier(stringId)));
QCOMPARE(id, Identifier(stringId));
QCOMPARE(id, Identifier(indexedStringId));
QCOMPARE(id.identifier(), indexedStringId);
QCOMPARE(id.toString(), stringId);
QVERIFY(id.nameEquals(Identifier(stringId)));
QVERIFY(!id.isUnique());
if (stringId.isEmpty()) {
QVERIFY(id.inRepository());
QVERIFY(Identifier(id).inRepository());
QVERIFY(Identifier(indexedStringId).inRepository());
}
Identifier copy = id;
QCOMPARE(copy, id);
copy = copy;
QCOMPARE(copy, id);
copy = Identifier();
QVERIFY(copy.isEmpty());
copy = id;
QCOMPARE(copy, id);
IndexedIdentifier indexedId(id);
QVERIFY(indexedId == id);
QCOMPARE(indexedId, IndexedIdentifier(id));
QCOMPARE(indexedId.isEmpty(), stringId.isEmpty());
QCOMPARE(indexedId.identifier(), id);
IndexedIdentifier indexedCopy = indexedId;
QCOMPARE(indexedCopy, indexedId);
indexedCopy = indexedCopy;
QCOMPARE(indexedCopy, indexedId);
indexedCopy = IndexedIdentifier();
QVERIFY(indexedCopy.isEmpty());
indexedCopy = indexedId;
QCOMPARE(indexedCopy, indexedId);
Identifier moved = std::move(id);
QVERIFY(id.isEmpty());
QVERIFY(id.inRepository());
QCOMPARE(moved, copy);
IndexedIdentifier movedIndexed = std::move(indexedId);
QVERIFY(indexedId.isEmpty());
QCOMPARE(movedIndexed, indexedCopy);
}
示例3: contains
bool LabelStack::contains(const Identifier &id) const
{
if (id.isEmpty())
return true;
for (StackElem* curr = m_topOfStack; curr; curr = curr->prev) {
if (curr->id == id)
return true;
}
return false;
}