Fawkes API
Fawkes Development Version
|
#include <>>
Public Member Functions | |
StringContent (const char *initial_string) | |
Primary constructor. More... | |
StringContent (unsigned int cid, unsigned int msgid, void *payload, size_t payload_size) | |
Constructor. More... | |
virtual | ~StringContent () |
Destructor. More... | |
void | set_string (const char *s) |
Set the string. More... | |
const char * | get_string () const |
Get string. More... | |
size_t | get_string_length () |
Get length of string. More... | |
virtual void | serialize () |
![]() | |
FawkesNetworkMessageContent () | |
Constructor. More... | |
virtual | ~FawkesNetworkMessageContent () |
Virtual empty destructor. More... | |
virtual void * | payload () |
Return pointer to payload. More... | |
virtual size_t | payload_size () |
Return payload size. More... | |
Additional Inherited Members | |
![]() | |
void | copy_payload (size_t offset, const void *buf, size_t len) |
Copy payload into payload buffer to a specified offset. More... | |
![]() | |
void * | _payload |
Pointer to payload. More... | |
size_t | _payload_size |
Payloda size. More... | |
Content for a variable length string. This content class can be used with a FawkesNetworkMessage. It takes a single string of variable size and stuffs it into a message.
Definition at line 38 of file string_content.h.
fawkes::StringContent::StringContent | ( | const char * | initial_string | ) |
Primary constructor.
initial_string | initial string |
Definition at line 49 of file string_content.cpp.
fawkes::StringContent::StringContent | ( | unsigned int | cid, |
unsigned int | msgid, | ||
void * | payload, | ||
size_t | payload_size | ||
) |
Constructor.
This ctor can be used with FawkesNetworkMessage::msgc().
cid | component ID, ignored |
msgid | message ID, ignored |
payload | Payload, checked if it can be a valid string. |
payload_size | size in bytes of payload |
Definition at line 62 of file string_content.cpp.
|
virtual |
Destructor.
Definition at line 78 of file string_content.cpp.
References fawkes::FawkesNetworkMessageContent::_payload.
const char * fawkes::StringContent::get_string | ( | ) | const |
Get string.
Definition at line 106 of file string_content.cpp.
References fawkes::FawkesNetworkMessageContent::_payload_size.
size_t fawkes::StringContent::get_string_length | ( | ) |
|
virtual |
Serialize message content. Generate a single contiguous buffer. Make _payload point to this buffer and _payload_size contain the size of the buffer.
Implements fawkes::FawkesNetworkMessageContent.
Definition at line 121 of file string_content.cpp.
void fawkes::StringContent::set_string | ( | const char * | s | ) |
Set the string.
Can only be called if the instance has been created with the primary constructor.
s | the new string, must be null-terminated. |
Definition at line 90 of file string_content.cpp.