rapi/ucs2le.c File Reference

#include "ucs2le.h"
#include <string.h>
#include <langinfo.h>
#include <locale.h>

Functions

int ucs2le_open (t_ucs2le *theHandle)
 Initializes sring conversion engine.
void ucs2le_close (t_ucs2le *aHandle)
 Releases resources occupied by the string conversion engine.
BOOL ucs2le_isvalid (const t_ucs2le *aHandle)
 Checks if the given handle is valid.
int ucs2le_from (const t_ucs2le *aHandle, char *theString, LPCWSTR aWStr, size_t aMaxNum)
int ucs2le_to (const t_ucs2le *aHandle, LPWSTR theWString, const char *anStr, size_t aMaxNum)

Variables

const WCHAR WCHAR0 = (WCHAR) 0

Function Documentation

void ucs2le_close ( t_ucs2le aHandle  ) 

Releases resources occupied by the string conversion engine.

Does nothing under windows. Calls iconv_close() for both iconv handles else.

Parameters:
aHandle the string conversion engine handle.

int ucs2le_from ( const t_ucs2le aHandle,
char *  theString,
LPCWSTR  aWStr,
size_t  aMaxNum 
)

Converts the given UCS-2LE string into current codepage.

Parameters:
aHandle the string conversion engine handle.
theString the resulting string in local code page.
aWStr the string in UCS-2LE to convert.
aMaxNum the maximum number of characters to put in theString. In fact the buffer pointed by theString must be able to hold at least aMaxNum+1 characters because of the trailing 0.
Returns:
0 for OK, error code else.

BOOL ucs2le_isvalid ( const t_ucs2le aHandle  ) 

Checks if the given handle is valid.

For windows the handle is always valid, for non windows it is valid, if it contains valid iconv_t handles.

Parameters:
aHandle the string conversion engine handle.
Returns:
TRUE, if the handle is valid, FALSE else.

int ucs2le_open ( t_ucs2le theHandle  ) 

Initializes sring conversion engine.

Warning! Function sets current locales in the non windows version.

Parameters:
theHandle the resulting conversion handle. Some dummy value on windows, pair of iconv handles for conversions from and to UCS-2LE on non windows.
Returns:
0 on success. Error code else.

int ucs2le_to ( const t_ucs2le aHandle,
LPWSTR  theWString,
const char *  anStr,
size_t  aMaxNum 
)

Converts the given string in current codepage into UCS-2LE.

Parameters:
aHandle the string conversion engine handle.
theWString the resulting string in UCS-2LE.
anStr the string in current codepage to convert.
aMaxNum the maximum number of characters to put in theWString. In fact the buffer pointed by theWString must be able to hold at least aMaxNum+1 characters because of the trailing 0.
Returns:
0 for OK, error code else.


Variable Documentation

const WCHAR WCHAR0 = (WCHAR) 0


Generated on Mon Jul 12 14:51:51 2010 for cetoys by  doxygen 1.5.6