Public Member Functions | Protected Member Functions | List of all members
ARCSTypeFactoryTemplate< X > Class Template Referenceabstract

Template class to implement type factories. More...

#include <arcslibtoolkit.h>

Inheritance diagram for ARCSTypeFactoryTemplate< X >:
Inheritance graph
Collaboration diagram for ARCSTypeFactoryTemplate< X >:
Collaboration graph

Public Member Functions

virtual QString getTypeName () const =0
 Should return the name of the type factory.
 
virtual QString toString (QVariant v)
 Should return a string representation of data.
 
virtual QVariant parseString (QString s)
 Should create data from their string representation.
 
- Public Member Functions inherited from ARCSTypeFactory
virtual bool isInternal () const
 Tells wether the factory is internal or not (false by default).
 

Protected Member Functions

virtual X parse (QString s)=0
 This function should return a X object according to its string representation.
 
virtual QString serialize (X obj)=0
 This function serializes an X object to a string.
 

Detailed Description

template<class X>
class ARCSTypeFactoryTemplate< X >

Template class to implement type factories.

This class adds two more methods to implement. Usually, in order to make a new type available to ARCS, one need to derive from this template and reimplement the methods getTypeName(), parse() and serialize(). If you use the automated process, the name of your derived class should conform to the following syntax: ARCSTypeFactoryTemplate_<yourtypeclass>. As an example here is partly how the type factory for integers is declared inside of ARCS.

{
public:
virtual QString getTypeName() const { return "int"; }
protected:
virtual int parse(QString s) { return s.toInt(); }
virtual QString serialize(int obj) { return QString::number(obj);}
};
Author
Jean-Yves Didier
Date
October, 27th, 2007

Definition at line 119 of file arcslibtoolkit.h.


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