本文整理汇总了C++中Quest::valid方法的典型用法代码示例。如果您正苦于以下问题:C++ Quest::valid方法的具体用法?C++ Quest::valid怎么用?C++ Quest::valid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quest
的用法示例。
在下文中一共展示了Quest::valid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addQuest
void Questions::addQuest(Quest& quest)
{
if (!quest.valid())
return;
int level = quest.level - 1;
Q_ASSERT(level < MAX_QUEST_LIST && level >= 0);
questVector.push_back(quest);
}
示例2: readQuestion
void Questions::readQuestion(QXmlStreamReader& load) {
Quest q;
//wyszukiwanie elementów w pętli
do {
if (load.isStartElement()) {
if (load.name() == "level") {
q.level = load.readElementText().toInt();
}
else if (load.name() == "question") {
q.question = load.readElementText();
}
else if (load.name() == "a") {
q.A = load.readElementText();
}
else if (load.name() == "b") {
q.B = load.readElementText();
}
else if (load.name() == "c") {
q.C = load.readElementText();
}
else if (load.name() == "d") {
q.D = load.readElementText();
}
else if (load.name() == "proper") {
q.correct = load.readElementText().at(0); //nie może być puste!
}
else {
//qDebug() << load.name();
}
}
} while (load.readNext() != QXmlStreamReader::EndElement && load.name().toString() != "quest");
//jeżeli prawidłowe pytanie dodaje do odpowiedniej listy
if (q.valid()) {
addQuest(q);
}
else {
qDebug() << "Quest nieprawidłowy! Question::readQuest";
//qDebug() << questToString(q);
}
}