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.
Public Member Functions | |
---|---|
~CApaDataRecognizerType() | |
IMPORT_C CApaDataRecognizerType * | CreateDataRecognizerL(TUid) |
CDataRecognizerExtension * | DataRecognizerExtension() |
TInt | Locked() |
IMPORT_C TDataType | MimeType() |
TInt | MimeTypesCount() |
IMPORT_C TUint | PreferredBufSize() |
TInt | Priority() |
IMPORT_C TDataRecognitionResult | RecognizeL(const TDesC &, const TDesC8 &) |
TDataRecognitionResult | RecognizeL(TDataToRecognize &) |
IMPORT_C TDataType | SupportedDataTypeL(TInt) |
TUid | TypeUid() |
IMPORT_C void | Unlock() |
IMPORT_C void | UpdateDataTypesL() |
Protected Member Functions | |
---|---|
CApaDataRecognizerType(TUid, TInt) | |
IMPORT_C RFile * | FilePassedByHandleL() |
Private Member Functions | |
---|---|
IMPORT_C void | DoRecognizeL(const TDesC &, const TDesC8 &) |
IMPORT_C void | Reserved_1() |
Public Member Enumerations | |
---|---|
enum | TRecognitionConfidence { ECertain = KMaxTInt, EProbable = 100, EPossible = 0, EUnlikely = -100, ENotRecognized = KMinTInt } |
enum | TRecognizerPriority { EHigh = 100, ENormal = 0, ELow = -100 } |
Protected Attributes | |
---|---|
TInt | iConfidence |
TInt | iCountDataTypes |
TDataType | iDataType |
const TInt | iPriority |
const TUid | iTypeUid |
Private Attributes | |
---|---|
CDataRecognizerExtension * | iDataRecognizerExtn |
TInt | iLock |
IMPORT_C | CApaDataRecognizerType | ( | TUid | aUid, |
TInt | aPriority | |||
) | [protected] |
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.
IMPORT_C CApaDataRecognizerType * | CreateDataRecognizerL | ( | TUid | aImplUid | ) | [static] |
TUid aImplUid |
IMPORT_C void | DoRecognizeL | ( | const TDesC & | aName, |
const TDesC8 & | aBuffer | |||
) | [private, virtual] |
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.
const TDesC & aName | The name of the data; typically this is a file name containing the data to be recognized. It is not necessarily a legal file-name though. It may, for example, be a URL/URI. |
const TDesC8 & aBuffer | A buffer containing data to be recognized; typically, this is read from the start of the file containing the data. |
IMPORT_C RFile * | FilePassedByHandleL | ( | ) | [protected] |
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.
TInt | MimeTypesCount | ( | ) | const [inline] |
Gets the number of data (MIME) types supported by this recognizer.
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.
PreferredBufSize() RApaLsSession RApaLsSession::SetMaxDataBufSize()
const TDesC & aName | The name of the data; typically this is a file name containing the data to be recognized. |
const TDesC8 & aBuffer | A buffer containing data to be recognized; typically, this is read from the start of the file containing the data. Implement PreferredBufSize() to define the ideal size for this buffer. Note that failure to implement PreferredBufSize() results in a default buffer size of zero. |
TDataRecognitionResult | RecognizeL | ( | TDataToRecognize & | aDataToRecognize | ) |
TDataToRecognize & aDataToRecognize |
IMPORT_C TDataType | SupportedDataTypeL | ( | TInt | aIndex | ) | const [pure virtual] |
Gets one of the data (MIME) types that the recognizer can recognize.
TInt aIndex | An index that identifies the data type. Typically, the minimum value is zero and the maximum value is the value of MimeTypesCount() - 1. |
IMPORT_C void | UpdateDataTypesL | ( | ) |
Refreshes the list of data (MIME) types supported by this recognizer.
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.
ECertain = KMaxTInt |
The data is definitely of the data type. |
EProbable = 100 |
A level of confidence between ECertain and EPossible. |
EPossible = 0 |
The data is possibly of the data type. |
EUnlikely = -100 |
A level of confidence between EPossible and ENotRecognized. |
ENotRecognized = KMinTInt |
The data is not recognized. |
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.
EHigh = 100 |
The highest recognizer priority. Recognizers with this priority are invoked before those with any other priority. |
ENormal = 0 |
The normal recognizer priority. Recognizers with this priority are invoked after those with a EHigh priority but before those with a ELow priority. |
ELow = -100 |
The lowest recognizer priority. |
TInt | iConfidence | [protected] |
The recognizer's confidence rating of the most recently recognized data.
Users of the derived class use Confidence() to get this value.
TInt | iCountDataTypes | [protected] |
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.
CDataRecognizerExtension * | iDataRecognizerExtn | [private] |
TDataType | iDataType | [protected] |
The data (MIME) type of the most recently recognized data.
Users of the derived class use MimeType() to get this value.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.