Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <QDebug>
- // Can I do better?
- namespace google {
- namespace protobuf {
- class MessageLite;
- class Message;
- }
- }
- // Scary syntax because this should compile in TR1 (VS2010)
- namespace printFunctions {
- /*!
- * @brief short-circuit overload for printData to use with ADL
- *
- * @tparam Msg message type
- *
- * @param [in] PacketNum associated message id
- * @param [in] msg subj
- */
- template <typename Msg>
- typename std::enable_if<std::is_base_of<::google::protobuf::MessageLite, Msg>::value>::type
- printData(PacketID PacketNum, const Msg& msg)
- {
- qDebug() << "------------ " << msg.GetTypeName().c_str() << " with #" << PacketNum;
- }
- template <typename Msg>
- typename std::enable_if_t<std::is_base_of<::google::protobuf::Message, Msg>::value, Msg>::type
- printData(PacketID PacketNum, const Msg & msg)
- {
- qDebug() << "------------ " << msg.GetTypeName().c_str() << " with #" << PacketNum;
- qDebug() << msg.DebugString().c_str();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement