Exemple #1
0
bool checkContains(struct BTNode *p,struct BTNode *t2)
{
	if (t2 == NULL)
		return true;
	if (p == NULL || p->val != t2->val)
		return false;
	return checkContains(p->pLeft,t2->pLeft) && checkContains(p->pRight,t2->pRight);
}
Exemple #2
0
bool JsonObject::boolean(const QString& key) const {
    checkContains(key);
    QJsonValue value = o.value(key);
    if ( ! value.isBool())
        wrongType("'true' or 'false'", key);
    return value.toBool();
}
Exemple #3
0
JsonArray JsonObject::array(const QString& key) const {
    checkContains(key);
    QJsonValue value = o.value(key);
    if ( ! value.isArray())
        wrongType("array", key);
    return JsonArray(value.toArray());
}
Exemple #4
0
JsonObject JsonObject::object(const QString& key) const {
    checkContains(key);
    QJsonValue value = o.value(key);
    if ( ! value.isObject())
        wrongType("object", key);
    return JsonObject(value.toObject());
}
Exemple #5
0
double JsonObject::number(const QString& key) const {
    checkContains(key);
    QJsonValue value = o.value(key);
    if ( ! value.isDouble())
        wrongType("number", key);
    return value.toDouble();
}
Exemple #6
0
QString JsonObject::string(const QString& key) const {
    checkContains(key);
    QJsonValue value = o.value(key);
    if ( ! value.isString())
        wrongType("string", key);
    return value.toString();
}
Exemple #7
0
bool BTree::subTreeIsContains(struct BTNode *t1,struct BTNode *t2)
{
	return checkContains(t1,t2) || checkContains(t1->pLeft,t2) || checkContains(t2->pRight,t2); 
}
Exemple #8
0
bool JsonObject::isNull(const QString& key) const {
    checkContains(key);
    return o.value(key).isNull();
}