Always apply callback function when validating schema

This commit is contained in:
Yang Jiao 2021-10-05 18:23:27 -04:00
parent 9a2ebbdec2
commit 0f0cc2bc55

View File

@ -124,18 +124,18 @@ public:
* @brief Invoke a function on each child Constraint * @brief Invoke a function on each child Constraint
* *
* This function will apply the callback function to each constraint in * This function will apply the callback function to each constraint in
* the Subschema, even if one of the invokations returns \c false. However, * the Subschema, even if one of the invocations returns \c false. However,
* if one or more invokations of the callback function return \c false, * if one or more invocations of the callback function return \c false,
* this function will also return \c false. * this function will also return \c false.
* *
* @returns \c true if all invokations of the callback function are * @returns \c true if all invocations of the callback function are
* successful, \c false otherwise * successful, \c false otherwise
*/ */
bool apply(ApplyFunction &applyFunction) const bool apply(ApplyFunction &applyFunction) const
{ {
bool allTrue = true; bool allTrue = true;
for (const Constraint *constraint : m_constraints) { for (const Constraint *constraint : m_constraints) {
allTrue = allTrue && applyFunction(*constraint); allTrue = applyFunction(*constraint) && allTrue;
} }
return allTrue; return allTrue;
@ -145,10 +145,10 @@ public:
* @brief Invoke a function on each child Constraint * @brief Invoke a function on each child Constraint
* *
* This is a stricter version of the apply() function that will return * This is a stricter version of the apply() function that will return
* immediately if any of the invokations of the callback function return * immediately if any of the invocations of the callback function return
* \c false. * \c false.
* *
* @returns \c true if all invokations of the callback function are * @returns \c true if all invocations of the callback function are
* successful, \c false otherwise * successful, \c false otherwise
*/ */
bool applyStrict(ApplyFunction &applyFunction) const bool applyStrict(ApplyFunction &applyFunction) const