commore  1.0.6-SNAPSHOT
All Classes Namespaces Functions Variables Typedefs Enumerations Pages
commore::RefFactory Class Reference

#include <RefObject.h>

Public Member Functions

virtual const AChar * factory_name () const
 
virtual AutoRefBase create (const AChar *s) const
 
virtual AutoRefBase bind (const AChar *s) const
 

Static Public Member Functions

static AutoRefBase lookup_create (const AChar *factory_name, const AChar *s, const AutoRefBase &def)
 
static AutoRefBase lookup_bind (const AChar *factory_name, const AChar *s, const AutoRefBase &def)
 

Detailed Description

General purpose factory for RefObject. Create or Bind to a real object, based on a string specification. A RefFactory must be instantiated once : it is usually done with a single static declaration in the source file, as the factory constructor is responsible for adding itself to a global list of factories (factory_list_ in AutoRef.cpp).

Todo:
is bind method really useful

Member Function Documentation

virtual AutoRefBase commore::RefFactory::bind ( const AChar *  s) const
virtual

Bind to an existing object, from a string spec. Must return NULL if the spec is not handled by this factory.

Todo:
is this method useful
virtual AutoRefBase commore::RefFactory::create ( const AChar *  s) const
virtual

Create an object from a string specification. If this specific factory is not intended to handle instantiation for this spec, it must return NULL.

Parameters
soptional creation parameter
Returns
an autoref to a created object
virtual const AChar* commore::RefFactory::factory_name ( ) const
virtual

Name of the type this factory claims to be able to instanciate. This factory is a pretender for the creation of RefObjects which have the same factory_name.

Returns
factory name
static AutoRefBase commore::RefFactory::lookup_bind ( const AChar *  factory_name,
const AChar *  s,
const AutoRefBase def 
)
static

Same as lookup_create, but for binding.

Todo:
is useful
static AutoRefBase commore::RefFactory::lookup_create ( const AChar *  factory_name,
const AChar *  s,
const AutoRefBase def 
)
static

Check all the factories in the global list, to instantiate an object of type 'factory_name', with spec 's'. Return the instantiated object, or 'def' (the given default object) if no factory was able to create the object.

Returns
an autoref to a created object
Parameters
factory_namename of a factory
soptional creation parameter
defdefault value

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