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

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

#include <template.h>

Inheritance diagram for TemplateStruct:
TemplateStructIntf

Classes

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

Public Member Functions

virtual TemplateVariant get (const char *name) const
 
virtual int addRef ()
 
virtual int release ()
 
virtual void set (const char *name, const TemplateVariant &v)
 
- Public Member Functions inherited from TemplateStructIntf
virtual ~TemplateStructIntf ()
 

Static Public Member Functions

static TemplateStructalloc ()
 

Private Member Functions

 TemplateStruct ()
 
virtual ~TemplateStruct ()
 

Private Attributes

Privatep
 

Detailed Description

Default implementation of a context value of type struct.

Definition at line 426 of file template.h.

Constructor & Destructor Documentation

TemplateStruct::TemplateStruct ( )
private

Creates a struct

Definition at line 250 of file template.cpp.

251 {
252  p = new Private;
253 }
Private * p
Definition: template.h:450
Definition: types.h:26
TemplateStruct::~TemplateStruct ( )
privatevirtual

Destroys the struct

Definition at line 255 of file template.cpp.

256 {
257  delete p;
258 }
Private * p
Definition: template.h:450

Member Function Documentation

int TemplateStruct::addRef ( )
virtual

Increase object's reference count

Implements TemplateStructIntf.

Definition at line 260 of file template.cpp.

261 {
262  return ++p->refCount;
263 }
Private * p
Definition: template.h:450
TemplateStruct * TemplateStruct::alloc ( )
static

Creates an instance with ref count set to 0.

Definition at line 294 of file template.cpp.

295 {
296  return new TemplateStruct;
297 }
TemplateVariant TemplateStruct::get ( const char *  name) const
virtual

Gets the value for a field name.

Parameters
[in]nameThe name of the field.

Implements TemplateStructIntf.

Definition at line 288 of file template.cpp.

289 {
290  TemplateVariant *v = p->fields.find(name);
291  return v ? *v : TemplateVariant();
292 }
static QCString name
Definition: declinfo.cpp:673
Private * p
Definition: template.h:450
QDict< TemplateVariant > fields
Definition: template.cpp:246
Variant type which can hold one value of a fixed set of types.
Definition: template.h:90
int TemplateStruct::release ( )
virtual

Decreases object's referenc count, destroy object if 0

Implements TemplateStructIntf.

Definition at line 265 of file template.cpp.

266 {
267  int count = --p->refCount;
268  if (count<=0)
269  {
270  delete this;
271  }
272  return count;
273 }
Private * p
Definition: template.h:450
void TemplateStruct::set ( const char *  name,
const TemplateVariant v 
)
virtual

Sets the value the field of a struct

Parameters
[in]nameThe name of the field.
[in]vThe value to set.

Definition at line 275 of file template.cpp.

276 {
277  TemplateVariant *pv = p->fields.find(name);
278  if (pv) // change existing field
279  {
280  *pv = v;
281  }
282  else // insert new field
283  {
284  p->fields.insert(name,new TemplateVariant(v));
285  }
286 }
static QCString name
Definition: declinfo.cpp:673
Private * p
Definition: template.h:450
QDict< TemplateVariant > fields
Definition: template.cpp:246
Variant type which can hold one value of a fixed set of types.
Definition: template.h:90

Member Data Documentation

Private* TemplateStruct::p
private

Definition at line 450 of file template.h.


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