Esempio n. 1
0
static ConstValue sliceKey(const ConstValue &key, natural groupLevel, const Json &json) {
	if (key->isArray()) {
		if (key.length() <= groupLevel) return key;
		Container out = json.array();
		for (natural i = 0; i < groupLevel; i++)
			out.add(key[i]);
		return out;
	} else {
		return key;
	}

}
Esempio n. 2
0
bool Json::operator == (const Json& other) const {
    if (this == &other) return true;
    if (IsNull()) return other.IsNull();
    if (other.IsNull()) return false;
    if (value_->type() != other.value_->type()) return false;
    if (IsInteger()) return integer() == other.integer();
    if (IsUInteger()) return uinteger() == other.uinteger();
    if (IsReal()) return real() == other.real();
    if (IsString()) return string() == other.string();
    if (IsArray())  return array() == other.array();
    if (IsObject()) return object() == other.object();
    return false;
}