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
15void
16compute_delta(std::string const & a,
17 std::string const & b,
18 std::string & delta);
19
20void
21apply_delta(std::string const & a,
22 std::string const & delta,
23 std::string & b);
24
25
26struct delta_applicator
27{
28 virtual ~delta_applicator () {}
29 virtual void begin(std::string const & base) = 0;
30 virtual void next() = 0;
31 virtual void finish(std::string & out) = 0;
32
33 virtual void copy(std::string::size_type pos, std::string::size_type len) = 0;
34 virtual void insert(std::string const & str) = 0;
35};
36
37boost::shared_ptr<delta_applicator> new_simple_applicator();
38boost::shared_ptr<delta_applicator> new_piecewise_applicator();
39
40void apply_delta(boost::shared_ptr<delta_applicator> da,
41 std::string const & delta);
42
43u64 measure_delta_target_size(std::string const & delta);
44void invert_xdelta(std::string const & old_str,
45 std::string const & delta,
46 std::string & delta_inverse);
47
48// Local Variables:
49// mode: C++
50// fill-column: 76
51// c-file-style: "gnu"
52// indent-tabs-mode: nil
53// End:
54// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:
55
56#endif // __XDELTA_HH__

Archive Download this file

Branches

Tags

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