mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
synced 2025-11-20 19:54:51 +00:00
Add operator<< for TopicPartition
This commit is contained in:
@@ -27,11 +27,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include "topic_partition_list.h"
|
||||
#include "topic_partition.h"
|
||||
#include "exceptions.h"
|
||||
|
||||
using std::vector;
|
||||
using std::ostream;
|
||||
|
||||
namespace cppkafka {
|
||||
|
||||
@@ -65,4 +67,16 @@ TopicPartitionsListPtr make_handle(rd_kafka_topic_partition_list_t* handle) {
|
||||
return TopicPartitionsListPtr(handle, &rd_kafka_topic_partition_list_destroy);
|
||||
}
|
||||
|
||||
ostream& operator<<(ostream& output, const TopicPartitionList& rhs) {
|
||||
output << "[ ";
|
||||
for (auto iter = rhs.begin(); iter != rhs.end(); ++iter) {
|
||||
if (iter != rhs.begin()) {
|
||||
output << ", ";
|
||||
}
|
||||
output << *iter;
|
||||
}
|
||||
output << " ]";
|
||||
return output;
|
||||
}
|
||||
|
||||
} // cppkafka
|
||||
|
||||
Reference in New Issue
Block a user