librdkafka
The Apache Kafka C/C++ client library
RdKafka::Headers::Header Class Reference

Header object. More...

#include <rdkafkacpp.h>

Public Member Functions

 Header (const std::string &key, const void *value, size_t value_size)
 Header object to encapsulate a single Header. More...
 
 Header (const std::string &key, const void *value, size_t value_size, const RdKafka::ErrorCode err)
 Header object to encapsulate a single Header. More...
 
 Header (const Header &other)
 Copy constructor. More...
 
Headeroperator= (const Header &other)
 Assignment operator. More...
 
std::string key () const
 
const void * value () const
 
const char * value_string () const
 
size_t value_size () const
 
RdKafka::ErrorCode err () const
 

Detailed Description

Header object.

This object represents a single Header with a key value pair and an ErrorCode

Remarks
dynamic allocation of this object is not supported.

Constructor & Destructor Documentation

◆ Header() [1/3]

RdKafka::Headers::Header::Header ( const std::string &  key,
const void *  value,
size_t  value_size 
)
inline

Header object to encapsulate a single Header.

Parameters
keythe string value for the header key
valuethe bytes of the header value, or NULL
value_sizethe length in bytes of the header value
Remarks
key and value are copied.

◆ Header() [2/3]

RdKafka::Headers::Header::Header ( const std::string &  key,
const void *  value,
size_t  value_size,
const RdKafka::ErrorCode  err 
)
inline

Header object to encapsulate a single Header.

Parameters
keythe string value for the header key
valuethe bytes of the header value
value_sizethe length in bytes of the header value
errthe error code if one returned
Remarks
The error code is used for when the Header is constructed internally by using RdKafka::Headers::get_last which constructs a Header encapsulating the ErrorCode in the process. If err is set, the value and value_size fields will be undefined.

◆ Header() [3/3]

RdKafka::Headers::Header::Header ( const Header other)
inline

Copy constructor.

Parameters
otherHeader to make a copy of.

Member Function Documentation

◆ operator=()

Header& RdKafka::Headers::Header::operator= ( const Header other)
inline

Assignment operator.

Parameters
otherHeader to make a copy of.

◆ key()

std::string RdKafka::Headers::Header::key ( ) const
inline
Returns
the key/name associated with this Header

◆ value()

const void* RdKafka::Headers::Header::value ( ) const
inline
Returns
returns the binary value, or NULL

◆ value_string()

const char* RdKafka::Headers::Header::value_string ( ) const
inline
Returns
returns the value casted to a nul-terminated C string, or NULL.

◆ value_size()

size_t RdKafka::Headers::Header::value_size ( ) const
inline
Returns
Value Size the length of the Value in bytes

◆ err()

RdKafka::ErrorCode RdKafka::Headers::Header::err ( ) const
inline
Returns
the error code of this Header (usually ERR_NO_ERROR)

The documentation for this class was generated from the following file: