Protocols::Gnutella::Packets::Extensions::GgepBlock Class Reference

#include <GgepBlock.h> [code]

List of all members.


Detailed Description

Encapsulates a GGEP extension block.

GgepBlock implements GGEP extension block specified in Gnutella Generic Extension Protocol (GGEP) v0.5 available at: http://rfc-gnutella.sourceforge.net/src/GnutellaGenericExtensionProtocol.0.51.html

GgepBlock is a simple list of Ggep objects. GgepBlock objects can be compared, assigned, copied, extensions could be added or accessed.

GgepBlocks can be serialized in Gnutella packet format using BinaryReader::readGgepBlock() and BinaryWriter::writeGgepBlock().

Todo:
Use QSharedData and QSharedDataPointer to easily implement implicit sharing.

Definition at line 49 of file GgepBlock.h.

Public Types

typedef QList< const Ggep * > Extensions

Public Member Functions

 GgepBlock ()
 Construct an empty GgepBlock.
 GgepBlock (const GgepBlock &block)
 Copy ctor.
 ~GgepBlock ()
GgepBlockoperator= (const GgepBlock &block)
bool operator== (const GgepBlock &block) const
bool operator!= (const GgepBlock &block) const
GgepBlockaddExtension (const Ggep &extension)
 Adds a copy of extension to the internal list.
Extensions extensions () const
 Returns a list of pointers to the stored Ggep objects.

Static Public Attributes

static const uchar MagicByte = uchar (0xC3)

Private Member Functions

void deleteExtensions ()
 Deletes all stored Ggep objects.

Private Attributes

Extensions extensions_


Member Typedef Documentation

typedef QList<const Ggep *> Protocols::Gnutella::Packets::Extensions::GgepBlock::Extensions
 

Definition at line 52 of file GgepBlock.h.


Constructor & Destructor Documentation

GgepBlock::GgepBlock  ) 
 

Construct an empty GgepBlock.

Definition at line 29 of file GgepBlock.cpp.

GgepBlock::GgepBlock const GgepBlock block  ) 
 

Copy ctor.

Definition at line 35 of file GgepBlock.cpp.

GgepBlock::~GgepBlock  ) 
 

Definition at line 74 of file GgepBlock.cpp.


Member Function Documentation

GgepBlock & GgepBlock::addExtension const Ggep extension  ) 
 

Adds a copy of extension to the internal list.

Definition at line 88 of file GgepBlock.cpp.

void GgepBlock::deleteExtensions  )  [private]
 

Deletes all stored Ggep objects.

Definition at line 80 of file GgepBlock.cpp.

GgepBlock::Extensions GgepBlock::extensions  )  const
 

Returns a list of pointers to the stored Ggep objects.

Todo:
This function is potentially dangerous! Think about wrapping the const Ggep * in an object (GgepRef??) and implement implicit sharing to be able to treat it like a value object and thus to save us the bad stuff that could result by passing pointers around.
Todo:
When the above is accomplished, add a function: template <typename concreteggep>=""> QList <GgepRef <ConcreteGgep> > extensions(); which will allow us to extract only the extensions of certain type.

Definition at line 107 of file GgepBlock.cpp.

bool GgepBlock::operator!= const GgepBlock block  )  const
 

Definition at line 69 of file GgepBlock.cpp.

GgepBlock & GgepBlock::operator= const GgepBlock block  ) 
 

Definition at line 42 of file GgepBlock.cpp.

bool GgepBlock::operator== const GgepBlock block  )  const
 

Definition at line 58 of file GgepBlock.cpp.


Member Data Documentation

Extensions Protocols::Gnutella::Packets::Extensions::GgepBlock::extensions_ [private]
 

Definition at line 69 of file GgepBlock.h.

const uchar Protocols::Gnutella::Packets::Extensions::GgepBlock::MagicByte = uchar (0xC3) [static]
 

Definition at line 54 of file GgepBlock.h.


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