diff options
author | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2020-11-14 12:59:17 +0100 |
---|---|---|
committer | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2020-11-14 12:59:17 +0100 |
commit | e5121b5d554a4d7dea8db45f5123ec47c5215469 (patch) | |
tree | f2590f436e9482904a55ff436afa8379af87072c /src/library/dao | |
parent | bd869ff4fa780fcbcb35f5cf58d91986451719ec (diff) |
CueDAO: Inline constant that is only used in a single location
Diffstat (limited to 'src/library/dao')
-rw-r--r-- | src/library/dao/cuedao.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/library/dao/cuedao.cpp b/src/library/dao/cuedao.cpp index 30ba885082..fb76e915c6 100644 --- a/src/library/dao/cuedao.cpp +++ b/src/library/dao/cuedao.cpp @@ -19,18 +19,17 @@ namespace { const mixxx::Logger kLogger = mixxx::Logger("CueDAO"); -// The label column is not nullable! -const QVariant kEmptyLabel = QVariant(QLatin1String("")); - +/// Wrap a `QString` label in a `QVariant`. The label column is not nullable, +/// so this function also makes sure that the label an empty string, not null. inline const QVariant labelToQVariant(const QString& label) { if (label.isNull()) { - return kEmptyLabel; // null -> empty + return QLatin1String(""); // null -> empty } else { return label; } } -// Empty labels are read as null strings +/// Empty labels are read as null strings inline QString labelFromQVariant(const QVariant& value) { const auto label = value.toString(); if (label.isEmpty()) { |