Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
text_diff.hpp
Go to the documentation of this file.
1#pragma once
2
3// Simple text diff using LCS (Longest Common Subsequence)
4
5#include <string>
6#include <string_view>
7#include <vector>
8
9namespace pulp::runtime {
10
11enum class DiffOp { Equal, Insert, Delete };
12
13struct DiffEntry {
15 std::string text;
16};
17
20std::vector<DiffEntry> text_diff(std::string_view from, std::string_view to);
21
23std::string format_diff(const std::vector<DiffEntry>& diff);
24
25} // namespace pulp::runtime
Definition generated_event_source.hpp:33
DiffOp
Definition text_diff.hpp:11
@ Insert
Definition text_diff.hpp:11
@ Delete
Definition text_diff.hpp:11
@ Equal
Definition text_diff.hpp:11
std::vector< DiffEntry > text_diff(std::string_view from, std::string_view to)
Compute a line-based diff between two strings.
std::string format_diff(const std::vector< DiffEntry > &diff)
Format a diff as a unified diff string (with +/- prefixes).
Definition text_diff.hpp:13
std::string text
Definition text_diff.hpp:15
DiffOp op
Definition text_diff.hpp:14