diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-10-29 22:04:40 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-11-01 08:43:09 +0900 |
commit | 60bb1cf942ad0815dcf42cbfe8acd1e076d848cf (patch) | |
tree | 3998826b6b78d9f7d3100570aa28aa86f8b040fd /lib/syncdata.cpp | |
parent | 8a574f8727cc8b1c91acf0840e99c9382c289098 (diff) | |
download | libquotient-60bb1cf942ad0815dcf42cbfe8acd1e076d848cf.tar.gz libquotient-60bb1cf942ad0815dcf42cbfe8acd1e076d848cf.zip |
Derive Omittable<> from std::optional<>
That breaks API all over the place but:
1. The fixes are trivial.
2. More of std:: is used instead of home-baking the same stuff.
Diffstat (limited to 'lib/syncdata.cpp')
-rw-r--r-- | lib/syncdata.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/syncdata.cpp b/lib/syncdata.cpp index 5b47b30f..89c512a2 100644 --- a/lib/syncdata.cpp +++ b/lib/syncdata.cpp @@ -30,8 +30,7 @@ const QString SyncRoomData::UnreadCountKey = bool RoomSummary::isEmpty() const { - return joinedMemberCount.omitted() && invitedMemberCount.omitted() - && heroes.omitted(); + return !joinedMemberCount && !invitedMemberCount && !heroes; } bool RoomSummary::merge(const RoomSummary& other) @@ -46,12 +45,12 @@ QDebug Quotient::operator<<(QDebug dbg, const RoomSummary& rs) { QDebugStateSaver _(dbg); QStringList sl; - if (!rs.joinedMemberCount.omitted()) - sl << QStringLiteral("joined: %1").arg(rs.joinedMemberCount.value()); - if (!rs.invitedMemberCount.omitted()) - sl << QStringLiteral("invited: %1").arg(rs.invitedMemberCount.value()); - if (!rs.heroes.omitted()) - sl << QStringLiteral("heroes: [%1]").arg(rs.heroes.value().join(',')); + if (rs.joinedMemberCount) + sl << QStringLiteral("joined: %1").arg(*rs.joinedMemberCount); + if (rs.invitedMemberCount) + sl << QStringLiteral("invited: %1").arg(*rs.invitedMemberCount); + if (rs.heroes) + sl << QStringLiteral("heroes: [%1]").arg(rs.heroes->join(',')); dbg.nospace().noquote() << sl.join(QStringLiteral("; ")); return dbg; } |