4#include "Stroika/Frameworks/StroikaPreComp.h"
16using namespace Stroika::Foundation::DataExchange::JSON::Patch;
23String JSON::Patch::OperationItemType::ToString ()
const
28 sb <<
", path: "sv << path;
30 sb <<
", value: "sv << value;
40 using MapElt = Context::MapElt;
41 using SeqElt = Context::SeqElt;
45 case OperationType::eAdd: {
47 if (optional<tuple<Context, VariantValue>> oMatch = this->path.ApplyWithContext (v)) {
49 Context c = get<Context> (*oMatch);
50 if (c.fStack.empty ()) {
53 auto stackTop = c.fStack.Pop ();
58 if (
auto mo = get_if<MapElt> (&stackTop)) {
59 mo->fOrigValue.Add (mo->fEltName, this->value);
60 result = c.ConstructNewFrom (
VariantValue{mo->fOrigValue});
62 else if (
auto so = get_if<SeqElt> (&stackTop)) {
63 so->fOrigValue.Insert (so->fIndex, this->value);
64 result = c.ConstructNewFrom (
VariantValue{so->fOrigValue});
75 case OperationType::eRemove: {
88 mapper += JSON::PointerType::kMapper;
91 mapper.
AddClass<OperationItemType> ({
92 {
"op"sv, &OperationItemType::op},
93 {
"path"sv, &OperationItemType::path},
94 {
"value"sv, &OperationItemType::value},
106 mapper += OperationItemType::kMapper;
#define AssertNotImplemented()
#define AssertNotReached()
Similar to String, but intended to more efficiently construct a String. Mutable type (String is large...
String is like std::u32string, except it is much easier to use, often much more space efficient,...
ObjectVariantMapper can be used to map C++ types to and from variant-union types, which can be transp...
nonvirtual void AddClass(const Traversal::Iterable< StructFieldInfo > &fieldDescriptions, const ClassMapperOptions< CLASS > &mapperOptions={})
nonvirtual void AddCommonType(ARGS &&... args)
Simple variant-value (case variant union) object, with (variant) basic types analogous to a value in ...
nonvirtual void Apply(const function< void(ArgByValueType< T > item)> &doToElement, Execution::SequencePolicy seq=Execution::SequencePolicy::eDEFAULT) const
Run the argument function (or lambda) on each element of the container.
void Throw(T &&e2Throw)
identical to builtin C++ 'throw' except that it does helpful, type dependent DbgTrace() messages firs...