Open C String Utilities Example

String Utilities Library Example

String manipulation on Symbian platform is bit tricky. Even though Symbian platform has rich set of APIs for formatting/manipulating strings with both UNICODE (16 bit variants) and narrow character sets (8-bits), using those APIs will be bit complex for those who have familiarized Standard C string manipulations. When one writes hybrid applications on Symbian platform using native Symbian APIs as well as Open C APIs, user may need to convert the descriptors of Symbian platform to standard C character strings and vice versa. Especially, in case of writing hybrid applications on open C, user will be facing this conversion problem more frequently. It is really difficult to do these conversions without the thorough knowledge of Symbian platform descriptors. OpenCStringUtilitiesEx is a library, which makes Open C’s developers life easy. OpenCStringUtilitiesEx is a library, which exports several string- utility APIs for descriptor to character string conversions and vice versa. With the help of this library, user will be able to write a hybrid application on Open C, with out knowing much about the descriptors of Symbian platform.

Download

Click on the following link to download the example: OpenCStringUtilitiesEx.zip

Click: browse to view the example code.

Design and Implementation

The following sections provide information about the implementation of the example.

Capabilities

The program capabilities are defined in: stringutils.mmp(DLL - library): CAPABILITY NONE stringutils_example.mmp (EXE - application): CAPABILITY NONE.

Module Hierarchy

This application has 2 modules as below: String-utils library (OpenCStringUtilitiesLibEx.dll) that exports set of APIs for the user (OpenCStringUtilitiesLibEx). An application (EXE) that demonstrates the usage of Open C APIs and also those APIs exported by String Utils library. (OpenCStringUtilitiesLibEx) This example creates a DLL which exports set of generic APIs that can be used to convert descriptor of Symbian platform to character string and vice versa. To give an rough idea on how to use these APIs, an EXE is provided that calls the APIs of OpenCStringUtilitiesLibEx and illustrates their uses.

Implementation details of EXE

OpenCStringUtilitiesExeEx is a simple console based C application that uses String-utils library. This application uses main() as the entry point for the application.It demonstrates how to use String-utils library (OpenCStringUtilitiesLibEx.dll) APIs. It has its own icon and can be launched from the UI both in the emulator and in the device.

APIs demonstrated

tbuf16towchar

tbuf16tochar

tbuf8towchar

tbufC16towchar

tbufC8tochar

tbufC16tochar

tbufC8towchar

wchartotbuf16

chartotbuf16

wchartotbuf8

chartotbuf8

wchartohbufc16

chartohbufc16

wchartohbufc8

chartohbufc8

hbufC16towchar

hbufC16tochar

hbufC8towchar

hbufC8tochar

Building and Using

To build the example application, go to the OpenCStringUtilitiesEx\group directory and build the application. The definition for the whole application can be found in the bld.inf file in the group subdirectory of the applications main directory.