diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-20 14:33:09 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-20 14:33:09 +1000 |
commit | 6352e8e3196f78388b6c771073f9e03eaa612673 (patch) | |
tree | e23772f79a7fbc41bc9108951e9e136857484bf4 /source/core/StarJsonPatch.hpp | |
parent | 6741a057e5639280d85d0f88ba26f000baa58f61 (diff) |
everything everywhere
all at once
Diffstat (limited to 'source/core/StarJsonPatch.hpp')
-rw-r--r-- | source/core/StarJsonPatch.hpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/source/core/StarJsonPatch.hpp b/source/core/StarJsonPatch.hpp new file mode 100644 index 0000000..1cf689c --- /dev/null +++ b/source/core/StarJsonPatch.hpp @@ -0,0 +1,41 @@ +#ifndef STAR_JSON_PATCH_HPP +#define STAR_JSON_PATCH_HPP + +#include "StarJson.hpp" + +namespace Star { + +STAR_EXCEPTION(JsonPatchException, JsonException); +STAR_EXCEPTION(JsonPatchTestFail, StarException); + +// Applies the given RFC6902 compliant patch to the base and returns the result +// Throws JsonPatchException on patch failure. +Json jsonPatch(Json const& base, JsonArray const& patch); + +namespace JsonPatching { + // Applies the given single operation + Json applyOperation(Json const& base, Json const& op); + + // Tests for "value" at "path" + // Returns base or throws JsonPatchException + Json applyTestOperation(Json const& base, Json const& op); + + // Removes the value at "path" + Json applyRemoveOperation(Json const& base, Json const& op); + + // Adds "value" at "path" + Json applyAddOperation(Json const& base, Json const& op); + + // Replaces "path" with "value" + Json applyReplaceOperation(Json const& base, Json const& op); + + // Moves "from" to "path" + Json applyMoveOperation(Json const& base, Json const& op); + + // Copies "from" to "path" + Json applyCopyOperation(Json const& base, Json const& op); +} + +} + +#endif |