Kylin/Nng/Message.h

41 lines
835 B
C
Raw Normal View History

2024-10-29 23:13:33 +08:00
#ifndef __MESSAGE_H__
#define __MESSAGE_H__
#include <cstdint>
#include <nng/nng.h>
namespace Nng {
class Message {
public:
class Header {
friend class Message;
Header(nng_msg *message);
nng_msg *m_message = nullptr;
};
class Body {
public:
std::size_t capacity() const;
void clear() const noexcept;
private:
friend class Message;
Body(nng_msg *message);
nng_msg *m_message = nullptr;
};
Message(std::size_t size);
Message(const Message &rhs);
Message &operator=(const Message &rhs);
Message &operator=(Message &&rhs) noexcept;
~Message();
void realloc(std::size_t size) const;
Header header() const;
Body body() const;
private:
nng_msg *m_message = nullptr;
};
} // namespace Nng
#endif // __MESSAGE_H__