Location:
APMREC.H
Link against: apmime.lib
class CApaDataRecognizerType : public CBase;
Abstract base class for a recognizer.
Concrete recognizers need to define and implement a derived class; specifically, they need to provide an implementation of
the DoRecognizeL()
, SupportedDataTypeL()
and PreferredBufSize()
functions.
The class is implemented as part of a DLL. The ordinal 1 function of the DLL must construct an instance of, and return a pointer to, a CApaDataRecognizerType derived class.
CBase
- Base class for all classes to be instantiated on the heap
CApaDataRecognizerType
- Abstract base class for a recognizer
Defined in CApaDataRecognizerType
:
CApaDataRecognizerType()
, Confidence()
, CreateDataRecognizerL()
, DoRecognizeL()
, ECertain
, EHigh
, ELow
, ENormal
, ENotRecognized
, EPossible
, EProbable
, EUnlikely
, FilePassedByHandleL()
, Lock()
, Locked()
, MimeType()
, MimeTypesCount()
, PreferredBufSize()
, Priority()
, RecognizeL()
, Reserved_1()
, SupportedDataTypeL()
, TRecognitionConfidence
, TRecognizerPriority
, TypeUid()
, Unlock()
, UpdateDataTypesL()
, iConfidence
, iCountDataTypes
, iDataType
, iPriority
, iTypeUid
, ~CApaDataRecognizerType()
Inherited from CBase
:
Delete()
,
Extension_()
,
operator new()
protected: IMPORT_C CApaDataRecognizerType(TUid aUid, TInt aPriority);
Constructs the recognizer with a UID and a priority.
Typically, a derived class constructor calls this constructor through a constructor initialization list.
The UID is the way that a recognizer is detected by the framework.
|
inline TInt MimeTypesCount() const;
Gets the number of data (MIME) types supported by this recognizer.
|
inline TUid TypeUid() const;
Gets the UID that identifies the recognizer.
|
inline TInt Priority() const;
Gets the recognizer's priority.
The priority defines the likelihood that the recognizer will successfully identify data. This is one of the CApaDataRecognizerType::TRecognizerPriority
enumerators.
|
inline TInt Confidence() const;
Gets the recognizer's confidence rating for the most recently recognized data.
|
inline TInt Locked() const;
Tests whether the recognizer is locked.
|
IMPORT_C TDataRecognitionResult RecognizeL(const TDesC &aName, const TDesC8 &aBuffer);
Attempts to recognize data.
This function is called by the Application Architecture server as a result of client calls to the server through an instance of RApaLsSession.
The function calls DoRecognizeL()
which implements recognition behaviour.
|
|
IMPORT_C TDataType MimeType();
Gets the data (MIME) type of the most recently recognized data.
|
IMPORT_C void Lock();
Adds a lock to the recognizer.
This may be called any number of times, but each call to this function must be matched by a corresponding call to Unlock()
to completely unlock the recognizer.
This function is used to prevent the recognizer DLL from being unloaded.
IMPORT_C void Unlock();
Removes a lock from the recognizer.
All calls to Lock()
should be matched by a corresponding call to this function. The recognizer is not unlocked until all calls to Lock()
have been matched by corresponding calls to this function.
IMPORT_C void UpdateDataTypesL();
Refreshes the list of data (MIME) types supported by this recognizer.
virtual IMPORT_C TUint PreferredBufSize();
Gets the size of buffer preferred for the purpose of recognizing the data type.
Regardless of the preferred buffer size returned by an implementation of this function, the actual size used is never greater than a maximum value as set by the client of the Application Architecture server through a call to RApaLsSession::SetMaxDataBufSize().
|
virtual IMPORT_C TDataType SupportedDataTypeL(TInt aIndex) const=0;
Gets one of the data (MIME) types that the recognizer can recognize.
|
|
protected: IMPORT_C RFile *FilePassedByHandleL();
Returns the RFile
(if any) of file to be recognized.
This function returns the file passed by handle from the client-side (i.e. from calls to the RFile-parameter overloads of RApaLsSession's RecognizeData, RecognizeSpecificData, AppForDocument and StartDocument). The function returns NULL if the file to be recognized was not passed by handle.
It may only be called from implementations of DoRecognizeL - indeed the purpose of this function is logically to provide an
extra parameter to the virtual DoRecognizeL function. All references/pointers to the RFile
object returned must be discarded when the implementation of DoRecognizeL returns.
The RFile
returned (if any) may be used by implementations of DoRecognizeL to retrieve more data than is provided in DoRecognizeL's
aBuffer parameter.
The current-position of the returned RFile
is the start of the file.
|
private: virtual IMPORT_C void DoRecognizeL(const TDesC &aName, const TDesC8 &aBuffer);
Implements the attempt to recognize data.
Recognizers should provide an implementation of this function in a derived class. Note that, when the implementation recognizes data, it must put the result of the operation in the iDataType and iConfidence data members.
Note that if more data is required than is provided in aBuffer, then CApaDataRecognizerType::FilePassedByHandleL
should be called and the data read from the returned RFile
(if not NULL). If this returns NULL, it may be possible to retrieve the data by calling RFile::Open()
on aName, but only if aName is a legal file-name. It may be something else, such as a URL.
The default implementation does not recognize data.
|
static IMPORT_C CApaDataRecognizerType *CreateDataRecognizerL(TUid aImplUid);
|
|
TRecognizerPriority
A set of values used to indicate the probability that the recognizer will successfully identify data. The Application Architecture framework uses this set to determine the order in which recognizers are invoked.
|
TRecognitionConfidence
A set of values describing the probability that the recognizer assigns to its belief that the most recently sampled data is of the type ascribed to it.
|
protected: TInt iCountDataTypes;
The number of data (MIME) types supported by this recognizer. Typically, this is set during construction of an instance of the derived class.
Users of the derived class use MimeTypesCount()
to get this value.
protected: TInt iConfidence;
The recognizer's confidence rating of the most recently recognized data.
Users of the derived class use Confidence()
to get this value.
protected: TDataType iDataType;
The data (MIME) type of the most recently recognized data.
Users of the derived class use MimeType()
to get this value.