4#include "QueryResult.hpp"
56 Move &operator=(
const Move &other) =
default;
58 Move &operator=(
Move &&other) =
default;
65 bool operator!=(
const Move &other)
const {
return !(*
this == other); }
67 bool operator<(
const Move &other)
const {
68 return from < other.from || (
from == other.from &&
to < other.to);
105 std::vector<Move>
moves)
114 explicit Diff(
const nlohmann::json &json);
118 Diff &operator=(
const Diff &other) =
default;
120 Diff &operator=(
Diff &&other) =
default;
142 std::shared_ptr<dittoffi_differ_t> ffi_differ;
172 Diff diff(
const std::vector<QueryResultItem> &items);
Diff diff(const std::vector< QueryResultItem > &items)
Calculate the diff of the provided items against the last set of items that were passed to this diffe...
Namespace for the Ditto C++ SDK types and functions.
Definition AbstractDocumentPath.hpp:19
std::set< std::size_t > IndexSet
A set of indexes into a vector.
Definition Differ.hpp:18
Representation of a move from one index to another in a vector.
Definition Differ.hpp:33
std::size_t from
The index in the old array from which the item has been moved.
Definition Differ.hpp:37
std::size_t to
The index in the new array to which the item has been moved.
Definition Differ.hpp:42
Move()
Default constructor.
Definition Differ.hpp:53
Move(std::size_t from, std::size_t to)
Constructor with initial values.
Definition Differ.hpp:48
Represents differences between two arrays of items.
Definition Differ.hpp:26
IndexSet insertions
The set of indexes in the new array at which the new items have been inserted.
Definition Differ.hpp:76
Diff()=default
Default constructor.
IndexSet updates
The set of indexes in the new array at which the items have been updated.
Definition Differ.hpp:88
IndexSet deletions
The set of indexes in the old array at which the items have been deleted.
Definition Differ.hpp:82
std::vector< Move > moves
A set of objects each representing a move of an item from a particular index in the old array to a pa...
Definition Differ.hpp:94
Diff(IndexSet insertions, IndexSet deletions, IndexSet updates, std::vector< Move > moves)
Constructor with initial values.
Definition Differ.hpp:104
bool operator==(const Diff &other) const
Test for equality between two diffs.
bool operator!=(const Diff &other) const
Test for inequality between two diffs.