To be able to send json as debug protocol, so we can better search and
parse this on akonadiconsole.
Details
- Reviewers
dvratil - Commits
- R165:62ef7558faf2: Add toJson method for the protocol.
build
Diff Detail
- Repository
- R165 Akonadi
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Looks good, thanks a lot! Just resolve the Relation serialization and I think we are good to go.
src/private/protocolgen/cppgenerator.cpp | ||
---|---|---|
649 | Just add toJSON() to the Relation class. |
Use !foo.isEmpty() instead of foo.size() > 0 please
src/private/protocolgen/cppgenerator.cpp | ||
---|---|---|
631 | qAsConst(serializeProperties) to prevent detaching the container | |
src/private/scope.cpp | ||
329 | const auto chain = hridChain(); for (const auto &hrid : chain) { .. } to prevent detaching the returned container. | |
332 | Use the chain variable from above comment here |
src/private/protocolgen/cppgenerator.cpp | ||
---|---|---|
631 | this needs also be done at all other usages of serializeProperties , as they only read data this is not an issue, right? |
src/private/protocolgen/cppgenerator.cpp | ||
---|---|---|
631 | This only needs to be done when using a non-const Qt container in a range-based for loop, because it calls non-const begin() and end(), causing the container to detach if it is (or could be) shared |
src/private/scope.cpp | ||
---|---|---|
329 | my compiler is unhappy with the const auto chain = hridChain(); line in the switch: /home/neon/kdepim/src/kde/pim/akonadi/src/private/scope.cpp: In member function 'QTextStream& Akonadi::Scope::toJson(QTextStream&) const': /home/neon/kdepim/src/kde/pim/akonadi/src/private/scope.cpp:339:5: error: jump to case label [-fpermissive] /home/neon/kdepim/src/kde/pim/akonadi/src/private/scope.cpp:329:21: note: crosses initialization of 'const QVector<Akonadi::Scope::HRID>& chain' /home/neon/kdepim/src/kde/pim/akonadi/src/private/scope.cpp:317:12: warning: enumeration value 'Invalid' not handled in switch [-Wswitch] |
src/private/protocol.cpp | ||
---|---|---|
203–205 | You can make a helper macro like this #define case_label(x) case Command::x: stream << #x; break swtich (mType) { case_label(Invalid); case_label(Hello); ... } #undef case_label | |
src/private/scope.cpp | ||
329 | That's normal, you should use curly braces around a case when you want to declare a variable inside case x : { int a = 5; } break; |