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) Lumiera.org
5  2015, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 
69 #ifndef LIB_DIFF_TREE_DIFF_H
70 #define LIB_DIFF_TREE_DIFF_H
71 
72 
74 #include "lib/diff/list-diff.hpp"
75 #include "lib/diff/gen-node.hpp"
76 
77 
78 namespace lib {
79 namespace diff{
80 
81 
135  {
136  public:
137  using Val = GenNode;
138 
139  virtual ~TreeDiffInterpreter() { }
140 
141  virtual void ins (GenNode const& n) =0;
142  virtual void del (GenNode const& n) =0;
143  virtual void pick(GenNode const& n) =0;
144  virtual void find(GenNode const& n) =0;
145  virtual void skip(GenNode const& n) =0;
146 
147  virtual void after(GenNode const&n) =0;
148  virtual void set (GenNode const& n) =0;
149  virtual void mut (GenNode const& n) =0;
150  virtual void emu (GenNode const& n) =0;
151  };
152 
154  : DiffLanguage<TreeDiffInterpreter, GenNode>
155  {
157 
158  // List Diff sub language
159  DiffStep_CTOR(ins);
160  DiffStep_CTOR(del);
161  DiffStep_CTOR(pick);
162  DiffStep_CTOR(find);
163  DiffStep_CTOR(skip);
164 
165  // Tree structure verbs
166  DiffStep_CTOR(after);
167  DiffStep_CTOR(set);
168  DiffStep_CTOR(mut);
169  DiffStep_CTOR(emu);
170  };
171 
172 
173 
174 
175 }} // namespace lib::diff
176 #endif /*LIB_DIFF_TREE_DIFF_H*/
Interpreter interface to define the operations ("verbs"), which describe differences or changes in hi...
Definition: tree-diff.hpp:134
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:139
generic data element node within a tree
Definition: gen-node.hpp:231
Definition frame for a language to describe differences in data structures.
#define DiffStep_CTOR(_ID_)
shortcut to define tokens of the diff language.