Add operator<< for TopicPartition

This commit is contained in:
Matias Fontanini
2016-06-15 07:44:28 -07:00
parent 6877c4be03
commit 9e79321a1f
5 changed files with 49 additions and 0 deletions

View File

@@ -31,6 +31,7 @@
#define CPPKAFKA_TOPIC_PARTITION_H
#include <string>
#include <iosfwd>
#include <cstdint>
namespace cppkafka {
@@ -104,6 +105,11 @@ public:
* Gets the offset
*/
int64_t get_offset() const;
/**
* Print to a stream
*/
friend std::ostream& operator<<(std::ostream& output, const TopicPartition& rhs);
private:
std::string topic_;
int partition_;

View File

@@ -31,6 +31,7 @@
#define CPPKAFKA_TOPIC_PARTITION_LIST_H
#include <memory>
#include <iosfwd>
#include <algorithm>
#include <librdkafka/rdkafka.h>
@@ -51,6 +52,8 @@ std::vector<TopicPartition> convert(const TopicPartitionsListPtr& topic_partitio
std::vector<TopicPartition> convert(rd_kafka_topic_partition_list_t* topic_partitions);
TopicPartitionsListPtr make_handle(rd_kafka_topic_partition_list_t* handle);
std::ostream& operator<<(std::ostream& output, const TopicPartitionList& rhs);
} // cppkafka
#endif // CPPKAFKA_TOPIC_PARTITION_LIST_H