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

ossia / score / 36213733900

26 Sep 2026 03:05AM UTC coverage: 42.353% (+0.1%) from 42.23%
36213733900

Pull #2310

github

web-flow
Merge 9f9d60cd9 into c0c64ec39
Pull Request #2310: bitfocus: host companion modules the way companion does

41 of 2024 new or added lines in 11 files covered. (2.03%)

210 existing lines in 15 files now uncovered.

126773 of 299323 relevant lines covered (42.35%)

118427.51 hits per line

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

67.06
/src/plugins/score-plugin-protocols/Protocols/Bitfocus/BitfocusSpecificSettingsSerialization.cpp
1
// This is an open source non-commercial project. Dear PVS-Studio, please check
2
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
3
#include "BitfocusSpecificSettings.hpp"
4

5
#include "BitfocusContext.hpp"
6

7
#include <State/Value.hpp>
8
#include <State/ValueSerialization.hpp>
9

10
#include <Protocols/NetworkWidgets/Serialization.hpp>
11

12
#include <score/serialization/BoostVariant2Serialization.hpp>
13
#include <score/serialization/DataStreamVisitor.hpp>
14
#include <score/serialization/JSONVisitor.hpp>
15
#include <score/tools/FilePath.hpp>
16

17
#include <ossia-qt/js_utilities.hpp>
18

19
#include <set>
20
#include <vector>
21

22
QString Protocols::BitfocusSpecificSettings::enumeratorLabel() const
×
23
{
24
  const QString& prod = product.isEmpty() ? name : product;
×
25
  return brand.isEmpty() ? prod : brand + ": " + prod;
×
26
}
27

28
void Protocols::BitfocusSpecificSettings::deduplicateConfiguration()
4✔
29
{
30
  std::set<QString> seen;
4✔
31
  std::erase_if(configuration, [&seen](const auto& kv) {
4✔
32
    return !seen.insert(kv.first).second;
×
33
  });
34
}
4✔
35

36
std::map<QString, QVariant>
NEW
37
Protocols::BitfocusSpecificSettings::moduleConfiguration() const
×
38
{
NEW
39
  std::map<QString, QVariant> conf;
×
NEW
40
  if(!product.isEmpty())
×
NEW
41
    conf["product"] = product;
×
NEW
42
  for(auto& [k, v] : configuration)
×
NEW
43
    conf[k] = bitfocus::widenFloat(v.apply(ossia::qt::ossia_to_qvariant{}));
×
NEW
44
  return conf;
×
NEW
45
}
×
46

47
std::shared_ptr<bitfocus::module_handler>
NEW
48
Protocols::BitfocusSpecificSettings::makeHandler(const QString& label) const
×
49
{
NEW
50
  return std::make_shared<bitfocus::module_handler>(
×
NEW
51
      path, entrypoint, nodeVersion, apiVersion, moduleConfiguration(), label,
×
NEW
52
      configuration.empty() && !upgradeIndex, upgradeIndex,
×
NEW
53
      secretKeys ? std::optional{std::set<QString>(secretKeys->begin(), secretKeys->end())}
×
NEW
54
                 : std::nullopt);
×
NEW
55
}
×
56

57
template <>
58
void DataStreamReader::read(const Protocols::BitfocusSpecificSettings& n)
3✔
59
{
60
  m_stream << score::relativizeFilePath(n.path) << n.entrypoint << n.id << n.name
6✔
61
           << n.brand << n.product << n.nodeVersion << n.apiVersion << n.configuration
3✔
62
           << n.description << n.upgradeIndex.has_value() << n.upgradeIndex.value_or(-1)
3✔
63
           << n.secretKeys.has_value()
3✔
64
           << (n.secretKeys ? QStringList(n.secretKeys->begin(), n.secretKeys->end())
3✔
65
                            : QStringList{});
3✔
66
  insertDelimiter();
3✔
67
}
3✔
68

69
template <>
70
void DataStreamWriter::write(Protocols::BitfocusSpecificSettings& n)
2✔
71
{
72
  m_stream >> n.path >> n.entrypoint >> n.id >> n.name >> n.brand >> n.product
2✔
73
      >> n.nodeVersion >> n.apiVersion >> n.configuration >> n.description;
2✔
74
  bool hasUpgradeIndex{};
2✔
75
  int upgradeIndex{};
2✔
76
  bool hasSecretKeys{};
2✔
77
  QStringList secretKeys;
2✔
78
  m_stream >> hasUpgradeIndex >> upgradeIndex >> hasSecretKeys >> secretKeys;
2✔
79
  if(hasUpgradeIndex)
2✔
NEW
80
    n.upgradeIndex = upgradeIndex;
×
81
  if(hasSecretKeys)
2✔
NEW
82
    n.secretKeys = std::vector<QString>(secretKeys.begin(), secretKeys.end());
×
83
  n.path = score::locateFilePath(n.path);
2✔
84
  n.deduplicateConfiguration();
2✔
85
  checkDelimiter();
2✔
86
}
2✔
87

88
template <>
89
void JSONReader::read(const Protocols::BitfocusSpecificSettings& n)
3✔
90
{
91
  obj["Path"] = score::relativizeFilePath(n.path);
3✔
92
  obj["Entrypoint"] = n.entrypoint;
3✔
93
  obj["Identifier"] = n.id;
3✔
94
  obj["Name"] = n.name;
3✔
95
  obj["Brand"] = n.brand;
3✔
96
  obj["Product"] = n.product;
3✔
97
  obj["NodeVersion"] = n.nodeVersion;
3✔
98
  obj["APIVersion"] = n.apiVersion;
3✔
99
  obj["Configuration"] = n.configuration;
3✔
100
  obj["Description"] = n.description;
3✔
101
  if(n.upgradeIndex)
3✔
NEW
102
    obj["UpgradeIndex"] = *n.upgradeIndex;
×
103
  if(n.secretKeys)
3✔
NEW
104
    obj["SecretKeys"] = *n.secretKeys;
×
105
}
3✔
106

107
template <>
108
void JSONWriter::write(Protocols::BitfocusSpecificSettings& n)
2✔
109
{
110
  n.path <<= obj["Path"];
2✔
111
  n.path = score::locateFilePath(n.path);
2✔
112
  n.entrypoint <<= obj["Entrypoint"];
2✔
113
  n.id <<= obj["Identifier"];
2✔
114
  n.name <<= obj["Name"];
2✔
115
  n.brand <<= obj["Brand"];
2✔
116
  n.product <<= obj["Product"];
2✔
117
  n.nodeVersion <<= obj["NodeVersion"];
2✔
118
  n.apiVersion <<= obj["APIVersion"];
2✔
119
  n.configuration <<= obj["Configuration"];
2✔
120
  n.description <<= obj["Description"];
2✔
121
  if(auto idx = obj.tryGet("UpgradeIndex"))
2✔
NEW
122
    n.upgradeIndex = idx->toInt();
×
123
  if(auto keys = obj.tryGet("SecretKeys"))
2✔
124
  {
NEW
125
    std::vector<QString> v;
×
NEW
126
    v <<= *keys;
×
NEW
127
    n.secretKeys = std::move(v);
×
NEW
128
  }
×
129
  n.deduplicateConfiguration();
2✔
130
}
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc