fawkes::StringContent Class Reference

Content for a variable length string. More...

#include <netcomm/utils/string_content.h>

Inheritance diagram for fawkes::StringContent:

[legend]
List of all members.

Public Member Functions

 StringContent (const char *initial_string)
 Primary constructor.
 StringContent (unsigned int cid, unsigned int msgid, void *payload, size_t payload_size)
 Constructor.
virtual ~StringContent ()
 Destructor.
void set_string (const char *s)
 Set the string.
const char * get_string () const
 Get string.
size_t get_string_length ()
 Get length of string.
virtual void serialize ()
 Serialize message content.

Detailed Description

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.

Author:
Tim Niemueller

Definition at line 32 of file string_content.h.


Constructor & Destructor Documentation

fawkes::StringContent::StringContent ( const char *  initial_string  ) 

Primary constructor.

Parameters:
initial_string initial string

Definition at line 44 of file string_content.cpp.

References set_string().

fawkes::StringContent::StringContent ( unsigned int  cid,
unsigned int  msgid,
void *  payload,
size_t  payload_size 
)

Constructor.

This ctor can be used with FawkesNetworkMessage::msgc().

Parameters:
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 58 of file string_content.cpp.

References fawkes::FawkesNetworkMessageContent::_payload, and fawkes::FawkesNetworkMessageContent::_payload_size.

fawkes::StringContent::~StringContent (  )  [virtual]

Destructor.

Definition at line 73 of file string_content.cpp.


Member Function Documentation

const char * fawkes::StringContent::get_string (  )  const

Get string.

Returns:
null-terminated string

Definition at line 103 of file string_content.cpp.

size_t fawkes::StringContent::get_string_length (  ) 

Get length of string.

Returns:
string length

Definition at line 113 of file string_content.cpp.

References fawkes::FawkesNetworkMessageContent::_payload_size.

void fawkes::StringContent::serialize (  )  [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 120 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.

Parameters:
s the new string, must be null-terminated.

Definition at line 86 of file string_content.cpp.

References fawkes::FawkesNetworkMessageContent::_payload, and fawkes::FawkesNetworkMessageContent::_payload_size.

Referenced by StringContent().


The documentation for this class was generated from the following files:
Generated on Tue Feb 22 13:32:53 2011 for Fawkes API by  doxygen 1.4.7