25 constexpr
StringPiece kOperationReplace =
"replace";
46 for (
auto const& elem : obj) {
47 if (!elem.isObject()) {
50 auto const* op_ptr = elem.get_ptr(kOpTag);
54 if (!op_ptr->isString()) {
57 auto const op_str = op_ptr->asString();
62 auto const* from_ptr = elem.get_ptr(kFromTag);
64 if (!from_ptr->isString()) {
68 if (!json_ptr.hasValue()) {
72 op.
from = json_ptr.value();
78 auto const* path_ptr = elem.get_ptr(kPathTag);
82 if (!path_ptr->isString()) {
87 if (!json_ptr.hasValue()) {
91 op.
path = json_ptr.value();
96 auto const* val_ptr = elem.get_ptr(kValueTag);
108 if (op_str == kOperationTest) {
113 }
else if (op_str == kOperationRemove) {
115 }
else if (op_str == kOperationAdd) {
120 }
else if (op_str == kOperationReplace) {
125 }
else if (op_str == kOperationMove) {
130 if (op.
from->is_prefix_of(op.
path)) {
135 }
else if (op_str == kOperationCopy) {
static Expected< json_pointer, parse_error > try_parse(StringPiece const str)
Optional< json_pointer > from
constexpr detail::Map< Move > move
—— Concurrent Priority Queue Implementation ——
requires E e noexcept(noexcept(s.error(std::move(e))))
static folly::Expected< json_patch, parse_error > try_parse(dynamic const &obj) noexcept
patch_operation_code op_code
std::vector< patch_operation > ops_
constexpr Unexpected< typename std::decay< Error >::type > makeUnexpected(Error &&)
std::vector< patch_operation > const & ops() const
Optional< dynamic > value
Range< const char * > StringPiece