]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Implement operator<<(ostream,Http::HttpHdr) merge-candidate-3-v2
authorFrancesco Chemolli <kinkie@squid-cache.org>
Thu, 6 Aug 2015 02:50:14 +0000 (04:50 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Thu, 6 Aug 2015 02:50:14 +0000 (04:50 +0200)
src/http/RegisteredHeaders.cc
src/http/RegisteredHeaders.h

index 11bc8f06fb0d41aea78c06e32f4d14fab5e7cfd0..78e89aa9bf1b28dfa9cd2109f499bca4d08effea 100644 (file)
@@ -121,3 +121,12 @@ const LookupTable<Http::HdrType, HeaderTableRecord> HeaderLookupTable(Http::HdrT
 
 }; /* namespace Http */
 
+std::ostream&
+operator<< (std::ostream &s, Http::HdrType id)
+{
+       if (Http::any_HdrType_enum_value(id))
+               s << Http::HeaderTable[id].name << '[' << static_cast<int>(id) << ']';
+       else
+               s << "Invalid-Header[" << static_cast<int>(id) << ']';
+       return s;
+}
index 27dd835aaaed4cbf41f72e191fe19b0b6e9ac3a2..3c4f2febdedf5f29710979733e1e44ed10247a62 100644 (file)
@@ -10,6 +10,7 @@
 #define SQUID_HTTP_REGISTEREDHEADERS_H
 
 #include "base/LookupTable.h"
+#include <iosfwd>
 
 namespace Http
 {
@@ -182,5 +183,9 @@ any_registered_header (const Http::HdrType id)
 
 }; /* namespace Http */
 
+/* ostream output for Http::HdrType */
+std::ostream &
+operator<< (std::ostream&, Http::HdrType);
+
 #endif /* SQUID_HTTP_REGISTEREDHEADERS_H */