30#ifndef LIB_DIFF_LIST_DIFF_APPLICATION_H
31#define LIB_DIFF_LIST_DIFF_APPLICATION_H
62 template<
typename E,
typename...ARGS>
66 using Vec = vector<E,ARGS...>;
67 using Iter = Vec::iterator;
76 return pos_ == orig_.end();
84 "no (further) elements in target sequence") % oper % elm
85 ,
LERR_(DIFF_CONFLICT));
88 "found element %s on current target position instead")
90 ,
LERR_(DIFF_CONFLICT));
97 throw error::State(
_Fmt(
"Premature end of target sequence, still expecting element %s; "
98 "unable to apply diff further.") % elm
99 ,
LERR_(DIFF_CONFLICT));
105 if (targetPos == orig_.end())
107 "element %s in the remainder of the target.") % elm
108 ,
LERR_(DIFF_CONFLICT));
115 ins (E
const& elm)
override
121 del (E
const& elm)
override
123 __expect_in_target(elm,
"remove");
130 __expect_in_target(elm,
"pick");
131 seq_.push_back (move(*pos_));
138 __expect_further_elements (elm);
145 __expect_further_elements (elm);
147 __expect_found (elm, found);
148 seq_.push_back (move(*found));
162 seq_.reserve (orig_.size() * 120 / 100);
163 pos_ = orig_.begin();
169 if (not end_of_target())
170 throw error::State(
_Fmt(
"Not all source data consumed after diff application. "
171 "Element %s waiting to be consumed") % *pos_
172 ,
LERR_(DIFF_STRUCTURE));
DiffApplicationStrategy(vector< E > &targetVector)
void pick(E const &elm) override
void ins(E const &elm) override
void skip(E const &elm) override
void __expect_further_elements(E const &elm)
void initDiffApplication()
void completeDiffApplication()
void del(E const &elm) override
void __expect_found(E const &elm, Iter const &targetPos)
void find(E const &elm) override
void __expect_in_target(E const &elm, Literal oper)
Interpreter interface to define the operations ("verbs"), which describe differences or changes in a ...
A front-end for using printf-style formatting.
A token language to represent changes in a list of elements.
Extension point: define how a specific diff language can be applied to elements in a concrete contain...
Implementation namespace for support and library code.
LumieraError< LERR_(STATE)> State
constexpr IT find(IT, IT, V const &)