Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
TemplateList Class Reference

Default implementation of a context value of type list. More...

#include <template.h>

Inheritance diagram for TemplateList:
TemplateListIntf

Classes

class  Private
 Private data of a template list object. More...
 

Public Member Functions

virtual int count () const
 
virtual TemplateVariant at (int index) const
 
virtual TemplateListIntf::ConstIteratorcreateIterator () const
 
virtual int addRef ()
 
virtual int release ()
 
virtual void append (const TemplateVariant &v)
 
- Public Member Functions inherited from TemplateListIntf
virtual ~TemplateListIntf ()
 

Static Public Member Functions

static TemplateListalloc ()
 

Private Member Functions

 TemplateList ()
 
 ~TemplateList ()
 

Private Attributes

Privatep
 

Friends

class TemplateListConstIterator
 

Detailed Description

Default implementation of a context value of type list.

Definition at line 376 of file template.h.

Constructor & Destructor Documentation

TemplateList::TemplateList ( )
private

Creates a list

Definition at line 313 of file template.cpp.

314 {
315  p = new Private;
316 }
Private * p
Definition: template.h:399
Definition: types.h:26
TemplateList::~TemplateList ( )
private

Destroys the list

Definition at line 318 of file template.cpp.

319 {
320  delete p;
321 }
Private * p
Definition: template.h:399

Member Function Documentation

int TemplateList::addRef ( )
virtual

Increase object's reference count

Implements TemplateListIntf.

Definition at line 323 of file template.cpp.

324 {
325  return ++p->refCount;
326 }
Private * p
Definition: template.h:399
TemplateList * TemplateList::alloc ( )
static

Creates an instance with ref count set to 0

Definition at line 420 of file template.cpp.

421 {
422  return new TemplateList;
423 }
void TemplateList::append ( const TemplateVariant v)
virtual

Appends element v to the end of the list

Definition at line 343 of file template.cpp.

344 {
345  p->elems.append(v);
346 }
Private * p
Definition: template.h:399
Iterator append(const T &x)
Definition: qvaluelist.h:372
QValueList< TemplateVariant > elems
Definition: template.cpp:307
TemplateVariant TemplateList::at ( int  index) const
virtual

Returns the element at index position index.

Implements TemplateListIntf.

Definition at line 408 of file template.cpp.

409 {
410  if (index>=0 && index<(int)p->elems.count())
411  {
412  return p->elems[index];
413  }
414  else
415  {
416  return TemplateVariant();
417  }
418 }
Private * p
Definition: template.h:399
uint count() const
Definition: qvaluelist.h:394
QValueList< TemplateVariant > elems
Definition: template.cpp:307
Variant type which can hold one value of a fixed set of types.
Definition: template.h:90
int TemplateList::count ( ) const
virtual

Returns the number of elements in the list

Implements TemplateListIntf.

Definition at line 338 of file template.cpp.

339 {
340  return p->elems.count();
341 }
Private * p
Definition: template.h:399
uint count() const
Definition: qvaluelist.h:394
QValueList< TemplateVariant > elems
Definition: template.cpp:307
TemplateListIntf::ConstIterator * TemplateList::createIterator ( ) const
virtual

Creates a new iterator for this list.

Note
the user should call delete on the returned pointer.

Implements TemplateListIntf.

Definition at line 403 of file template.cpp.

404 {
405  return new TemplateListConstIterator(*this);
406 }
friend class TemplateListConstIterator
Definition: template.h:398
int TemplateList::release ( )
virtual

Decreases object's referenc count, destroy object if 0

Implements TemplateListIntf.

Definition at line 328 of file template.cpp.

329 {
330  int count = --p->refCount;
331  if (count<=0)
332  {
333  delete this;
334  }
335  return count;
336 }
Private * p
Definition: template.h:399
virtual int count() const
Definition: template.cpp:338

Friends And Related Function Documentation

friend class TemplateListConstIterator
friend

Definition at line 398 of file template.h.

Member Data Documentation

Private* TemplateList::p
private

Definition at line 399 of file template.h.


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