Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


Querying URIs from the URI List

The RInetUriList class provides the following APIs for retrieving the information of URIs present in the list:

The aQueryCallback parameter of the QueryUriL API provides a callback interface that needs to be implemented by the calling client. The calling client class should derive from the MQueryResultsCallback class and provide implementation for the MQueryResultsCallback::OnQueryResultsL() function. The optional aUriCustomiser parameter of the QueryUriL API provides a callback interface for URI customisation by scheme/protocol normalization. The calling client should be derived from the MUriCustomiser class and provide implementation for the MUriCustomiser::OnUriCustomisationL() function. Given below are some code samples for performing different queries.

//Create a Uri
_LIT8(KUri, “http://www.symbian.com/symbianos/email/index.html”);

//Create a session with the server.
    RInetUriList uriListObj;
    uriListObj.OpenL();
    CleanupClosePushL(uriListObj);

//Construct TQueryArgs object with Uri, service type
//and match type. 
    TQueryArgs uriArgs(KUri, EBrowser, EDomain);

//Query the Uri and close the session. 
    uriListObj. QueryUriL(uriArgs, this);
    CleanupStack::PopAndDestroy(&uriListObj);

In the above code sample, all the browsing URIs matching with the domain name www.symbian.com is searched from both BlackList and WhiteList, as list type is not specified. The second parameter is a pointer to the client class that implements the OnQueryResultsL() call back function. For each matching URI that is found, the QueryUriL function calls the OnQueryResultsL callback function until it returns EFalse, or until all matching URIs are passed to it.

The match type is a value of enumeration TURIMatch. The searching criteria can be changed by changing the match type.

//Create a session with the server.
    RInetUriList uriListObj;
    uriListObj.OpenL();
    CleanupClosePushL(uriListObj);

//Construct TQueryArgs object with service type and 
//match type.
    TQueryArgs uriArgs(EBrowser);

//Query the Uri and close the session. 
    uriListObj. QueryUriL(uriArgs, this, this);
    CleanupStack::PopAndDestroy(&uriListObj);

The above code sample retrieves all browser URIs of both BlackList and WhiteList types. To retrieve all the URIs for all service types, the caller has to loop for all service types. The third argument of QueryUriL indicates that the caller has implemented the OnUriCustomisationL() callback function, and so the URI will be passed to this callback function for normalization before being passed for a query.