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

antonvw / wex / 19969113179

29 Nov 2025 02:52PM UTC coverage: 64.373% (+0.004%) from 64.369%
19969113179

push

github

web-flow
improved xml fold all (#1097)

18553 of 31591 branches covered (58.73%)

Branch coverage included in aggregate %.

14726 of 20106 relevant lines covered (73.24%)

1521.92 hits per line

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

47.83
/src/syntax/util.cpp
1
////////////////////////////////////////////////////////////////////////////////
2
// Name:      util.cpp
3
// Purpose:   Implementation of wex syntax utility methods
4
// Author:    Anton van Wezenbeek
5
// Copyright: (c) 2022-2025 Anton van Wezenbeek
6
////////////////////////////////////////////////////////////////////////////////
7

8
#include <wex/syntax/stc.h>
9
#include <wex/syntax/util.h>
10
#include <wx/choicdlg.h>
11

12
int wex::find_xml_root(wxStyledTextCtrl* stc)
3✔
13
{
14
  stc->SetSearchFlags(wxSTC_FIND_REGEXP | wxSTC_FIND_CXX11REGEX);
3✔
15
  stc->SetTargetRange(0, 1000);
3✔
16

17
  const auto pos(stc->SearchInTarget("<[^?].*>"));
3✔
18

19
  if (pos == -1)
3✔
20
  {
21
    return 0;
2✔
22
  }
23

24
  return stc->LineFromPosition(pos);
1✔
25
}
26

27
void wex::node_properties(
365✔
28
  const pugi::xml_node*  node,
29
  std::vector<property>& properties)
30
{
31
  for (const auto& child : node->children("property"))
2,785✔
32
  {
33
    properties.emplace_back(child);
1,210✔
34
  }
35
}
365✔
36

37
void wex::node_styles(
235✔
38
  const pugi::xml_node* node,
39
  const std::string&    lexer,
40
  std::vector<style>&   styles)
41
{
42
  for (const auto& child : node->children("style"))
4,085✔
43
  {
44
    styles.emplace_back(child, lexer);
1,925✔
45
  }
46
}
235✔
47

48
bool wex::single_choice_dialog(
×
49
  const data::window&             data,
50
  const std::vector<std::string>& v,
51
  std::string&                    selection)
52
{
53
  wxArrayString s;
×
54

55
  for (const auto& it : v)
×
56
  {
57
    s.Add(it);
×
58
  }
59

60
  wxSingleChoiceDialog dlg(data.parent(), _("Input") + ":", data.title(), s);
×
61

62
  if (data.size() != wxDefaultSize)
×
63
  {
64
    dlg.SetSize(data.size());
×
65
  }
66

67
  if (const auto index = s.Index(selection); index != wxNOT_FOUND)
×
68
  {
69
    dlg.SetSelection(index);
×
70
  }
71
  if (dlg.ShowModal() == wxID_CANCEL)
×
72
  {
73
    return false;
×
74
  }
75

76
  selection = dlg.GetStringSelection();
×
77

78
  return true;
×
79
}
×
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