summaryrefslogtreecommitdiffstats
path: root/src/track/trackref.cpp
blob: 663a2f9790ac1863c6ecf0380b2eb6f517e8040d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "track/trackref.h"


bool TrackRef::verifyConsistency() const {
    // Class invariant: The location can only be set together with
    // at least one of the other members!
    VERIFY_OR_DEBUG_ASSERT(!hasCanonicalLocation() || hasLocation()) {
        // Condition violated: hasCanonicalLocation() => hasLocation()
        return false;
    }
    VERIFY_OR_DEBUG_ASSERT(!hasId() || hasLocation()) {
        // Condition violated: hasId() => hasLocation()
        return false;
    }
    return true;
}

std::ostream& operator<<(std::ostream& os, const TrackRef& trackRef) {
    return os << '[' << trackRef.getLocation().toStdString()
            << " | " << trackRef.getCanonicalLocation().toStdString()
            << " | " << trackRef.getId()
            << ']';

}

QDebug operator<<(QDebug debug, const TrackRef& trackRef) {
    debug.nospace() << '[' << trackRef.getLocation()
                    << " | " << trackRef.getCanonicalLocation()
                    << " | " << trackRef.getId()
                    << ']';
    return debug.space();
}