[patch] add QDebug streaming operator for Headers

10 views
Skip to first unread message

marco.m

unread,
Mar 14, 2013, 12:41:54 PM3/14/13
to Tufão
If the patch is garbled, I can send it in another way.

diff --git a/3rdparty/tufao/src/headers.h b/3rdparty/tufao/src/
headers.h
--- a/3rdparty/tufao/src/headers.h
+++ b/3rdparty/tufao/src/headers.h
@@ -28,6 +28,7 @@
#include "ibytearray.h"

class QDateTime;
+class QDebug;

namespace Tufao {

@@ -68,6 +69,11 @@ struct Headers: public QMultiMap<IByteAr
= QDateTime());
};

+/*!
+ Stream an Header object to qDebug().
+ */
+TUFAO_EXPORT QDebug operator<<(QDebug dbg, const Headers &headers);
+
} // namespace Tufao

#endif // TUFAO_HEADERS_H



diff --git a/3rdparty/tufao/src/headers.cpp b/3rdparty/tufao/src/
headers.cpp
--- a/3rdparty/tufao/src/headers.cpp
+++ b/3rdparty/tufao/src/headers.cpp
@@ -22,6 +22,7 @@
#include "priv/asctime.h"

#include <QtCore/QLocale>
+#include <QtCore/QDebug>

namespace Tufao {

@@ -56,4 +57,13 @@ QDateTime Headers::toDateTime(const QByt
return defaultValue;
}

+QDebug operator<<(QDebug dbg, const Headers &headers)
+{
+ for (Tufao::Headers::const_iterator h = headers.begin(); h !=
headers.end(); h++) {
+ dbg.nospace() << h.key() << ": " << h.value() << endl;
+ }
+ return dbg.space();
+}
+
+
} // namespace Tufao




diff --git a/3rdparty/tufao/src/httpserverrequest.h b/3rdparty/tufao/
src/httpserverrequest.h
--- a/3rdparty/tufao/src/httpserverrequest.h
+++ b/3rdparty/tufao/src/httpserverrequest.h
@@ -32,7 +32,7 @@ namespace Tufao {
struct Headers;

/*!
- The Tufao::HttpServer represents a HTTP request received by
Tufao::HttpServer.
+ The Tufao::HttpServerRequest represents a HTTP request received by
Tufao::HttpServer.

\note
You can use it to create your own HTTP servers too, just handle the

Vinícius dos Santos Oliveira

unread,
Mar 14, 2013, 1:10:42 PM3/14/13
to Tufão
2013/3/14 marco.m <marco.molte...@gmail.com>

If the patch is garbled, I can send it in another way.

It's okay.

It seems like one more feature to release with version 0.6 next week.


--
Vinícius dos Santos Oliveira
https://plus.google.com/118295250366112843114
http://vinipsmaker.wordpress.com/

Linux user #481186

Majoring in Computer Science (UFAL)

Vinícius dos Santos Oliveira

unread,
Mar 19, 2013, 8:36:46 PM3/19/13
to Tufão
Reply all
Reply to author
Forward
0 new messages