• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

antonvw / wex / 25992162285

17 May 2026 01:26PM UTC coverage: 64.774% (-0.008%) from 64.782%
25992162285

push

github

web-flow
handled old review comments (#1255)

* handled old review comments

* changes after review

18945 of 32136 branches covered (58.95%)

Branch coverage included in aggregate %.

15134 of 20476 relevant lines covered (73.91%)

1528.75 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

45.05
/src/factory/unified-diff.cpp
1
////////////////////////////////////////////////////////////////////////////////
2
// Name:      unified-diff.cpp
3
// Purpose:   Implementation of class wex::factory::unified_diff
4
//            https://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html
5
// Author:    Anton van Wezenbeek
6
// Copyright: (c) 2024-2026 Anton van Wezenbeek
7
////////////////////////////////////////////////////////////////////////////////
8

9
#include <wex/core/log.h>
10
#include <wex/factory/frame.h>
11
#include <wex/factory/unified-diff.h>
12
#include <wx/app.h>
13

14
#include <algorithm>
15
#include <utility>
16

17
#include "unified-diff-parser.h"
18

19
wex::factory::unified_diff::unified_diff(
31✔
20
  std::string     input,
21
  factory::frame* frame)
31✔
22
  : m_input(std::move(input))
31✔
23
  , m_range{0, 0, 0, 0}
31✔
24
  , m_frame(frame)
31✔
25
{
26
  if (
31✔
27
    auto* frame = dynamic_cast<wex::factory::frame*>(wxTheApp->GetTopWindow());
31!
28
    frame != nullptr && m_frame == nullptr)
31✔
29
  {
30
    m_frame = frame;
25✔
31
  }
32
}
31✔
33

34
bool wex::factory::unified_diff::parse()
21✔
35
{
36
  if (m_frame != nullptr)
21!
37
  {
38
    m_frame->page_save();
21✔
39
  }
40

41
  const bool result(unified_diff_parser(this).parse());
21✔
42

43
  if (m_frame != nullptr)
21!
44
  {
45
    m_frame->page_restore();
21✔
46
  }
47

48
  return result;
21✔
49
}
50

51
bool wex::factory::unified_diff::report_diff()
16✔
52
{
53
  return m_frame != nullptr && m_frame->report_unified_diff(this);
16!
54
}
55

56
void wex::factory::unified_diff::report_diff_finish()
13✔
57
{
58
  if (m_frame != nullptr)
13!
59
  {
60
    m_frame->report_unified_diff(this);
13✔
61
  }
62
}
13✔
63

64
wex::path wex::factory::unified_diff::report_path() const
1✔
65
{
66
  return path_to();
1✔
67
}
68

69
void wex::factory::unified_diff::trace(const std::string& text) const
45✔
70
{
71
  if (log::get_level() != log::level_t::TRACE)
45!
72
  {
73
    return;
45✔
74
  }
75

76
  using boost::describe::operators::operator<<;
77

78
  std::stringstream str;
×
79
  str << "type: " << boost::describe::enum_to_string(m_type, "none") << " "
×
80
      << *this << " ranges: ";
×
81

82
  std::ranges::for_each(
×
83
    m_range,
×
84
    [this, &str](const auto& it)
×
85
    {
86
      str << std::to_string(it) << ",";
×
87
    });
×
88

89
  str << " text sizes: ";
×
90

91
  std::ranges::for_each(
×
92
    m_text,
×
93
    [this, &str](const auto& it)
×
94
    {
95
      str << it.size() << ",";
×
96
    });
×
97

98
  str << " paths: ";
×
99

100
  std::ranges::for_each(
×
101
    m_path,
×
102
    [this, &str](const auto& it)
×
103
    {
104
      str << it.string() << ",";
×
105
    });
×
106

107
  log::trace("unified_diff::" + text) << str.str();
×
108
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc