Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core/StarJson.hpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-03-09 09:48:21 +1100
committerKae <80987908+Novaenia@users.noreply.github.com>2024-03-09 09:48:21 +1100
commit7b556b33f8f7aed94b3e706783dfe9e37497896a (patch)
tree9dd374515b8f8aebf1da3323551c0aeeef2a2eae /source/core/StarJson.hpp
parent7bc9eaa43240cfacc826cbaa921daa338af23ca4 (diff)
More compact search patch parsing
Diffstat (limited to 'source/core/StarJson.hpp')
-rw-r--r--source/core/StarJson.hpp22
1 files changed, 7 insertions, 15 deletions
diff --git a/source/core/StarJson.hpp b/source/core/StarJson.hpp
index 51e0be7..085fd9f 100644
--- a/source/core/StarJson.hpp
+++ b/source/core/StarJson.hpp
@@ -355,21 +355,13 @@ Json jsonMergeQueryDef(String const& key, Json def, Json const& first, T const&.
return def;
}
-// Compares the two given json values and returns a boolean, by the following
-// rules (applied in order): If both values are identical, return true. If both
-// values are not equal, check if they are objects. If they are objects,
-// iterate through every pair in the comparing object and check if the key is
-// in the base object. If the key is in the base object, then jsonCompare is
-// called recursively on both values. If the base object does not contain the
-// key, or the recursion fails, return false. Otherwise, return true. If they
-// are not objects, check if they are arrays. If they are arrays, iterate
-// through every value in the comparing object and then recursively call
-// jsonCompare on every value in the base object until a match is found. If a
-// match is found, break and move on to the next value in the comparing array.
-// If a match is found for every value in the comparing array, return true.
-// Otherwise, return false. If both values are not identical, and are not
-// objects or arrays, return false.
-bool jsonCompare(Json const& base, Json const& compare);
+// Compares two JSON values to see if the second is a subset of the first.
+// For objects, each key in the second object must exist in the first
+// object and the values are recursively compared the same way. For arrays,
+// each element in the second array must successfully compare with some
+// element of the first array, regardless of order or duplication.
+// For all other types, the values must be equal.
+bool jsonPartialMatch(Json const& base, Json const& compare);
}