11 * This class describes a hunk of changes from diff.
12 * Hunk is aggregation of snippets.
16 std::vector
<Snippet
*> _snippets
;//! list of snippets
17 int _original_from_line
;//! line on which begin changes in original file
18 int _modified_from_line
;//! line on which begin changes in modified file
20 void _copy(const Hunk
&);
23 class iterator
; // front declaration
25 Hunk(const int original_from
, const int modified_from
) :
26 _original_from_line(original_from
),
27 _modified_from_line(modified_from
){}
28 Hunk(const Hunk
&h
){ _copy(h
); }
31 Hunk
&operator=(const Hunk
&h
){ _free(); _copy(h
); return *this; }
33 void addSnippet(Snippet
*sn
){ _snippets
.push_back(sn
); }
34 int numSnippets() const { return _snippets
.size(); }
36 int originalBeginsAt() const { return _original_from_line
;}
37 int modifiedBeginsAt() const { return _modified_from_line
;}
39 iterator
begin() const;
43 * Iterator over _snippets.
45 class iterator
: public VectorPointerIterator
<Snippet
>{
47 friend iterator
Hunk::begin() const;
48 friend iterator
Hunk::end() const;