1#ifndef SOURCEMETA_CORE_DIFF_H_
2#define SOURCEMETA_CORE_DIFF_H_
4#ifndef SOURCEMETA_CORE_DIFF_EXPORT
5#include <sourcemeta/core/diff_export.h>
23namespace sourcemeta::core {
35 enum class Mode : std::uint8_t {
65 enum class Type : std::uint8_t {
85 auto operator==(
const Operation &)
const noexcept ->
bool =
default;
133SOURCEMETA_CORE_DIFF_EXPORT
134auto diff(
const std::string_view original,
const std::string_view modified,
162SOURCEMETA_CORE_DIFF_EXPORT
bool original_ends_with_newline
Whether the original input ended with a line terminator.
Definition diff.h:105
std::vector< std::string_view > original
The tokens of the original input.
Definition diff.h:99
std::vector< std::string_view > modified
The tokens of the modified input.
Definition diff.h:101
bool modified_ends_with_newline
Whether the modified input ended with a line terminator.
Definition diff.h:107
Algorithm
The strategy used to locate the common subsequences of two inputs.
Definition diff.h:41
@ Myers
Definition diff.h:46
std::vector< Operation > operations
The transformations that turn the original input into the modified one.
Definition diff.h:103
Format
The textual serialisation used to render a set of differences.
Definition diff.h:50
@ Unified
Definition diff.h:53
Mode
The granularity at which inputs are compared.
Definition diff.h:35
@ Line
Compare newline-delimited lines.
Definition diff.h:37
SOURCEMETA_CORE_DIFF_EXPORT auto diff(const std::string_view original, const std::string_view modified, const Diff::Mode mode, const Diff::Algorithm algorithm) -> Diff
SOURCEMETA_CORE_DIFF_EXPORT auto stringify(const Diff &document, std::ostream &stream, const Diff::Format format, const Diff::FormatOptions &options={}) -> void