acl  3.5.3.0
acl::mqtt_publish类 参考

#include <mqtt_publish.hpp>

+ 类 acl::mqtt_publish 继承关系图:
+ acl::mqtt_publish 的协作图:

Public 成员函数

 mqtt_publish (void)
 
 mqtt_publish (const mqtt_header &header)
 
 ~mqtt_publish (void)
 
mqtt_publishset_topic (const char *topic)
 
mqtt_publishset_pkt_id (unsigned short id)
 
mqtt_publishset_payload (unsigned len, const char *data=NULL)
 
const char * get_topic (void) const
 
unsigned short get_pkt_id (void) const
 
unsigned get_payload_len (void) const
 
const stringget_payload (void) const
 
int update_header_var (const char *data, int dlen)
 
int update_topic_len (const char *data, int dlen)
 
int update_topic_val (const char *data, int dlen)
 
int update_pktid (const char *data, int dlen)
 
int update_payload (const char *data, int dlen)
 
- Public 成员函数 继承自 acl::mqtt_message
 mqtt_message (mqtt_type_t type)
 
 mqtt_message (const mqtt_header &header)
 
virtual ~mqtt_message (void)
 
mqtt_headerget_header (void)
 
const mqtt_headerget_header (void) const
 

Protected 成员函数

bool to_string (string &out)
 
int update (const char *data, int dlen)
 
bool finished (void) const
 
- Protected 成员函数 继承自 acl::mqtt_message
void pack_add (unsigned char ch, string &out)
 
void pack_add (unsigned short n, string &out)
 
void pack_add (const string &s, string &out)
 
bool unpack_short (const char *data, size_t len, unsigned short &out)
 

额外继承的成员函数

- 静态 Public 成员函数 继承自 acl::mqtt_message
static mqtt_messagecreate_message (const mqtt_header &header)
 
- Protected 属性 继承自 acl::mqtt_message
mqtt_header header_
 

详细描述

mqtt message object for MQTT_PUBLISH type.

在文件 mqtt_publish.hpp10 行定义.

构造及析构函数说明

◆ mqtt_publish() [1/2]

acl::mqtt_publish::mqtt_publish ( void  )

constructor for creating MQTT_PUBLISH mqtt message object.

参见
mqtt_message

◆ mqtt_publish() [2/2]

acl::mqtt_publish::mqtt_publish ( const mqtt_header header)

constructor for creating MQTT_PUBLISH mqtt message object.

参见
mqtt_message

◆ ~mqtt_publish()

acl::mqtt_publish::~mqtt_publish ( void  )

成员函数说明

◆ finished()

bool acl::mqtt_publish::finished ( void  ) const
inlineprotectedvirtual

重载 acl::mqtt_message .

在文件 mqtt_publish.hpp88 行定义.

88  {
89  return finished_;
90  }

◆ get_payload()

const string& acl::mqtt_publish::get_payload ( void  ) const
inline

get the palyload.

返回
{const string&}

在文件 mqtt_publish.hpp76 行定义.

76  {
77  return payload_;
78  }

◆ get_payload_len()

unsigned acl::mqtt_publish::get_payload_len ( void  ) const
inline

get the length of the payload.

返回
{unsigned}

在文件 mqtt_publish.hpp68 行定义.

68  {
69  return payload_len_;
70  }

◆ get_pkt_id()

unsigned short acl::mqtt_publish::get_pkt_id ( void  ) const
inline

get the message's id.

返回
{unsigned short} the message will be invalid if return 0.

在文件 mqtt_publish.hpp60 行定义.

60  {
61  return pkt_id_;
62  }

◆ get_topic()

const char* acl::mqtt_publish::get_topic ( void  ) const
inline

get the message's topic.

返回
{const char*}

在文件 mqtt_publish.hpp52 行定义.

52  {
53  return topic_.c_str();
54  }
char * c_str() const

◆ set_payload()

mqtt_publish& acl::mqtt_publish::set_payload ( unsigned  len,
const char *  data = NULL 
)

set the message payload.

参数
len{unsigned} the length of the payload.
data{const char*} the payload data.
返回
{mqtt_publish&}

◆ set_pkt_id()

mqtt_publish& acl::mqtt_publish::set_pkt_id ( unsigned short  id)

set the message id.

参数
id{unsigned short} the value must > 0 && <= 65535.
返回
{mqtt_publish&}

◆ set_topic()

mqtt_publish& acl::mqtt_publish::set_topic ( const char *  topic)

set the message topic.

参数
topic{const char*}
返回
{mqtt_publish&}

◆ to_string()

bool acl::mqtt_publish::to_string ( string out)
protectedvirtual

实现了 acl::mqtt_message.

◆ update()

int acl::mqtt_publish::update ( const char *  data,
int  dlen 
)
protectedvirtual

实现了 acl::mqtt_message.

◆ update_header_var()

int acl::mqtt_publish::update_header_var ( const char *  data,
int  dlen 
)

◆ update_payload()

int acl::mqtt_publish::update_payload ( const char *  data,
int  dlen 
)

◆ update_pktid()

int acl::mqtt_publish::update_pktid ( const char *  data,
int  dlen 
)

◆ update_topic_len()

int acl::mqtt_publish::update_topic_len ( const char *  data,
int  dlen 
)

◆ update_topic_val()

int acl::mqtt_publish::update_topic_val ( const char *  data,
int  dlen 
)

该类的文档由以下文件生成: