Click on the following link to download the example: ExampleInetProtUtil.zip
Click: browse to view the example code.
This example code demonstrates the usage of utilities provided by the InetProtUtil API. The users should have a prior knowledge of concepts associated with it, such as URLs and URI components.
The central class is CExampleInetProtUtil , which demonstrates the following functionality:
void CExampleInetProtUtil::CreateUri();
Creates a URI with respect to the physical path of a given file.
For example, the physical path of the file:
K:/ws/direct/direct.mmp
gives the following URI file:
///k/ws/direct/direct.mmp
The screen output from this example is:
void CExampleInetProtUtil::ModifyUriComponents();
Modifies URI components, which involves:
Adding URI components, where it constructs the URI component by component. For example, you can add the following components:
to get the complete URI:
http://waterlang.org:8080/main_page.html
The screen output from this example is:
Removing the specific URI component(s) from a constructed URI. For example, the above URI with the port number removed:
http://waterlang.org/main_page.html
The screen output from this example is:
void CExampleInetProtUtil::ResolveUri();
Resolves the URI, which involves creation of an absolute CUri object from a given reference URI.
The screen output from this example is:
void CExampleInetProtUtil::ParseUri();
Parses the URI into its components (as given in RFC2396 ). The five URI components are:
The screen output from this example is:
void CExampleInetProtUtil::ValidateUriComponents();
Validates a given URI. This function is usually used for URIs with SIP as the scheme.
The screen output from this example is:
void CExampleInetProtUtil::ExtractUriComponents();
Extracts URI components from the given URI.
The screen output from this example is:
Retrieving a filename from a URI
void CExampleInetProtUtil::RetrieveFileName();
Extracts the actual physical location of the file from its URI.
The screen output from this example is:
Adding and removing delimiters from a URI
void CExampleInetProtUtil::ModifyDelimiter();
Adds the delimiters to and removes the delimiters from a URI. Before doing this ensure that:
The screen output from this example is:
Removing whitespace from a URI
void CExampleInetProtUtil::WhiteSpaceRemover();
Removes the whitespace from the given URI and returns the number of white spaces that were removed.
The screen output from this example is:
Escape encoding and decoding a URI
void CExampleInetProtUtil::EscapeEncodeDecode();
Escape encodes the characters in a given URI as escape triplets and decodes it to the original one.
The screen output from this example is:
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.