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

graphia-app / graphia / 41618190308

03 Nov 2026 12:10AM UTC coverage: 71.393% (+0.06%) from 71.33%
41618190308

push

github

timangus
Identify proxy types by value, not by their translated names

11761 of 18022 branches covered (65.26%)

Branch coverage included in aggregate %.

29963 of 40421 relevant lines covered (74.13%)

197248.64 hits per line

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

93.73
/source/app/transform/graphtransformconfig.cpp
1
/* Copyright © 2013-2025 Tim Angus
2
 * Copyright © 2013-2025 Tom Freeman
3
 *
4
 * This file is part of Graphia.
5
 *
6
 * Graphia is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * Graphia is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with Graphia.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19

20
#include "graphtransformconfig.h"
21

22
#include "graphtransform.h"
23
#include "graphtransformconfigparser.h"
24
#include "transformdisplaytext.h"
25

26
#include "app/configgrammar.h"
27
#include "app/attributes/attribute.h"
28

29
#include "shared/utils/container.h"
30

31
#include <QLocale>
32
#include <QObject>
33
#include <QStringList>
34
#include <QtGlobal>
35
#include <QVariantList>
36

37
#include <algorithm>
38
#include <cmath>
39
#include <map>
40

41
using namespace Qt::Literals::StringLiterals;
42

43
// Enforce consistency in rendering doubles to string
44
static QString doubleAsString(double d)
45
{
388 ✔
46
    auto string = QString::number(d, 'g', QLocale::FloatingPointShortest);
388 ✔
47

48
    if(std::isfinite(d) && !string.contains(u'.') && !string.contains(u'e'))
388 !
49
        string += u".0"_s;
20 ✔
50

51
    return string;
388 ✔
52
}
388 ✔
53

54
bool GraphTransformConfig::TerminalCondition::operator==(const GraphTransformConfig::TerminalCondition& other) const
55
{
74 ✔
56
    return _lhs == other._lhs &&
74 ✔
57
            _op == other._op &&
74 !
58
            _rhs == other._rhs;
74 ✔
59
}
74 ✔
60

61

62
bool GraphTransformConfig::UnaryCondition::operator==(const GraphTransformConfig::UnaryCondition& other) const
63
{
4 ✔
64
    return _lhs == other._lhs &&
4 !
65
            _op == other._op;
4 !
66
}
4 ✔
67

68
QString GraphTransformConfig::TerminalCondition::opAsString() const
69
{
980 ✔
70
    struct Visitor
980 ✔
71
    {
980 ✔
72
        QString operator()(ConditionFnOp::Equality v) const  { return GraphTransformConfigParser::opToString(v); }
980 ✔
73
        QString operator()(ConditionFnOp::Numerical v) const { return GraphTransformConfigParser::opToString(v); }
980 ✔
74
        QString operator()(ConditionFnOp::String v) const    { return GraphTransformConfigParser::opToString(v); }
980 ✔
75
    };
980 ✔
76

77
    return std::visit(Visitor(), _op);
980 ✔
78
}
980 ✔
79

80
QString GraphTransformConfig::UnaryCondition::opAsString() const
81
{
12 ✔
82
    return GraphTransformConfigParser::opToString(_op);
12 ✔
83
}
12 ✔
84

85
bool GraphTransformConfig::CompoundCondition::operator==(const GraphTransformConfig::CompoundCondition& other) const
86
{
16 ✔
87
    return _lhs == other._lhs &&
16 !
88
            _op == other._op &&
16 !
89
            _rhs == other._rhs;
16 !
90
}
16 ✔
91

92
QString GraphTransformConfig::CompoundCondition::opAsString() const
93
{
48 ✔
94
    return GraphTransformConfigParser::opToString(_op);
48 ✔
95
}
48 ✔
96

97
bool GraphTransformConfig::Parameter::operator==(const GraphTransformConfig::Parameter& other) const
98
{
108 ✔
99
    return _name == other._name &&
108 ✔
100
            _value == other._value;
108 !
101
}
108 ✔
102

103
const std::vector<QString>& GraphTransformConfig::attributeNames() const
104
{
246 ✔
105
    return _attributes;
246 ✔
106
}
246 ✔
107

108
bool GraphTransformConfig::hasParameter(const QString& name) const
109
{
308 ✔
110
    return std::ranges::find_if(_parameters,
308 ✔
111
    [&name](const auto& parameter) { return name == parameter._name; }) != _parameters.end();
396 ✔
112
}
308 ✔
113

114
const GraphTransformConfig::Parameter* GraphTransformConfig::parameterByName(const QString &name) const
115
{
334 ✔
116
    auto it = std::ranges::find_if(_parameters,
334 ✔
117
        [&name](const auto& parameter) { return name == parameter._name; });
490 ✔
118

119
    if(it != _parameters.end())
334 !
120
        return &(*it);
334 ✔
121

122
    qFatal("Parameter not found");
334 ✔
123
    return nullptr;
×
124
}
334 ✔
125

126
bool GraphTransformConfig::parameterHasValue(const QString& name, const QString& value) const
127
{
30 ✔
128
    if(!hasParameter(name))
30 !
129
        return false;
×
130

131
    return parameterByName(name)->valueAsString() == value;
30 ✔
132
}
30 ✔
133

134
void GraphTransformConfig::setParameterValue(const QString& name,
135
    const GraphTransformConfig::ParameterValue& value)
136
{
100 ✔
137
    auto it = std::ranges::find_if(_parameters,
100 ✔
138
        [&name](const auto& parameter) { return name == parameter._name; });
100 ✔
139

140
    if(it != _parameters.end())
100 !
141
        it->_value = value;
×
142
    else
100 ✔
143
        _parameters.emplace_back(Parameter{._name = name, ._value = value});
100 ✔
144
}
100 ✔
145

146
QString GraphTransformConfig::Parameter::valueAsString(NamedBool<"forExpression"> forExpression) const
147
{
578 ✔
148
    struct Visitor
578 ✔
149
    {
578 ✔
150
        NamedBool<"forExpression"> _forExpression;
578 ✔
151

152
        explicit Visitor(NamedBool<"forExpression"> forExpression_) : _forExpression(forExpression_) {}
578 ✔
153

154
        QString operator()(double d) const          { return doubleAsString(d); }
578 ✔
155
        QString operator()(int i) const             { return QString::number(i); }
578 ✔
156
        QString operator()(const QString& s) const
578 ✔
157
        {
578 ✔
158
            if(_forExpression)
436 ✔
159
                return LexyConfigGrammar::stringForExpression(s);
186 ✔
160

161
            return s;
250 ✔
162
        }
436 ✔
163
    };
578 ✔
164

165
    return std::visit(Visitor(forExpression), _value);
578 ✔
166
}
578 ✔
167

168
bool GraphTransformConfig::hasCondition() const
169
{
1,362 ✔
170
    struct ConditionVisitor
1,362 ✔
171
    {
1,362 ✔
172
        bool operator()(GraphTransformConfig::NoCondition) const { return false; }
1,362 ✔
173
        bool operator()(const TerminalCondition&) const { return true; }
1,362 ✔
174
        bool operator()(const UnaryCondition&) const { return true; }
1,362 ✔
175
        bool operator()(const RecursiveValue<CompoundCondition>&) const { return true; }
1,362 ✔
176
    };
1,362 ✔
177

178
    return std::visit(ConditionVisitor(), _condition);
1,362 ✔
179
}
1,362 ✔
180

181
QVariantMap GraphTransformConfig::conditionAsVariantMap() const
182
{
30 ✔
183
    struct ConditionVisitor
30 ✔
184
    {
30 ✔
185
        static QString terminalValueAsString(const GraphTransformConfig::TerminalValue& terminalValue)
30 ✔
186
        {
66 ✔
187
            struct Visitor
66 ✔
188
            {
66 ✔
189
                QString operator()(const double& d) const       { return doubleAsString(d); }
66 ✔
190
                QString operator()(const int& i) const          { return QString::number(i); }
66 ✔
191
                QString operator()(const QString& s) const      { return s; }
66 ✔
192
                QString operator()(const AttributeRef& a) const { return a._name; }
66 ✔
193
            };
66 ✔
194

195
            return std::visit(Visitor(), terminalValue);
66 ✔
196
        }
66 ✔
197

198
        QVariantMap operator()(GraphTransformConfig::NoCondition) const { return {}; }
30 ✔
199
        QVariantMap operator()(const TerminalCondition& terminalCondition) const
30 ✔
200
        {
32 ✔
201
            QVariantMap map;
32 ✔
202

203
            map.insert(u"lhs"_s, terminalValueAsString(terminalCondition._lhs));
32 ✔
204
            map.insert(u"lhsIsName"_s, std::holds_alternative<AttributeRef>(terminalCondition._lhs));
32 ✔
205
            map.insert(u"op"_s, terminalCondition.opAsString());
32 ✔
206
            map.insert(u"rhs"_s, terminalValueAsString(terminalCondition._rhs));
32 ✔
207
            map.insert(u"rhsIsName"_s, std::holds_alternative<AttributeRef>(terminalCondition._rhs));
32 ✔
208

209
            return map;
32 ✔
210
        }
32 ✔
211

212
        QVariantMap operator()(const UnaryCondition& unaryCondition) const
30 ✔
213
        {
30 ✔
214
            QVariantMap map;
2 ✔
215

216
            map.insert(u"lhs"_s, terminalValueAsString(unaryCondition._lhs));
2 ✔
217
            map.insert(u"lhsIsName"_s, std::holds_alternative<AttributeRef>(unaryCondition._lhs));
2 ✔
218
            map.insert(u"op"_s, unaryCondition.opAsString());
2 ✔
219

220
            return map;
2 ✔
221
        }
2 ✔
222

223
        QVariantMap operator()(const RecursiveValue<CompoundCondition>& wrapper) const
30 ✔
224
        {
30 ✔
225
            const auto& compoundCondition = *wrapper;
4 ✔
226
            QVariantMap map;
4 ✔
227
            auto lhs = std::visit(ConditionVisitor(), compoundCondition._lhs);
4 ✔
228
            auto rhs = std::visit(ConditionVisitor(), compoundCondition._rhs);
4 ✔
229

230
            map.insert(u"lhs"_s, lhs);
4 ✔
231
            map.insert(u"op"_s, compoundCondition.opAsString());
4 ✔
232
            map.insert(u"rhs"_s, rhs);
4 ✔
233

234
            return map;
4 ✔
235
        }
4 ✔
236
    };
30 ✔
237

238
    return std::visit(ConditionVisitor(), _condition);
30 ✔
239
}
30 ✔
240

241
QString GraphTransformConfig::conditionAsString(NamedBool<"forDisplay"> forDisplay,
242
    const AttributeDisplayNameFn& attributeDisplayName, const AttributeDisplayValueFn& attributeDisplayValue) const
243
{
914 ✔
244
    struct ConditionVisitor
914 ✔
245
    {
914 ✔
246
        ConditionVisitor(NamedBool<"forDisplay"> forDisplay, const AttributeDisplayNameFn& attributeDisplayName,
914 ✔
247
            const AttributeDisplayValueFn& attributeDisplayValue) :
914 ✔
248
            _forDisplay(forDisplay), _attributeDisplayName(attributeDisplayName),
1,002 ✔
249
            _attributeDisplayValue(attributeDisplayValue) {}
1,002 ✔
250

251
        NamedBool<"forDisplay"> _forDisplay;
914 ✔
252
        AttributeDisplayNameFn _attributeDisplayName;
914 ✔
253
        AttributeDisplayValueFn _attributeDisplayValue;
914 ✔
254

255
        QString terminalValueAsString(const GraphTransformConfig::TerminalValue& terminalValue) const
914 ✔
256
        {
1,906 ✔
257
            struct Visitor
1,906 ✔
258
            {
1,906 ✔
259
                Visitor(NamedBool<"forDisplay"> forDisplay, const AttributeDisplayNameFn& attributeDisplayName) :
1,906 ✔
260
                    _forDisplay(forDisplay), _attributeDisplayName(attributeDisplayName) {}
1,906 ✔
261

262
                NamedBool<"forDisplay"> _forDisplay;
1,906 ✔
263
                AttributeDisplayNameFn _attributeDisplayName;
1,906 ✔
264

265
                QString operator()(const double& d) const   { return doubleAsString(d); }
1,906 ✔
266
                QString operator()(const int& i) const      { return QString::number(i); }
1,906 ✔
267
                QString operator()(const QString& s) const
1,906 ✔
268
                {
1,906 ✔
269
                    return _forDisplay ? s : LexyConfigGrammar::stringForExpression(s);
136 ✔
270
                }
136 ✔
271

272
                QString operator()(const AttributeRef& a) const
1,906 ✔
273
                {
1,906 ✔
274
                    if(_forDisplay)
958 ✔
275
                    {
22 ✔
276
                        return _attributeDisplayName ? _attributeDisplayName(a._name) :
22 !
277
                            Attribute::fullyQualifiedDisplayName(a._name, [](const QString& name) { return name; });
22 ✔
278
                    }
22 ✔
279

280
                    return u"$%1"_s.arg(Attribute::attributeNameForExpression(a._name));
936 ✔
281
                }
958 ✔
282
            };
1,906 ✔
283

284
            return std::visit(Visitor(_forDisplay, _attributeDisplayName), terminalValue);
1,906 ✔
285
        }
1,906 ✔
286

287
        QString applyOp(const QString& op, const QString& lhs, const QString& rhs) const
914 ✔
288
        {
992 ✔
289
            if(_forDisplay)
992 ✔
290
                return GraphTransformConfigParser::opDisplayText(op)._phrase.arg(lhs, rhs);
32 ✔
291

292
            return u"%1 %2 %3"_s.arg(lhs, op, rhs);
960 ✔
293
        }
992 ✔
294

295
        QString applyOp(const QString& op, const QString& lhs) const
914 ✔
296
        {
914 ✔
297
            if(_forDisplay)
10 !
298
                return GraphTransformConfigParser::opDisplayText(op)._phrase.arg(lhs);
×
299

300
            return u"%1 %2"_s.arg(lhs, op);
10 ✔
301
        }
10 ✔
302

303
        QString operator()(GraphTransformConfig::NoCondition) const { return {}; }
914 ✔
304
        QString operator()(const TerminalCondition& terminalCondition) const
914 ✔
305
        {
948 ✔
306
            auto rhs = terminalValueAsString(terminalCondition._rhs);
948 ✔
307

308
            if(_forDisplay && _attributeDisplayValue)
948 !
309
            {
22 ✔
310
                const auto* attribute = std::get_if<AttributeRef>(&terminalCondition._lhs);
22 ✔
311
                const auto* value = std::get_if<QString>(&terminalCondition._rhs);
22 ✔
312

313
                if(attribute != nullptr && value != nullptr)
22 !
314
                    rhs = _attributeDisplayValue(attribute->_name, *value);
14 ✔
315
            }
22 ✔
316

317
            return applyOp(terminalCondition.opAsString(),
948 ✔
318
                terminalValueAsString(terminalCondition._lhs), rhs);
948 ✔
319
        }
948 ✔
320

321
        QString operator()(const UnaryCondition& unaryCondition) const
914 ✔
322
        {
914 ✔
323
            return applyOp(unaryCondition.opAsString(),
10 ✔
324
                terminalValueAsString(unaryCondition._lhs));
10 ✔
325
        }
10 ✔
326

327
        QString operator()(const RecursiveValue<CompoundCondition>& wrapper) const
914 ✔
328
        {
914 ✔
329
            const auto& compoundCondition = *wrapper;
44 ✔
330

331
            auto operandAsString = [this](const Condition& operand)
44 ✔
332
            {
88 ✔
333
                auto s = std::visit(ConditionVisitor(_forDisplay, _attributeDisplayName, _attributeDisplayValue), operand);
88 ✔
334

335
                if(std::holds_alternative<RecursiveValue<CompoundCondition>>(operand))
88 ✔
336
                    return u"(%1)"_s.arg(s);
12 ✔
337

338
                return s;
76 ✔
339
            };
88 ✔
340

341
            auto lhs = operandAsString(compoundCondition._lhs);
44 ✔
342
            auto rhs = operandAsString(compoundCondition._rhs);
44 ✔
343

344
            return applyOp(compoundCondition.opAsString(), lhs, rhs);
44 ✔
345
        }
44 ✔
346
    };
914 ✔
347

348
    return std::visit(ConditionVisitor(forDisplay, attributeDisplayName, attributeDisplayValue), _condition);
914 ✔
349
}
914 ✔
350

351
QVariantMap GraphTransformConfig::asVariantMap(const GraphTransformFactory* factory) const
352
{
54 ✔
353
    QVariantMap map;
54 ✔
354

355
    QVariantList flags;
54 ✔
356
    flags.reserve(static_cast<int>(_flags.size()));
54 ✔
357
    for(const auto& flag : _flags)
54 ✔
358
        flags.append(flag);
8 ✔
359
    map.insert(u"flags"_s, flags);
54 ✔
360

361
    map.insert(u"action"_s, _action);
54 ✔
362
    map.insert(u"displayName"_s, factory != nullptr ? factory->displayName() : _action);
54 ✔
363

364
    QStringList attributes;
54 ✔
365
    attributes.reserve(static_cast<int>(_attributes.size()));
54 ✔
366
    for(const auto& attribute : _attributes)
54 ✔
367
        attributes.append(Attribute::attributeNameForExpression(attribute));
12 ✔
368
    map.insert(u"attributes"_s, attributes);
54 ✔
369

370
    QVariantList parameters;
54 ✔
371
    for(const auto& parameter : _parameters)
54 ✔
372
    {
26 ✔
373
        QVariantMap parameterMap;
26 ✔
374
        parameterMap.insert(u"name"_s, parameter._name);
26 ✔
375
        parameterMap.insert(u"value"_s, parameter.valueAsString());
26 ✔
376
        parameters.append(parameterMap);
26 ✔
377
    }
26 ✔
378
    map.insert(u"parameters"_s, parameters);
54 ✔
379

380
    if(hasCondition())
54 ✔
381
        map.insert(u"condition"_s, conditionAsVariantMap());
30 ✔
382

383
    return map;
54 ✔
384
}
54 ✔
385

386
QString GraphTransformConfig::asString(NamedBool<"forDisplay"> forDisplay, const GraphTransformFactory* factory,
387
    const AttributeDisplayNameFn& attributeDisplayName, const AttributeDisplayValueFn& attributeDisplayValue) const
388
{
1,180 ✔
389
    if(forDisplay)
1,180 ✔
390
        return asDisplayString(factory, attributeDisplayName, attributeDisplayValue);
28 ✔
391

392
    QString s;
1,152 ✔
393

394
    if(!_flags.empty())
1,152 ✔
395
    {
350 ✔
396
        s += u"["_s;
350 ✔
397
        for(const auto& flag : _flags)
350 ✔
398
        {
350 ✔
399
            if(s[s.length() - 1] != '[')
350 !
400
                s += u", "_s;
×
401

402
            s += flag;
350 ✔
403
        }
350 ✔
404
        s += u"] "_s;
350 ✔
405
    }
350 ✔
406

407
    s += LexyConfigGrammar::stringForExpression(_action);
1,152 ✔
408

409
    if(!_attributes.empty())
1,152 ✔
410
    {
116 ✔
411
        s += u" using"_s;
116 ✔
412

413
        for(const auto& attribute : _attributes)
116 ✔
414
            s += u" $%1"_s.arg(Attribute::attributeNameForExpression(attribute));
142 ✔
415
    }
116 ✔
416

417
    if(!_parameters.empty())
1,152 ✔
418
    {
172 ✔
419
        s += u" with"_s;
172 ✔
420

421
        for(const auto& parameter : _parameters)
172 ✔
422
            s += u" %1 = %2"_s.arg(LexyConfigGrammar::stringForExpression(parameter._name),
298 ✔
423
                parameter.valueAsString("forExpression"_yes));
298 ✔
424
    }
172 ✔
425

426
    if(hasCondition())
1,152 ✔
427
    {
902 ✔
428
        s += u" where "_s;
902 ✔
429
        s += conditionAsString();
902 ✔
430
    }
902 ✔
431

432
    return s;
1,152 ✔
433
}
1,180 ✔
434

435
QString GraphTransformConfig::asDisplayString(const GraphTransformFactory* factory,
436
    const AttributeDisplayNameFn& attributeDisplayName, const AttributeDisplayValueFn& attributeDisplayValue) const
437
{
28 ✔
438
    // Each part wraps those before it, so a translation can put it wherever its language needs
439
    auto s = factory != nullptr ? factory->displayName() : _action;
28 ✔
440

441
    if(!_attributes.empty())
28 ✔
442
    {
10 ✔
443
        QStringList attributes;
10 ✔
444
        attributes.reserve(static_cast<qsizetype>(_attributes.size()));
10 ✔
445

446
        for(const auto& attribute : _attributes)
10 ✔
447
            attributes.append(attributeDisplayName ? attributeDisplayName(attribute) : attribute);
14 !
448

449
        s = TransformDisplayText::usingAttributes().arg(s, attributes.join(u' '));
10 ✔
450
    }
10 ✔
451

452
    if(!_parameters.empty())
28 ✔
453
    {
14 ✔
454
        QStringList parameters;
14 ✔
455
        parameters.reserve(static_cast<qsizetype>(_parameters.size()));
14 ✔
456

457
        for(const auto& parameter : _parameters)
14 ✔
458
        {
18 ✔
459
            auto factoryParameter = factory != nullptr ?
18 ✔
460
                factory->parameter(parameter._name) :
16 ✔
461
                GraphTransformParameter();
18 ✔
462

463
            auto name = !factoryParameter.name().isEmpty() ?
18 ✔
464
                factoryParameter.displayName() :
16 ✔
465
                parameter._name;
18 ✔
466

467
            auto value = parameter.valueAsString();
18 ✔
468
            if(factoryParameter.type() == ValueType::StringList)
18 ✔
469
                value = factoryParameter.displayValue(value);
4 ✔
470

471
            parameters.append(TransformDisplayText::parameter().arg(name, value));
18 ✔
472
        }
18 ✔
473

474
        s = TransformDisplayText::withParameters().arg(s, parameters.join(u' '));
14 ✔
475
    }
14 ✔
476

477
    if(hasCondition())
28 ✔
478
    {
12 ✔
479
        s = TransformDisplayText::whereCondition().arg(s,
12 ✔
480
            conditionAsString("forDisplay"_yes, attributeDisplayName, attributeDisplayValue));
12 ✔
481
    }
12 ✔
482

483
    if(isFlagSet(u"pinned"_s))
28 ✔
484
        s = TransformDisplayText::pinned().arg(s);
4 ✔
485

486
    return s;
28 ✔
487
}
28 ✔
488

489
std::vector<QString> GraphTransformConfig::referencedAttributeNames() const
490
{
1,538 ✔
491
    auto names = _attributes;
1,538 ✔
492

493
    struct ConditionVisitor
1,538 ✔
494
    {
1,538 ✔
495
        explicit ConditionVisitor(std::vector<QString>* innerNames) :
1,538 ✔
496
            _names(innerNames) {}
1,558 ✔
497

498
        std::vector<QString>* _names;
1,538 ✔
499

500
        void operator()(GraphTransformConfig::NoCondition) const {};
1,538 ✔
501

502
        static QString attributeFromTerminalValue(const TerminalValue& terminalValue)
1,538 ✔
503
        {
2,572 ✔
504
            const auto* attribute = std::get_if<AttributeRef>(&terminalValue);
2,572 ✔
505
            return attribute != nullptr ? attribute->_name : QString();
2,572 ✔
506
        }
2,572 ✔
507

508
        void operator()(const TerminalCondition& terminalCondition) const
1,538 ✔
509
        {
1,538 ✔
510
            auto lhs = attributeFromTerminalValue(terminalCondition._lhs);
1,282 ✔
511
            auto rhs = attributeFromTerminalValue(terminalCondition._rhs);
1,282 ✔
512

513
            if(!lhs.isEmpty())
1,282 !
514
            {
1,282 ✔
515
                auto attributeName = Attribute::parseAttributeName(lhs);
1,282 ✔
516
                _names->emplace_back(attributeName._name);
1,282 ✔
517
            }
1,282 ✔
518

519
            if(!rhs.isEmpty())
1,282 !
520
            {
×
521
                auto attributeName = Attribute::parseAttributeName(rhs);
×
522
                _names->emplace_back(attributeName._name);
×
523
            }
×
524
        }
1,282 ✔
525

526
        void operator()(const UnaryCondition& unaryCondition) const
1,538 ✔
527
        {
1,538 ✔
528
            auto lhs = attributeFromTerminalValue(unaryCondition._lhs);
8 ✔
529

530
            if(!lhs.isEmpty())
8 !
531
                _names->emplace_back(lhs);
8 ✔
532
        }
8 ✔
533

534
        void operator()(const RecursiveValue<CompoundCondition>& wrapper) const
1,538 ✔
535
        {
1,538 ✔
536
            const auto& compoundCondition = *wrapper;
10 ✔
537
            std::visit(ConditionVisitor(_names), compoundCondition._lhs);
10 ✔
538
            std::visit(ConditionVisitor(_names), compoundCondition._rhs);
10 ✔
539
        }
10 ✔
540
    };
1,538 ✔
541

542
    std::visit(ConditionVisitor(&names), _condition);
1,538 ✔
543

544
    return names;
1,538 ✔
545
}
1,538 ✔
546

547
bool GraphTransformConfig::equals(const GraphTransformConfig& other,
548
    NamedBool<"ignoreInertFlags"> ignoreInertFlags) const
549
{
104 ✔
550
    std::vector<QString> flagsToIgnore;
104 ✔
551

552
    if(ignoreInertFlags)
104 ✔
553
    {
40 ✔
554
        // These flags do not cause a change in a transform's effect,
555
        // so ignore them for comparison purposes
556
        flagsToIgnore = {"locked", "pinned"};
40 ✔
557
    }
40 ✔
558

559
    auto flags = u::setDifference(_flags, flagsToIgnore);
104 ✔
560
    auto otherFlags = u::setDifference(other._flags, flagsToIgnore);
104 ✔
561

562
    return _action == other._action &&
104 ✔
563
            !u::setsDiffer(_parameters, other._parameters) &&
104 !
564
            !u::setsDiffer(flags, otherFlags) &&
104 ✔
565
            _attributes == other._attributes &&
104 !
566
            _condition == other._condition;
104 ✔
567
}
104 ✔
568

569
bool GraphTransformConfig::isFlagSet(const QString& flag) const
570
{
2,978 ✔
571
    return u::contains(_flags, flag);
2,978 ✔
572
}
2,978 ✔
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