/* * Copyright (c) 2020, Itamar S. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include namespace Diff { struct HunkLocation { size_t original_start_line { 0 }; size_t original_length { 0 }; size_t target_start_line { 0 }; size_t target_length { 0 }; enum class LocationType { Original, Target, Both }; void apply_offset(size_t offset, LocationType); }; struct Hunk { size_t original_start_line { 0 }; size_t target_start_line { 0 }; Vector removed_lines; Vector added_lines; }; Vector parse_hunks(String const& diff); HunkLocation parse_hunk_location(String const& location_line); };