pwfengine
Public Member Functions | Protected Member Functions | Protected Attributes | Friends
PWrapper Class Reference

An abstract wrapper. It is associated to an url and has a schema that can be automatically detected. More...

#include <PWrapper.h>

Inheritance diagram for PWrapper:
PPageWrapper PSiteWrapper

List of all members.

Public Member Functions

 PWrapper (PEngine *engine, PWrapper *parent)
PEngineengine () const
PWrapperparentWrapper ()
bool setName (QString wrapperName)
QString name () const
void setUrl (QString url)
QString url () const
void setSchemaCandidatesDirectory (const QString &directoryPath)
QString schemaCandidatesDirectory ()
PActionsetSchema (const QString &schemaName)
PActiondetectSchema ()
PSchemaschema () const
QString schemaName () const
virtual QString schemaFileName (const QString &schemaName)=0
TEvalWrapperData * evalData (const QString &name)

Protected Member Functions

PWrapperElementrootElement ()
virtual QList< QString > schemaCandidateNames ()=0
virtual QString cacheFileName ()=0

Protected Attributes

PWrapperPrivated

Friends

class PWrapperPrivate

Detailed Description

An abstract wrapper. It is associated to an url and has a schema that can be automatically detected.

Each wrapper is univocally identified by its name that must be setted as soon as having created the wrapper. Two wrappers referring to different urls but having the same name will be treated as the same and so will share the same cache.

See also:
setName
setUrl
setSchema
detectSchema

Constructor & Destructor Documentation

PWrapper::PWrapper ( PEngine engine,
PWrapper parent 
)
Warning:
Passing a null value for the engine parameter leads to undefined behavior

Member Function Documentation

virtual QString PWrapper::cacheFileName ( ) [protected, pure virtual]
Returns:
the cache filename for this wrapper.
an empty string if the wrapper url has not been specified (i.e it's empty)

Implemented in PPageWrapper, and PSiteWrapper.

PAction * PWrapper::detectSchema ( )

Automatically detect a valid schema for this wrapper by checking all the schema names returned by the schemaCandidateNames() method.

Warning:
Calling this method if there is already another detect running has no effect.
TEvalWrapperData* PWrapper::evalData ( const QString &  name)
Returns:
an evaluator for the data with the given name.
Warning:
Requesting a data without a valid schema leads to undefined behavior.
PWrapperElement * PWrapper::rootElement ( ) [protected]
Returns:
the root wrapper element, i.e. the element with the whole wrapper schema as its schema.
virtual QList<QString> PWrapper::schemaCandidateNames ( ) [protected, pure virtual]

Return a list containing the names of the schemas that must be checked by the detectSchema() method.

Implemented in PPageWrapper, and PSiteWrapper.

QString PWrapper::schemaCandidatesDirectory ( )
Returns:
if not null, the directory setted by the setSchemaCandidatesDirectory() or, otherwise, the engine schemas directory
virtual QString PWrapper::schemaFileName ( const QString &  schemaName) [pure virtual]

Given a schema name, return the filename of the schema. If the schema name is not valid, return an empty string.

Implemented in PPageWrapper, and PSiteWrapper.

QString PWrapper::schemaName ( ) const
Returns:
the active schema name or an empty string if it has not yet been set
bool PWrapper::setName ( QString  wrapperName)

The name must match the pattern [a-z0-9 -!#$%^()]+

Returns:
false if the name is an illegal string.
PAction * PWrapper::setSchema ( const QString &  schemaName)

Set the wrapper schema specifying its name (e.g. phpbb3). The library will in turn locate the file. This is the only method the user can use to 'directly' set the wrapper schema, this allow to set only schemas that are in the wrapper schemas folder.

Returns:
a PAction whose actionTarget is the new created PSchema.
void PWrapper::setSchemaCandidatesDirectory ( const QString &  directoryPath)

Set the directory where are located all the wrapper schemas. Overwrite the directory setted in the PEngine. Note: the final / is removed

void PWrapper::setUrl ( QString  url)

Set the wrapper target url

Warning:
The current schema might become invalid, immediately call detectSchema() or setSchema() if you are not sure or if you are setting the wrapper url for the first time.
QString PWrapper::url ( ) const

Return the wrapper target url


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations Enumerator