ObjectFactory Class Reference

ObjectFactory - a default AbstractFactory.Factory for creating Addresses. More...

#include <objectfactory.h>

Inheritance diagram for ObjectFactory:

Inheritance graph
[legend]
Collaboration diagram for ObjectFactory:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual QObject * newObject (QString className, QObject *parent=0)
 
Returns:
a QObject-derived instance which can handle the properties of className.

AddressnewAddress (Country::CountryType country=Country::Undefined)
AddressnewAddress (QString countryName="USA")

Static Public Member Functions

static ObjectFactoryinstance ()
 
Returns:
a singleton instance


Protected Member Functions

 ObjectFactory ()

Detailed Description

ObjectFactory - a default AbstractFactory.Factory for creating Addresses.

It knows how to create instances of some QObject-derived classes: Address and also can "spoof" classes it does not know about by setting dynamic properties.

It initializes constraints of the various Address-types before it creates the first instance.

It manages its own singleton instance, which is the parent of all newly created objects. You can set the parent to another object after it is returned.

Author:
Alan Ezust

Definition at line 31 of file objectfactory.h.


Member Function Documentation

QObject * ObjectFactory::newObject ( QString  className,
QObject *  parent = 0 
) [virtual]

Returns:
a QObject-derived instance which can handle the properties of className.

If the className is not a known type, it will return an instance of PropsMap, serving as a catch-all. By default, the new object is a child of "this", which means its lifetime expires when this object is destroyed. Overridden versions of this class may return more specific types.

Parameters:
className - the name of the class to create
parent the parent of the object.

Implements AbstractFactory.

Reimplemented in CustomerFactory.

Definition at line 20 of file objectfactory.cpp.

References newAddress().

Referenced by CustomerFactory::newObject(), and QObjectReader::startElement().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Wed Sep 30 01:15:44 2009 for oopapidocs by  doxygen 1.5.1