UniCreateTransformObject

UniCreateTransformObject creates a string transform object.

Syntax
UniCreateTransformObject (locale_object, xtype, xform_object)

Parameters

 * locale_object (const LocaleObject): A locale object created by UniCreateLocaleObject or NULL.
 * xtype (const UniChar*) : A UniChar string identifying the transform type.
 * xform_object (XformObject*) : An address that will receive a pointer to an XformObject upon successful completion of UniCreateTransformObject.

Returns
Return value (int) - returns


 * ULS_SUCCESS : No errors; the xform_object argument points to a valid transformation object.
 * ULS_UNSUPPORTED : The transformation name type specified by the xtype argument is not supported for locale_object.

Remarks
UniCreateTransformObject obtains a transformation object for a transformation type as defined in the locale indicated by the locale_object argument. The function returns a transformation object that can be used as an argument in UniTransformStr.

The following transformation types are defined in all locales:
 * lower: Transform to lowercase characters. A character that does not have a lowercase form is returned as itself.
 * upper: Transform to uppercase characters. A character that does not have an uppercase form is returned as itself.
 * compose : Transform to fully composed form for combined characters.
 * decompose : Transform to a string of decomposed characters where multiple characters are used to represent base and diacritics.
 * hiragana : Transform so that Japanese phonetic characters are in hiragana
 * katakana : Transform so that Japanese phonetic characters are in full size katakana
 * kana : Transform so that Japanese phonetic characters are in half size katakana

In addition to the above transformation-type names, other transformation-type names in the locale (including user-defined transformation-type names) may be passed to UniCreateTransformObject through the xtype argument. To obtain a successful return, the transformation-type name must be defined in locale_object.

When UniCreateTransformObject completes without errors, the xform_object argument value specifies a valid pointer to a transformation object. The transformation object should be used in all subsequent calls to UniTransformStr. If the function result is other than ULS_SUCCESS, the contents of the area pointed to by xform_object are undefined.

Example
This example shows how to create and use a transform object. 
 * 1) include 
 * 2) include 

int main(void) {

LocaleObject locale_object = NULL; XformObject xform_object = NULL; int         rc = ULS_SUCCESS; int         in_unistr_elem = 0; int         out_unistr_elem = 10; UniChar     *pin_unistr = (UniChar *)L"os2"; UniChar     out_unistr[10];

/*****************************************************************/    /* Assumes LANG environment variable set to a valid locale name, */ /* such as fr_FR                                                */ /*****************************************************************/    rc = UniCreateLocaleObject(UNI_UCS_STRING_POINTER,                               (UniChar *)L"", &locale_object); if (rc != ULS_SUCCESS) { printf("UniCreateLocaleObject error: return code = %u\n", rc); return 1; }

/* Create an upper case transform object */ rc = UniCreateTransformObject(locale_object,                                 (UniChar *)L"upper", &xform_object); if (rc != ULS_SUCCESS) { printf("UniCreateTransformObject error: return code = %u\n", rc); return 1; }

/* Calculate the number of elements to transform */ in_unistr_elem = UniStrlen (pin_unistr) + 1;

/* Make call to transform input string to uppercase */ rc = UniTransformStr(xform_object, pin_unistr,                        &in_unistr_elem, out_unistr,                         &out_unistr_elem); if (rc != ULS_SUCCESS) { printf("UniTransformStr error: return code = %u\n", rc); return 1; }

return ULS_SUCCESS; } 

Format

 * 1) include 

int UniCreateTransformObject (   const LocaleObject locale_object,    /* I  - Locale object    */    const UniChar      *xtype,           /* I  - Transform type   */    XformObject        *xform_object     /* O  - Transform object */ ) 

Related Functions

 * UniFreeTransformObject