monotone

monotone Mtn Source Tree

Root/xdelta.hh

1#ifndef __XDELTA_HH__
2#define __XDELTA_HH__
3
4// Copyright (C) 2002 Graydon Hoare <graydon@pobox.com>
5//
6// This program is made available under the GNU GPL version 2.0 or
7// greater. See the accompanying file COPYING for details.
8//
9// This program is distributed WITHOUT ANY WARRANTY; without even the
10// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11// PURPOSE.
12
13#include <boost/shared_ptr.hpp>
14#include "vocab.hh"
15
16void
17compute_delta(std::string const & a,
18 std::string const & b,
19 std::string & delta);
20
21void
22apply_delta(std::string const & a,
23 std::string const & delta,
24 std::string & b);
25
26
27// diffing and patching
28
29void diff(data const & olddata,
30 data const & newdata,
31 delta & del);
32
33void patch(data const & olddata,
34 delta const & del,
35 data & newdata);
36
37
38struct delta_applicator
39{
40 virtual ~delta_applicator () {}
41 virtual void begin(std::string const & base) = 0;
42 virtual void next() = 0;
43 virtual void finish(std::string & out) = 0;
44
45 virtual void copy(std::string::size_type pos, std::string::size_type len) = 0;
46 virtual void insert(std::string const & str) = 0;
47};
48
49boost::shared_ptr<delta_applicator> new_simple_applicator();
50boost::shared_ptr<delta_applicator> new_piecewise_applicator();
51
52void apply_delta(boost::shared_ptr<delta_applicator> da,
53 std::string const & delta);
54
55u64 measure_delta_target_size(std::string const & delta);
56void invert_xdelta(std::string const & old_str,
57 std::string const & delta,
58 std::string & delta_inverse);
59
60// Local Variables:
61// mode: C++
62// fill-column: 76
63// c-file-style: "gnu"
64// indent-tabs-mode: nil
65// End:
66// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:
67
68#endif // __XDELTA_HH__

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status