diff options
author | Patrick Scott <phanna@android.com> | 2010-02-04 10:37:17 -0500 |
---|---|---|
committer | Patrick Scott <phanna@android.com> | 2010-02-04 10:39:42 -0500 |
commit | c7f5f8508d98d5952d42ed7648c2a8f30a4da156 (patch) | |
tree | dd51dbfbf6670daa61279b3a19e7b1835b301dbf /sdch/open-vcdiff/src/codetablewriter_interface.h | |
parent | 139d8152182f9093f03d9089822b688e49fa7667 (diff) | |
download | external_chromium-c7f5f8508d98d5952d42ed7648c2a8f30a4da156.zip external_chromium-c7f5f8508d98d5952d42ed7648c2a8f30a4da156.tar.gz external_chromium-c7f5f8508d98d5952d42ed7648c2a8f30a4da156.tar.bz2 |
Initial source checkin.
The source files were determined by building net_unittests in chromium's source
tree. Some of the obvious libraries were left out (v8, gmock, gtest).
The Android.mk file has all the sources (minus unittests and tools) that were
used during net_unittests compilation. Nothing builds yet because of STL but
that is the next task. The .cpp files will most likely not compile anyways
because of the LOCAL_CPP_EXTENSION mod. I will have to break this into multiple
projects to get around that limitation.
Diffstat (limited to 'sdch/open-vcdiff/src/codetablewriter_interface.h')
-rw-r--r-- | sdch/open-vcdiff/src/codetablewriter_interface.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/sdch/open-vcdiff/src/codetablewriter_interface.h b/sdch/open-vcdiff/src/codetablewriter_interface.h new file mode 100644 index 0000000..7f2875a --- /dev/null +++ b/sdch/open-vcdiff/src/codetablewriter_interface.h @@ -0,0 +1,53 @@ +// Copyright 2008 Google Inc. All Rights Reserved. +// Author: ajenjo@google.com (Lincoln Smith) +// +// Definition of an abstract class that describes the interface between the +// encoding engine (which finds the best string matches between the source and +// target data) and the code table writer. The code table writer is passed a +// series of Add, Copy, and Run instructions and produces an output file in the +// desired format. + +#ifndef OPEN_VCDIFF_CODETABLEWRITER_INTERFACE_H_ +#define OPEN_VCDIFF_CODETABLEWRITER_INTERFACE_H_ + +#include <stddef.h> // size_t + +namespace open_vcdiff { + +class OutputStringInterface; + +// The method calls after construction should follow this pattern: +// {{Add|Copy|Run}* Output}* +// +// Output() will produce an encoding using the given series of Add, Copy, +// and/or Run instructions. One implementation of the interface +// (VCDiffCodeTableWriter) produces a VCDIFF delta window, but other +// implementations may be used to produce other output formats, or as test +// mocks, or to gather encoding statistics. +// +class CodeTableWriterInterface { + public: + virtual ~CodeTableWriterInterface() { } + + // Encode an ADD opcode with the "size" bytes starting at data + virtual void Add(const char* data, size_t size) = 0; + + // Encode a COPY opcode with args "offset" (into dictionary) and "size" bytes. + virtual void Copy(int32_t offset, size_t size) = 0; + + // Encode a RUN opcode for "size" copies of the value "byte". + virtual void Run(size_t size, unsigned char byte) = 0; + + // Finishes encoding and appends the encoded delta window to the output + // string. The output string is not null-terminated and may contain embedded + // '\0' characters. + virtual void Output(OutputStringInterface* out) = 0; + + // Returns the number of target bytes processed, which is the sum of all the + // size arguments passed to Add(), Copy(), and Run(). + virtual size_t target_length() const = 0; +}; + +} // namespace open_vcdiff + +#endif // OPEN_VCDIFF_CODETABLEWRITER_INTERFACE_H_ |