|
||
class CCHFDataSupplier : public CActive;
Base class for all Content Handling Framework Data Suppliers.
Data Suppliers provides the content of a URI-identified resource to a client.
The class is derived from CActive
to provide derived classes the mechanism for using their component in asynchronous transactions if required. Derived CCHFDataSupplier
class designers and users take full responsibility for managing the addition of their component to an active scheduler. Most
data suppliers will exhibit asynchronous behaviour and the API is designed to reflect this.
After creation of a data supplier component, the user of the component follows this recommended order of operation;
1. User
optionally calls CCHFDataSupplier::SetReadPosition(TUint32,TUint32)
to specify range
2. User
calls Start(..) on the component to supplier an observer interface and to commence reading
3. Data Supplier calls ReceivedCompleteL() on the observer to indicate availability of content
4. User
calls ContentType(..) to retrieve the content type.
5. User
calls Read(..) to retrieve the content
6. User
calls CCHFDataSupplier::RxReady()
to indicate readiness to receive more data
7. Data Supplier calls ReceivedCompleteL() on the observer to indicate availability of more data
8. Steps 5 to 6 is repeated until KErrEof is reported by either CCHFDataSupplier::RxReady()
or ReceivedCompleteL()
CBase
-
Base class for all classes to be instantiated on the heap.
CActive
-
The core class of the active object abstraction.
CCHFDataSupplier
- Base class for all Content Handling Framework Data Suppliers.
Defined in CCHFDataSupplier
:
BaseConstructL(const TDesC8 &)
Initialises the Data Supplier base class. Call this method in your derived class...CCHFDataSupplier(TInt)
Constructor.CCHFDataSupplier_Reserved_3()
CCHFDataSupplier_Reserved_4()
ContentType(TPtrC8 &)const
Gets the content type of the resource.EContentTypeKnown
Content type is known. EContentTypeUnknown
Content type is unknown. File()
The public calling API for getting the file-handle of the resource, if the conte...GetFile(RFile *&)
The private virtual function for getting the file-handle of the resource, if the...NewFromFileHandleL(RFile &,TUint)
Creates a CCHFDataSupplier object given a file-handle (rather than a URI).Observer()const
Gets the data supplier's observer. Read(TPtrC8 &)
Reads the portion of data received.RecognizeDataL(RFile &)
Attempts recognition of the content MIME type.RecognizeDataL(const TDesC &,const TDesC8 &)
Attempts recognition of the content MIME type.Reset()
Called by the client to reinitialise the data connection.ResourceSize()const
Gets the resource's total content size.Resume()
Resumes the Data Supplier from a suspended state.RxReady()
Called by the client to indicate readiness to receive more data.SetContentTypeL(const TDesC8 &)
Sets the content type to a client-specified value.SetObserver(MCHFDataSupplierObserver &)
Replaces the current Data Supplier Observer.SetReadPosition(TUint32)
Sets the data supplier read position.SetReadPosition(TUint32,TUint32)
Sets the range of data to be read.Start(MCHFDataSupplierObserver &)
Starts the Data Supplier call to supply an observer interface and to request the...Suspend()
Suspends activity on the Data Supplier.TContentTypeStatus
Describes the status of the content type buffer; whether known, i.e. set, or not...Uri()const
Gets the URI of the resource.iContentStatus
Holds the status of the content type buffer. ~CCHFDataSupplier()
Destructor.Inherited from CActive
:
CActive(TInt)
Constructs the active object with the specified priority.Cancel()
Cancels the wait for completion of an outstanding request.Deque()
Removes the active object from the active scheduler's list of active objects.DoCancel()
Implements cancellation of an outstanding request.EPriorityHigh
A priority higher than EPriorityUserInput.EPriorityIdle
A low priority, useful for active objects representing background processing.EPriorityLow
A priority higher than EPriorityIdle but lower than EPriorityStandard.EPriorityStandard
Most active objects will have this priority.EPriorityUserInput
A priority higher than EPriorityStandard; useful for active objects handling use...Extension_(TUint,TAny *&,TAny *)
Extension function IsActive()const
Determines whether the active object has a request outstanding.IsAdded()const
Determines whether the active object has been added to the active scheduler's li...Priority()const
Gets the priority of the active object.RunError(TInt)
Handles a leave occurring in the request completion event handler CActive::RunL(...RunL()
Handles an active object's request completion event.SetActive()
Indicates that the active object has issued a request and that it is now outstan...SetPriority(TInt)
Sets the priority of the active object.TPriority
Defines standard priorities for active objects. iStatus
The request status associated with an asynchronous request.Inherited from CBase
:
Delete(CBase *)
Deletes the specified object.operator new(TUint)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TAny *)
Initialises the object to binary zeroes.operator new(TUint,TLeave)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TLeave,TUint)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TUint)
Allocates the object from the heap and then initialises its contents to binary z...IMPORT_C ~CCHFDataSupplier();
Destructor.
This delete the resources allocated in this base class and cancels the Active Object.
protected: IMPORT_C CCHFDataSupplier(TInt aPriority);
Constructor.
|
CActive::CActive(TInt)
Constructs the active object with the specified priority.virtual TInt Start(MCHFDataSupplierObserver &aObserver)=0;
Starts the Data Supplier call to supply an observer interface and to request the Data Supplier to start supplying data.
|
|
MCHFDataSupplierObserver::ReceivedCompleteL(TInt)
Called to report data supplier status.virtual TInt Read(TPtrC8 &aReadBuffer)=0;
Clients should only call this method when they have been notified of a successful receive using the ReceivedCompleteL() method on the observer interface.
Reads the portion of data received.
The data is not destroyed when the call returns and may be read repeatedly before the next call to CCHFDataSupplier::RxReady()
.
|
|
virtual TInt RxReady()=0;
Called by the client to indicate readiness to receive more data.
The last data is destroyed
|
virtual TInt SetReadPosition(TUint32 aReadPositionInBytes, TUint32 aReadLengthInBytes)=0;
Sets the range of data to be read.
|
|
IMPORT_C TInt SetReadPosition(TUint32 aReadPositionInBytes);
Sets the data supplier read position.
Use this method to navigate the resource content by moving the read position. To set the range, instead of just the position,
see CCHFDataSupplier::SetReadPosition(TUint32,TUint32)
|
|
CCHFDataSupplier::SetReadPosition(TUint32,TUint32)
Sets the range of data to be read.IMPORT_C virtual void SetObserver(MCHFDataSupplierObserver &aObserver);
Replaces the current Data Supplier Observer.
Call this method to replace the observer of the Data Supplier. The new observer becomes the target of all subsequent call backs.
|
IMPORT_C virtual TInt Suspend();
Suspends activity on the Data Supplier.
|
IMPORT_C virtual TInt Resume();
Resumes the Data Supplier from a suspended state.
|
IMPORT_C virtual TContentTypeStatus ContentType(TPtrC8 &aContentType) const;
Gets the content type of the resource.
|
|
IMPORT_C virtual void SetContentTypeL(const TDesC8 &aNewContentType);
Sets the content type to a client-specified value.
Call this method to override the content type of the resource for subsequent use by a content handler.
|
|
IMPORT_C virtual const TDesC8& Uri() const;
Gets the URI of the resource.
|
IMPORT_C RFile* File();
The public calling API for getting the file-handle of the resource, if the content is being supplied by file-handle rather than by URI.
|
CCHFDataSupplier::GetFile(RFile *&)
The private virtual function for getting the file-handle of the resource, if the...IMPORT_C virtual TUint32 ResourceSize() const;
Gets the resource's total content size.
|
IMPORT_C MCHFDataSupplierObserver& Observer() const;
Gets the data supplier's observer.
|
|
IMPORT_C virtual TInt Reset();
Called by the client to reinitialise the data connection.
The data supplier is in its initial state. CCHFDataSupplier::Start(MCHFDataSupplierObserver &)
must be called again to reuse the resource.
|
IMPORT_C TInt GetContentAccessIntent(ContentAccess::TIntent &aContentAccessIntent) const;
The public calling API for getting the content-access intent.
|
|
CCHFDataSupplier::GetContentAccessIntent(ContentAccess::TIntent *&)
The private virtual function for getting the content-access intent value by non-...IMPORT_C TInt SetContentAccessIntent(ContentAccess::TIntent aContentAccessIntent);
The public calling API for setting the content-access intent.
|
|
CCHFDataSupplier::GetContentAccessIntent(ContentAccess::TIntent *&)
The private virtual function for getting the content-access intent value by non-...IMPORT_C static CCHFDataSupplier* NewFromFileHandleL(RFile &aFile, TUint aBufferSizeInBytes);
Creates a CCHFDataSupplier object given a file-handle (rather than a URI).
|
|
IMPORT_C static CCHFDataSupplier* NewFromFileHandleL(RFile &aFile, TUint aBufferSizeInBytes, ContentAccess::TIntent aContentAccessIntent);
Creates a CCHFDataSupplier object given a file-handle (rather than a URI).
|
|
protected: IMPORT_C void RecognizeDataL(const TDesC &aFileName, const TDesC8 &aDataBuffer);
Attempts recognition of the content MIME type.
This attempts to recognise the content MIME type given a portion of the content and its filename. It defaults the value of the content type to 'application/octet-stream' if there is no possible recognition, otherwise the content-type is set to the best guess of the content-type.
Sets the content type status indicator, iContentStatus, to EContentTypeKnown
|
|
protected: IMPORT_C void RecognizeDataL(RFile &aFile);
Attempts recognition of the content MIME type.
This attempts to recognise the content MIME type given a file-handle. It defaults the value of the content type to 'application/octet-stream' if there is no possible recognition, otherwise the content-type is set to the best guess of the content-type.
Sets the content type status indicator, iContentStatus, to EContentTypeKnown
|
|
protected: IMPORT_C void BaseConstructL(const TDesC8 &aUri);
Initialises the Data Supplier base class. Call this method in your derived class' ConstructL() to set the URI of the data supplier.
|
|
private: IMPORT_C virtual void GetFile(RFile *&aFile);
The private virtual function for getting the file-handle of the resource, if the content is being supplied by file-handle rather than by URI.
|
CCHFDataSupplier::File()
The public calling API for getting the file-handle of the resource, if the conte...private: IMPORT_C virtual void GetContentAccessIntent(ContentAccess::TIntent *&aContentAccessIntent);
The private virtual function for getting the content-access intent value by non-const pointer, so that it can be read and modified.
|
TContentTypeStatus
Describes the status of the content type buffer; whether known, i.e. set, or not.
|
protected: TContentTypeStatus iContentStatus;
Holds the status of the content type buffer.
CCHFDataSupplier::TContentTypeStatus
Describes the status of the content type buffer; whether known, i.e. set, or not...CCHFDataSupplier::ContentType(TPtrC8 &)const
Gets the content type of the resource.