Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VsnetDownload::Client::Buffer Class Reference

#include <vsnet_notify.h>

Inheritance diagram for VsnetDownload::Client::Buffer:
VsnetDownload::Client::Item

Public Member Functions

 Buffer (SOCKETALT sock, const std::string &filename, VSFileSystem::VSFileType ft)
 
virtual ~Buffer ()
 
boost::shared_array< uchar > getBuffer () const
 
int getSize ()
 
bool done () const
 
bool ok () const
 
int total () const
 
int offset () const
 
- Public Member Functions inherited from VsnetDownload::Client::Item
 Item (SOCKETALT sock, const std::string &filename, VSFileSystem::VSFileType=VSFileSystem::UnknownFile, NotifyPtr notify=NotifyPtr())
 
virtual ~Item ()
 
State state () const
 
VSError error () const
 
void changeState (State s)
 
void changeState (State s, VSError e)
 
void setFileType (VSFileSystem::VSFileType ft)
 
VSFileSystem::VSFileType getFileType ()
 
void setSize (int len)
 
void append (unsigned char *buffer, int bufsize)
 
const std::string & getFilename () const
 
SOCKETALT getSock () const
 
int get_fd () const
 

Protected Member Functions

virtual void childSetSize (int len)
 
virtual void childAppend (unsigned char *buffer, int bufsize)
 
- Protected Member Functions inherited from VsnetDownload::Client::Item
void protected_replace_notifier (NotifyPtr ptr)
 

Additional Inherited Members

- Protected Attributes inherited from VsnetDownload::Client::Item
VSFileSystem::VSFileType _filetype
 

Detailed Description

Definition at line 283 of file vsnet_notify.h.

Constructor & Destructor Documentation

VsnetDownload::Client::Buffer::Buffer ( SOCKETALT  sock,
const std::string &  filename,
VSFileSystem::VSFileType  ft 
)

Definition at line 233 of file vsnet_notify.cpp.

References VsnetDownload::Client::Item::protected_replace_notifier().

233  :
234  Item( sock, filename, ft, NotifyPtr() )
235  , _me( new NotifyMe )
236  , _len( 0 )
237  , _offset( 0 )
238 {
240 }
VsnetDownload::Client::Buffer::~Buffer ( )
virtual

Definition at line 242 of file vsnet_notify.cpp.

243 {}

Member Function Documentation

void VsnetDownload::Client::Buffer::childAppend ( unsigned char *  buffer,
int  bufsize 
)
protectedvirtual

Implements VsnetDownload::Client::Item.

Definition at line 257 of file vsnet_notify.cpp.

References buffer, bufsize, and VsnetOSS::memcpy().

258 {
259  if (_offset+bufsize <= _len) {
260  memcpy( _buf.get()+_offset, buffer, bufsize );
261  _offset += bufsize;
262  }
263 }
void VsnetDownload::Client::Buffer::childSetSize ( int  len)
protectedvirtual

Implements VsnetDownload::Client::Item.

Definition at line 250 of file vsnet_notify.cpp.

251 {
252  _len = len;
253  _offset = 0;
254  _buf.reset( new uchar[len] );
255 }
bool VsnetDownload::Client::Buffer::done ( ) const
inline

Definition at line 303 of file vsnet_notify.h.

References VsnetDownload::Client::NotifyMe::done().

Referenced by NetClient::downloadZoneInfo().

304  {
305  return me()->done();
306  }
boost::shared_array< Buffer::uchar > VsnetDownload::Client::Buffer::getBuffer ( ) const

Definition at line 245 of file vsnet_notify.cpp.

Referenced by NetClient::downloadZoneInfo().

246 {
247  return _buf;
248 }
int VsnetDownload::Client::Buffer::getSize ( )
inline

Definition at line 298 of file vsnet_notify.h.

Referenced by NetClient::downloadZoneInfo().

299  {
300  return this->_len;
301  }
int VsnetDownload::Client::Buffer::offset ( ) const
inline

Definition at line 318 of file vsnet_notify.h.

References VsnetDownload::Client::NotifyMe::offset().

319  {
320  return me()->offset();
321  }
bool VsnetDownload::Client::Buffer::ok ( ) const
inline

Definition at line 308 of file vsnet_notify.h.

References VsnetDownload::Client::NotifyMe::ok().

309  {
310  return me()->ok();
311  }
int VsnetDownload::Client::Buffer::total ( ) const
inline

Definition at line 313 of file vsnet_notify.h.

References VsnetDownload::Client::NotifyMe::total().

314  {
315  return me()->total();
316  }

The documentation for this class was generated from the following files: