Bugfix: yet another init problem after swapping contents
yeah, working with open fire is dangerous... For performace reasons I've undercut the premise to make GenNode / Record immutable. Now I'm dealing with raw storage layout together with this quite hairy distinction between "attribute scope" and "child scope" In hindsight, it might have been better to implement Record as a single list, and to maintain a shortcut pointer to jump to the start of the attributes.
This commit is contained in:
parent
83bea7c6ef
commit
eb829e6994
2 changed files with 14 additions and 1 deletions
|
|
@ -30,7 +30,10 @@
|
|||
** details of doing so are highly coupled to the actual storage implementation
|
||||
** of #Record, as well as to the actual procedure to apply a diff message, as
|
||||
** implemented in lib::diff::DiffApplicationStrategy.
|
||||
**
|
||||
** @warning this struct is marked "internal" for a reason;
|
||||
** it serves the purpose to remove technicalities from usage site,
|
||||
** yet it is \em not a proper abstraction. Be sure you understand
|
||||
** the storage layout, especially when testing for iteration end.
|
||||
** @see generic-record-update-test.cpp
|
||||
** @see tree-diff-application-test.cpp
|
||||
** @see Record::Mutator
|
||||
|
|
@ -115,6 +118,15 @@ namespace diff{
|
|||
|
||||
void
|
||||
resetPos()
|
||||
{
|
||||
if (attribs.empty())
|
||||
jumpToChildScope();
|
||||
else
|
||||
jumpToAttribScope();
|
||||
}
|
||||
|
||||
void
|
||||
jumpToAttribScope()
|
||||
{
|
||||
pos = attribs.begin();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ namespace diff{
|
|||
void init()
|
||||
{
|
||||
target.swapContent (content);
|
||||
content.resetPos();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue