MQeString

The MQeString class contains user defined and System Strings and is an abstraction of character strings. It allows a string to be created or retrieved in a number of formats such as arrays containing Unicode code points (each code point stored in a 1, 2, or 4 bytes memory space) and UTF-8. The current implementation only supports these external formats.

MQeString is used throughout the C-API where a string is required.

Note:
Although they are passed using an MQeString some API calls require the actual string to lie within the valid ASCII range.

Constant Strings

A number of constant strings are provided. These are defined in the following header files:

Constructor
There are different string constructors that are represented as CHAR8, CHAR16, CHAR32, and UTF8:
		

This function creates a new MQeString object from a buffer containing character data. The data can be in a number of supported formats including, null terminated single byte character arrays (i.e. normal C char* strings), null terminated double-byte Unicode character arrays, null terminated quad-byte Unicode character arrays, and null terminated UTF-8 arrays.

Destructor
MQERETURN mqeString_free(MQeStringHndl hString, 
									MQeExceptBlock *pErrStruct)

This function destroys an MQeString object that was created using mqeString_new, or returned by any other function.

Getter
These functions populate a character buffer with the contents of an MQeString performing conversion wherever necessary. Only simple conversions are carried out. No codepage conversion is attempted. For example, if an SBCS string has been put into the string, then trying to get the data out as DBCS (Unicode) data works correctly. However, if the data was put in as DBCS, and you try to get the data out as SBCS, this only works if the data does not have any values that cannot be represented with a single byte. When get() is used for SBCS, DBCS, or QBCS, each character is represented by its Unicode code point value. The caller of these functions are expected to allocate the memory. If the pOutputString pointer is null, or the size (pointed to by pSize) is less than zero, the required size of the buffer in the number of characters will be returned.

Tester
MQERETURN mqeString_codePOintSize(MQeStringHndl hString, MQeExceptBlock 
												*pErrStruct,MQEINT32 *pSize)

This function finds the number of bytes required to store the largest code point in the string.



© IBM Corporation 2002. All Rights Reserved