Lumiera  0.pre.03
»edit your freedom«
tree-diff.hpp
Go to the documentation of this file.
1 /*
2  TREE-DIFF.hpp - language to describe differences in hierarchical data structures
3 
4  Copyright (C)
5  2015, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 */
13 
14 
60 #ifndef LIB_DIFF_TREE_DIFF_H
61 #define LIB_DIFF_TREE_DIFF_H
62 
63 
65 #include "lib/diff/list-diff.hpp"
66 #include "lib/diff/gen-node.hpp"
67 
68 
69 namespace lib {
70 namespace diff{
71 
72 
126  {
127  public:
128  using Val = GenNode;
129 
130  virtual ~TreeDiffInterpreter() { }
131 
132  virtual void ins (GenNode const& n) =0;
133  virtual void del (GenNode const& n) =0;
134  virtual void pick(GenNode const& n) =0;
135  virtual void find(GenNode const& n) =0;
136  virtual void skip(GenNode const& n) =0;
137 
138  virtual void after(GenNode const&n) =0;
139  virtual void set (GenNode const& n) =0;
140  virtual void mut (GenNode const& n) =0;
141  virtual void emu (GenNode const& n) =0;
142  };
143 
145  : DiffLanguage<TreeDiffInterpreter, GenNode>
146  {
148 
149  // List Diff sub language
150  DiffStep_CTOR(ins);
151  DiffStep_CTOR(del);
152  DiffStep_CTOR(pick);
153  DiffStep_CTOR(find);
154  DiffStep_CTOR(skip);
155 
156  // Tree structure verbs
157  DiffStep_CTOR(after);
158  DiffStep_CTOR(set);
159  DiffStep_CTOR(mut);
160  DiffStep_CTOR(emu);
161  };
162 
163 
164 
165 
166 }} // namespace lib::diff
167 #endif /*LIB_DIFF_TREE_DIFF_H*/
Interpreter interface to define the operations ("verbs"), which describe differences or changes in hi...
Definition: tree-diff.hpp:125
A token language to represent changes in a list of elements.
Fundamental definitions for a representation of changes.
Implementation namespace for support and library code.
Generic building block for tree shaped (meta)data structures.
virtual ~TreeDiffInterpreter()
this is an interface
Definition: tree-diff.hpp:130
generic data element node within a tree
Definition: gen-node.hpp:222
Definition frame for a language to describe differences in data structures.
#define DiffStep_CTOR(_ID_)
shortcut to define tokens of the diff language.