D13104: Protocol: QJsonObject for tracer.

Daniel Vrátil noreply at phabricator.kde.org
Fri Jun 1 17:08:26 BST 2018


dvratil added a comment.


  To clarify what I mean, right now you have to do `static_cast<Command*>(cmd)->toJson()` which will internally cast down and do the serialization. If you do
  
    FetchItemsCommandPtr fetchCmd = cmd.staticCast<FetchItemsCommand>(cmd);
    fetchCmd->toJson();
  
  you will get an incomplete serialization because `FetchItemsCommand::toJson()` won't internally chain up to `Command::toJson()`. This is why I suggested that you should handle the chain up internally inside `toJson()` using `ClassNode::parentClassName()` like we do in `operator<<(QDebug)`. However this way you can still get incomplete serialization if you do something like this:
  
    CommandPtr cmd = fetchCmd;
    cmd->toJson();
  
  In order to handle that, we would have `Protocol::toJson()` that would internally down-cast to the leaf-type and call `toJson()` on it, which would then internally chain up. This would be consistent with how you use the `Protocol::debugString()` to get a debug string.

REPOSITORY
  R165 Akonadi

REVISION DETAIL
  https://phabricator.kde.org/D13104

To: knauss, dvratil
Cc: kde-pim, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20180601/02c18b0e/attachment.html>


More information about the kde-pim mailing list