data: Add ability to print out information about Data packet using std::ostream
Change-Id: I20869cebd259e90f8b69d48758a090a8c31fa34c
diff --git a/include/ndn-cpp/meta-info.hpp b/include/ndn-cpp/meta-info.hpp
index 27e97e8..3a33dc4 100644
--- a/include/ndn-cpp/meta-info.hpp
+++ b/include/ndn-cpp/meta-info.hpp
@@ -111,6 +111,19 @@
}
}
+inline std::ostream&
+operator << (std::ostream &os, const MetaInfo &info)
+{
+ // ContentType
+ os << "ContentType: " << info.getType();
+
+ // FreshnessPeriod
+ if (info.getFreshnessPeriod() >= 0) {
+ os << ", FreshnessPeriod: " << info.getFreshnessPeriod();
+ }
+ return os;
+}
+
} // namespace ndn
#endif // NDN_META_INFO_HPP