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

Archive Download this file

Branches

Tags

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