Sourcemeta Core 0.0.0
Loading...
Searching...
No Matches
sourcemeta::core::Diff::FormatOptions Struct Reference

Controls the presentation of a rendered set of differences. More...

Public Types

enum class  LineType : std::uint8_t {
  HeaderOriginal , HeaderModified , Hunk , Context ,
  Delete , Insert , NoNewline
}
 The semantic role of a line in a unified diff. More...
using LineWriter

Public Attributes

std::string_view original_label {"a"}
 The name given to the original input in the header.
std::string_view modified_label {"b"}
 The name given to the modified input in the header.
std::size_t context {3}
 The number of unchanged lines shown around each change.
LineWriter line_writer {}
 Optional custom line writer for logical unified-diff lines.

Detailed Description

Controls the presentation of a rendered set of differences.

Member Typedef Documentation

◆ LineWriter

Initial value:
std::function<void(std::ostream &stream, LineType type,
std::string_view prefix, std::string_view content)>
LineType
The semantic role of a line in a unified diff.
Definition diff.h:92

Custom writer for rendering individual logical unified-diff lines.

The callback receives the destination stream, the line's semantic role, its textual prefix (such as "-" or "@@ "), and its content, both excluding the terminating newline. The callback is responsible for writing only the line body to the stream; Core unconditionally appends the terminating newline. Views passed to the callback are only guaranteed to remain valid for the duration of the callback.

Member Enumeration Documentation

◆ LineType

enum class sourcemeta::core::Diff::FormatOptions::LineType : std::uint8_t
strong

The semantic role of a line in a unified diff.

Enumerator
HeaderOriginal 

The header indicating the original document label.

HeaderModified 

The header indicating the modified document label.

Hunk 

A hunk range header.

Context 

An unchanged context line.

Delete 

A deleted line from the original document.

Insert 

An inserted line into the modified document.

NoNewline 

The marker indicating a missing final newline.


The documentation for this struct was generated from the following file:
  • /__w/core/core/src/core/diff/include/sourcemeta/core/diff.h