Ejemplo n.º 1
0
void MojoWhereMatcher::ValidateClauses(const MojObject& where) const
{
	MojLogTrace(s_log);
	MojLogInfo(s_log, _T("Validating trigger clauses"));

	if (where.type() == MojObject::TypeObject) {
		ValidateClause(where);
	} else if (where.type() == MojObject::TypeArray) {
		for (MojObject::ConstArrayIterator iter = where.arrayBegin();
			iter != where.arrayEnd(); ++iter) {
			const MojObject& clause = *iter;
			if (clause.type() != MojObject::TypeObject) {
				throw std::runtime_error("where statement array must "
					"consist of valid clauses");
			} else {
				ValidateClause(clause);
			}
		}
	} else {
		throw std::runtime_error("where statement should consist of a single "
			"clause or array of valid clauses");
	}
}
Ejemplo n.º 2
0
void MojoNewWhereMatcher::ValidateClauses(const MojObject& where) const
{
	LOG_AM_TRACE("Entering function %s", __FUNCTION__);
	LOG_AM_DEBUG("Validating trigger clauses");

	if (where.type() == MojObject::TypeObject) {
		ValidateClause(where);
	} else if (where.type() == MojObject::TypeArray) {
		for (MojObject::ConstArrayIterator iter = where.arrayBegin();
			iter != where.arrayEnd(); ++iter) {
			const MojObject& clause = *iter;
			if (clause.type() != MojObject::TypeObject) {
				throw std::runtime_error("where statement array must "
					"consist of valid clauses");
			} else {
				ValidateClause(clause);
			}
		}
	} else {
		throw std::runtime_error("where statement should consist of a single "
			"clause or array of valid clauses");
	}
}