Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

scim::SocketTransaction Class Reference
[Helper]

#include <scim_socket_transaction.h>

List of all members.

Public Member Functions

 SocketTransaction (size_t bufsize=512)
 ~SocketTransaction ()
bool valid () const
bool write_to_socket (const Socket &socket, uint32 signature=0) const
bool read_from_socket (const Socket &socket, int timeout=-1)
void put_command (int type)
void put_data (uint32 val)
void put_data (const String &str)
void put_data (const WideString &str)
void put_data (const KeyEvent &key)
void put_data (const AttributeList &attrs)
void put_data (const LookupTable &table)
void put_data (const std::vector< uint32 > &vec)
void put_data (const std::vector< String > &vec)
void put_data (const std::vector< WideString > &vec)
void put_data (const char *raw, size_t bufsize)
SocketTransactionDataType get_data_type () const
bool get_command (int &type)
bool get_data (uint32 &val)
bool get_data (String &str)
bool get_data (WideString &str)
bool get_data (KeyEvent &key)
bool get_data (AttributeList &attrs)
bool get_data (CommonLookupTable &table)
bool get_data (std::vector< uint32 > &vec)
bool get_data (std::vector< String > &vec)
bool get_data (std::vector< WideString > &vec)
bool get_data (char **raw, size_t &bufsize)
bool skip_data ()
void rewind_read_pos ()
void clear ()


Detailed Description

This class can pack up many data into one package and send them via socket.

Definition at line 152 of file scim_socket_transaction.h.


Constructor & Destructor Documentation

scim::SocketTransaction::SocketTransaction size_t  bufsize = 512  ) 
 

constructor.

Parameters:
bufsize the initial buffer size, maybe grow afterwards.

scim::SocketTransaction::~SocketTransaction  ) 
 

destructor.


Member Function Documentation

bool scim::SocketTransaction::valid  )  const
 

check if the transaction is valid.

bool scim::SocketTransaction::write_to_socket const Socket socket,
uint32  signature = 0
const
 

write the transaction to socket.

Parameters:
socket the socket to be written.
signature the leading signature to be written into the socket before the transaction itself, this signature maybe missing when receive the transaction.

bool scim::SocketTransaction::read_from_socket const Socket socket,
int  timeout = -1
 

read a transaction from socket.

Parameters:
socket the socket to be read.
timeout time out in millisecond (1/1000 second), -1 means infinity.

void scim::SocketTransaction::put_command int  type  ) 
 

store a command into transaction.

void scim::SocketTransaction::put_data uint32  val  ) 
 

store a uint32 value into transaction.

void scim::SocketTransaction::put_data const String str  ) 
 

store a String object into transaction.

void scim::SocketTransaction::put_data const WideString str  ) 
 

store a WideString object into transaction.

void scim::SocketTransaction::put_data const KeyEvent key  ) 
 

store a KeyEvent object into transaction.

void scim::SocketTransaction::put_data const AttributeList attrs  ) 
 

store a AttributeList object info transaction.

void scim::SocketTransaction::put_data const LookupTable table  ) 
 

store a LookupTable object into transaction.

void scim::SocketTransaction::put_data const std::vector< uint32 > &  vec  ) 
 

store a std::vector<uint32> object into transaction.

void scim::SocketTransaction::put_data const std::vector< String > &  vec  ) 
 

store a std::vector<String> object into transaction.

void scim::SocketTransaction::put_data const std::vector< WideString > &  vec  ) 
 

store a std::vector<WideString> object into transaction.

void scim::SocketTransaction::put_data const char *  raw,
size_t  bufsize
 

store a raw buffer into transaction.

SocketTransactionDataType scim::SocketTransaction::get_data_type  )  const
 

get the type of the data at current read position.

bool scim::SocketTransaction::get_command int &  type  ) 
 

get a command from current read position.

bool scim::SocketTransaction::get_data uint32 val  ) 
 

get a uint32 value from current read position.

bool scim::SocketTransaction::get_data String str  ) 
 

get a String from current read position.

bool scim::SocketTransaction::get_data WideString str  ) 
 

get a WideString from current read position.

bool scim::SocketTransaction::get_data KeyEvent key  ) 
 

get a KeyEvent from current read position.

bool scim::SocketTransaction::get_data AttributeList attrs  ) 
 

get an AttributeList from current read position.

bool scim::SocketTransaction::get_data CommonLookupTable table  ) 
 

get a CommonLookupTable from current read position.

bool scim::SocketTransaction::get_data std::vector< uint32 > &  vec  ) 
 

get a std::vector<uint32> from current read position.

bool scim::SocketTransaction::get_data std::vector< String > &  vec  ) 
 

get a std::vector<String> from current read position.

bool scim::SocketTransaction::get_data std::vector< WideString > &  vec  ) 
 

get a std::vector<WideString> from current read position.

bool scim::SocketTransaction::get_data char **  raw,
size_t &  bufsize
 

get a raw buffer from current read position. if raw == NULL then return the bufsize and skip this data. *raw should be deleted afterwards (do not use free!).

bool scim::SocketTransaction::skip_data  ) 
 

skip one data from current read position.

void scim::SocketTransaction::rewind_read_pos  ) 
 

rewind the current read position, then the data can be read again.

void scim::SocketTransaction::clear  ) 
 

clear the transaction.


The documentation for this class was generated from the following file:
Generated on Fri May 7 17:27:34 2004 for scim by doxygen 1.3.6