Logo
~Apps~
~Projects~
~Contact~


BTObject Class Reference

Base class for an object in a bencoded string. More...

#include <BTObject.h>

Inheritance diagram for BTObject:

Inheritance graph
[legend]
Collaboration diagram for BTObject:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 BTObject (size_t i)
virtual ~BTObject ()
virtual char Type ()=0
virtual void Show ()
virtual void AddObject (BTObject *)
virtual void AddObject (const std::string &, BTObject *)
BTObjectGetParent ()
void SetParent (BTObject *p)
std::string printable (const std::string &s)
void Increase ()
size_t GetLength ()
size_t GetIndex ()

Private Attributes

BTObjectm_parent
size_t m_index
size_t m_len

Detailed Description

Base class for an object in a bencoded string.

File ......... BTObject.h Published .... 2005-06-14 Author ....... grymse@alhem.net

Definition at line 31 of file BTObject.h.


Constructor & Destructor Documentation

BTObject::BTObject ( size_t  i  )  [inline]

Definition at line 34 of file BTObject.h.

00034 : m_parent(NULL),m_index(i),m_len(0) {}

virtual BTObject::~BTObject (  )  [inline, virtual]

Definition at line 35 of file BTObject.h.

00035 {}


Member Function Documentation

virtual char BTObject::Type (  )  [pure virtual]

Implemented in BTDictionary, BTInteger, BTList, and BTString.

virtual void BTObject::Show (  )  [inline, virtual]

Reimplemented in BTDictionary, BTInteger, BTList, and BTString.

Definition at line 38 of file BTObject.h.

Referenced by BTString::Show(), and BTInteger::Show().

00038                             {
00039         }

virtual void BTObject::AddObject ( BTObject  )  [inline, virtual]

Reimplemented in BTList.

Definition at line 41 of file BTObject.h.

00041 {}

virtual void BTObject::AddObject ( const std::string &  ,
BTObject  
) [inline, virtual]

Reimplemented in BTDictionary.

Definition at line 42 of file BTObject.h.

00042 {}

BTObject* BTObject::GetParent (  )  [inline]

Definition at line 44 of file BTObject.h.

References m_parent.

Referenced by BTList::Show(), and BTDictionary::Show().

00044                               {
00045                 return m_parent;
00046         }

void BTObject::SetParent ( BTObject p  )  [inline]

Definition at line 47 of file BTObject.h.

References m_parent.

00047                                     {
00048                 m_parent = p;
00049         }

std::string BTObject::printable ( const std::string &  s  )  [inline]

Definition at line 50 of file BTObject.h.

Referenced by BTString::Show().

00050                                                 {
00051                 std::string str;
00052                 for (size_t i = 0; i < s.size(); i++)
00053                 {
00054                         if (isprint(s[i]))
00055                                 str += s[i];
00056                         else
00057                                 str += ".";
00058                 }
00059                 return str;
00060         }

void BTObject::Increase (  )  [inline]

Definition at line 61 of file BTObject.h.

References m_len, and m_parent.

00061                         {
00062                 m_len++;
00063                 if (m_parent)
00064                         m_parent -> Increase();
00065         }

size_t BTObject::GetLength (  )  [inline]

Definition at line 66 of file BTObject.h.

References m_len.

Referenced by BTDictionary::Show().

00066 { return m_len; }

size_t BTObject::GetIndex (  )  [inline]

Definition at line 67 of file BTObject.h.

References m_index.

00067 { return m_index; }


Member Data Documentation

Definition at line 70 of file BTObject.h.

Referenced by GetParent(), Increase(), and SetParent().

size_t BTObject::m_index [private]

Definition at line 71 of file BTObject.h.

Referenced by GetIndex().

size_t BTObject::m_len [private]

Definition at line 72 of file BTObject.h.

Referenced by GetLength(), and Increase().


The documentation for this class was generated from the following file:
Page, code, and content Copyright (C) 2006 by Anders Hedström
Generated on Mon Aug 29 20:21:47 2005 for C++ Sockets by  doxygen 1.4.4