#include <apmrec.h>
class CApaDataRecognizerType : public CBase |
Protected Attributes | |
---|---|
TInt | iConfidence |
TInt | iCountDataTypes |
TDataType | iDataType |
const TInt | iPriority |
const TUid | iTypeUid |
Public Member Enumerations | |
---|---|
enum | TRecognitionConfidence { ECertain, EProbable, EPossible, EUnlikely, ENotRecognized } |
enum | TRecognizerPriority { EHigh, ENormal, ELow } |
Public Member Functions | |
---|---|
~CApaDataRecognizerType() | |
TInt | Confidence() |
IMPORT_C CApaDataRecognizerType * | CreateDataRecognizerL(TUid) |
CDataRecognizerExtension * | DataRecognizerExtension() |
IMPORT_C void | Lock() |
TInt | Locked() |
IMPORT_C TDataType | MimeType() |
TInt | MimeTypesCount() |
virtual IMPORT_C TUint | PreferredBufSize() |
TInt | Priority() |
IMPORT_C TDataRecognitionResult | RecognizeL(const TDesC &, const TDesC8 &) |
TDataRecognitionResult | RecognizeL(TDataToRecognize &) |
pure virtual 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() |
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.
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.
TDataType | iDataType | [protected] |
The data (MIME) type of the most recently recognized data.
Users of the derived class use MimeType() to get this value.
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.
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.
See also: CApaDataRecognizerType() Priority()
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.
Parameter | Description |
---|---|
aUid | A UID that identifies the recognizer. |
aPriority | A value that estimates the probability that the recognizer will successfully identify data. This is one of the CApaDataRecognizerType::TRecognizerPriority enumerators. |
TInt | Confidence | ( | ) | const [inline] |
Gets the recognizer's confidence rating for the most recently recognized data.
See also: CApaDataRecognizerType::TRecognitionConfidence iConfidence
Returns: The confidence rating. This is one of the TRecognitionConfidence enumeration values.
IMPORT_C CApaDataRecognizerType * | CreateDataRecognizerL | ( | TUid | aImplUid | ) | [static] |
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.
See also: DoRecognizeL()
Returns: The file, passed by handle, to be recognized. Returns NULL if the data to be recognized was passed from the client-side by name/buffer rather than by file-handle. Ownership of the returned object is NOT transferred to the caller.
TInt | MimeTypesCount | ( | ) | const [inline] |
Gets the number of data (MIME) types supported by this recognizer.
See also: iCountDataTypes
Returns: The number of data types.
IMPORT_C TUint | PreferredBufSize | ( | ) | [virtual] |
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().
See also: RApaLsSession::SetMaxDataBufSize()
Returns: The preferred data size. The default implementation returns zero.
TInt | Priority | ( | ) | const [inline] |
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.
Returns: The priority value.
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.
See also: PreferredBufSize() RApaLsSession RApaLsSession::SetMaxDataBufSize()
Parameter | Description |
---|---|
aName | The name of the data; typically this is a file name containing the data to be recognized. |
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. |
Returns: The result of the attempt to recognize the data.
TDataRecognitionResult | RecognizeL | ( | TDataToRecognize & | aDataToRecognize | ) |
Gets one of the data (MIME) types that the recognizer can recognize.
Parameter | Description |
---|---|
aIndex | An index that identifies the data type. Typically, the minimum value is zero and the maximum value is the value of MimeTypesCount() - 1. |
Returns: The data (MIME) type.