mirror of
https://github.com/tristanpenman/valijson.git
synced 2025-01-06 00:31:11 +01:00
Always apply callback function when validating schema
This commit is contained in:
parent
9a2ebbdec2
commit
0f0cc2bc55
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user