[Classes] [Prev] [Next] [Methods]

CValidatorFactory

Methods Index

Heritage
Description
Usage
Public Methods
Override

CValidatorFactory


Heritage

Superclass: None

Subclasses: CValidatorFactoryDefault

Helper Classes: CValidator


Description

CValidatorFactory manages the creation of CValidator objects. CValidators are passed to views that mix in the CValidatorInterface for field formatting and validation. The factory is accessed through the VALIDATOR_FACTORY macro.

ConstructValidator() creates a validator that uses the PTK formatting patterns. (See the online XVT Portability Toolkit Reference for more information.)


Usage

#include CGlobalClassLib_i
#include PwrFactoryDef_i
#include CValidatorFactory_i
...
itsNLineText->SetValidator(
VALIDATOR_FACTORY->ConstructValidator(
"{Sun,Mon,Tue,Wed,Thu,Fri,Sat}")
);

Public Methods

virtual CValidator ConstructValidator(
const CStringRW& aPattern,
BOOLEAN AutoComplete = TRUE);
virtual ~CValidatorFactory();

Override

To override the CValidator generation by CValidatorFactory, for example, you should design a subclass of CValidatorFactory, overriding ConstructValidator().

class CMyValidatorFactory : public CValidatorFactory
{

public:

virtual CValidator ConstructValidator(
const CStringRW& aPattern,
BOOLEAN AutoComplete = TRUE);
{
...

}

};
Then install an instance of this factory into the factory manager as soon as the manager is created within CApplication::InstallFactories(...).

void CMyApplication::InstallFactories(
CFactoryMgr* mgr)
{
CApplication::InstallFactories(mgr);
itsMyValidatorFactory = new CMyValidatorFactory;
mgr->AddFactory(kValidatorFactoryTypeId,
itsMyValidatorFactory);
}
And then remember to delete the factory after it is no longer used, since the factory manager will not delete it for you.

void CMyApplication::ShutDown()
{
CApplication::ShutDown();
delete itsMyValidatorFactory;
}


[Classes] [Prev] [Next] [Methods]

support@xvt.com


Visit our online help desk for tech support

Copyright © 2009, Providence Software Solutions Inc. All rights reserved.