2
General Guide to Textdeltas.... basic use of interfaces.
4
(Yes, the interfaces are a bit simplified. :) )
10
1. txdelta_stream = svn_txdelta (source_stream, target_stream);
12
2. Get window handler to do something with delta. If using an
13
"editor" to transmit information:
15
window_consumer_func = editor->apply_textdelta (file_baton);
17
If you want raw vcdiff data for embedding in XML or HTTP
20
window_consumer_func = svn_txdelta_to_vcdiff (txdelta_stream);
22
3. Loop until there are no more windows:
24
txdelta_window = svn_txdelta_next_window (txdelta_stream);
25
window_consumer_func (txdelta_window);
26
svn_txdelta_free_window (txdelta_window);
28
Be sure to call window_consumer_func with a NULL window when there
29
are no more windows to consume.
31
4. svn_txdelta_free (txdelta_stream);
37
If implementing "apply_textdelta" within an editor:
39
1. Get window handler to apply the text delta:
41
apply_handler = svn_txdelta_apply (read_func, write_func)
43
where read_func reads from the delta source and write_func writes
46
2. If you don't need to do any special cleanup, you can return
47
apply_handler to the caller directly. If you do need to do
48
cleanup, write your own window_consumer_func which invokes
49
apply_handler. In this case, your window handler will receive a
50
NULL window argument when there are no more windows to consume,
51
and you can do cleanup then. Be sure to pass a NULL window to
52
apply_handler when that happens so that it can clean up its own
55
If you want to receive raw vcdiff data from XML or HTTP transactions,
56
get or write a window consumer function and call:
58
vcdiff_parser = svn_make_vcdiff_parser (window_consumer_func);
60
Loop over vcdiff data:
61
svn_vcdiff_parse (vcdiff_parser, data);