Public Types | Public Member Functions | Protected Attributes

SDESItem Class Reference

#include <sdes.h>

List of all members.

Public Types

enum  SDES_ITEM_TYPE {
  SDES_UNDEF = 0, SDES_CNAME = 1, SDES_NAME = 2, SDES_EMAIL = 3,
  SDES_PHONE = 4, SDES_LOC = 5, SDES_TOOL = 6, SDES_NOTE = 7,
  SDES_PRIV = 8
}

Public Member Functions

 SDESItem ()
 SDESItem (SDES_ITEM_TYPE type, const char *content)
 SDESItem (const SDESItem &sdesItem)
virtual ~SDESItem ()
SDESItemoperator= (const SDESItem &sdesItem)
virtual SDESItemdup () const
virtual std::string info ()
virtual void dump (std::ostream &os)
virtual SDES_ITEM_TYPE getType ()
virtual const char * getContent ()
virtual int getLength ()

Protected Attributes

SDES_ITEM_TYPE _type
int _length
const char * _content

Detailed Description

The class SDESItem is used for storing a source description item (type of description, description string) for an rtp end system.

Definition at line 31 of file sdes.h.


Member Enumeration Documentation

This enumeration holds the types of source description items as defined in the rfc. In this implementation only SDES_UNDEF and SDES_CNAME are usable.

Enumerator:
SDES_UNDEF 
SDES_CNAME 
SDES_NAME 
SDES_EMAIL 
SDES_PHONE 
SDES_LOC 
SDES_TOOL 
SDES_NOTE 
SDES_PRIV 

Definition at line 40 of file sdes.h.

                            {
            SDES_UNDEF = 0,
            SDES_CNAME = 1,
            SDES_NAME = 2,
            SDES_EMAIL = 3,
            SDES_PHONE = 4,
            SDES_LOC = 5,
            SDES_TOOL = 6,
            SDES_NOTE = 7,
            SDES_PRIV = 8
        };


Constructor & Destructor Documentation

SDESItem::SDESItem (  ) 

Default constructor.

Definition at line 29 of file sdes.cc.

Referenced by dup().

                   : cObject() {
    _type = SDES_UNDEF;
    _length = 2;
    _content = "";
};

SDESItem::SDESItem ( SDES_ITEM_TYPE  type,
const char *  content 
)

Constructor which sets the entry.

Definition at line 36 of file sdes.cc.

                                                           : cObject() {
    _type = type;
    _content = content;
    // an sdes item requires one byte for the type field,
    // one byte for the length field and bytes for
    // the content string
    _length = 2 + strlen(_content);
};

SDESItem::SDESItem ( const SDESItem sdesItem  ) 

Copy constructor.

Definition at line 46 of file sdes.cc.

                                           : cObject() {
    operator=(sdesItem);
};

SDESItem::~SDESItem (  )  [virtual]

Destructor.

Definition at line 51 of file sdes.cc.

                    {
};


Member Function Documentation

void SDESItem::dump ( std::ostream &  os  )  [virtual]

Writes an info about this SDESItem into the give output stream.

Definition at line 76 of file sdes.cc.

                                  {
    os << "SDESItem:" << endl;
    os << "  type = " << _type << endl;
    os << "  content = " << _content << endl;
};

SDESItem * SDESItem::dup (  )  const [virtual]

Duplicates theis SDESItem by calling the copy constructor.

Definition at line 64 of file sdes.cc.

                              {
    return new SDESItem(*this);
};

const char * SDESItem::getContent (  )  [virtual]

Returns the stored sdes string.

Definition at line 88 of file sdes.cc.

                                 {
    return opp_strdup(_content);
};

int SDESItem::getLength (  )  [virtual]

This method returns the size of this SDESItem in bytes as it would be in the real world.

Definition at line 93 of file sdes.cc.

Referenced by SDESChunk::addSDESItem().

                        {
    // bytes needed for this sdes item are
    // one byte for type, one for length
    // and the string
    return _length + 2;
};

SDESItem::SDES_ITEM_TYPE SDESItem::getType (  )  [virtual]

Returns the type of this sdes item.

Definition at line 83 of file sdes.cc.

Referenced by SDESChunk::addSDESItem().

                                         {
    return _type;
};

std::string SDESItem::info (  )  [virtual]

Writes a short info about this SDESItem into the given string.

Definition at line 69 of file sdes.cc.

                         {
    std::stringstream out;
    out << "SDESItem=" << _content;
    return out.str();
};

SDESItem & SDESItem::operator= ( const SDESItem sdesItem  ) 

Assignment operator.

Definition at line 55 of file sdes.cc.

Referenced by SDESItem().

                                                      {
    cObject::operator=(sdesItem);
    _type = sdesItem._type;
    _length = sdesItem._length;
    _content = opp_strdup(sdesItem._content);
    return *this;
};


Member Data Documentation

const char* SDESItem::_content [protected]

The sdes string.

Definition at line 123 of file sdes.h.

Referenced by dump(), getContent(), info(), operator=(), and SDESItem().

int SDESItem::_length [protected]

The length of this SDESItem.

Definition at line 118 of file sdes.h.

Referenced by getLength(), operator=(), and SDESItem().

The type of this SDESItem.

Definition at line 113 of file sdes.h.

Referenced by dump(), getType(), operator=(), and SDESItem().


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