Skip to content

✂️ A lightweight C++ library to diff and patch arbitrary data

License

Notifications You must be signed in to change notification settings

r-lyeh-archived/collage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Collage

  • Collage is a lightweight C++ library to diff and patch data.
  • Collage provides interface to bsdiff/bspatch libraries (for now).
  • Collage is tiny. Single header and source files.
  • Collage is stand-alone. All dependencies are embedded.
  • Collage is cross-platform.
  • Collage is zlib/libpng licensed.

sample

#include <iostream>
#include <cassert>
#include "collage.hpp"

int main() {
    std::string source = "hello world and thanks";
    std::string target = "hello cruel \x1 world. thanks for the fish.";

    std::string patch = collage::diff( source, target );
    assert( !patch.empty() );

    std::string patched = collage::patch( source, patch );
    assert( !patched.empty() );
    assert( target == patched );

    std::cout << "'" << source << "' + " << patch.size() << "-bytes patch == '" << patched << "'" << std::endl;
    std::cout << "All ok." << std::endl;
}

possible output

'hello world and thanks' + 46-bytes patch == 'hello cruel ☺ world. thanks for the fish.'
All ok.

licenses

  • collage, zlib/libpng licensed.
  • bsdiff, by Colin Percival and Matthew Endsley, BSD2 licensed.
  • sais-lite, by Yuta Mori, MIT licensed.

About

✂️ A lightweight C++ library to diff and patch arbitrary data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published