Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

xmog_java_string Class Reference
[String Handling]

A mixin or utility class for Java string features. More...

#include <xmog_java_string.h>

Collaboration diagram for xmog_java_string:

Collaboration graph
[legend]
List of all members.

Static Public Member Functions

static void init_encodings (xmog_localenv *env=NULL)
 Initializes the static instances.
static void set_default_encoding (const char *_enc, xmog_localenv *env=NULL)
 Sets the default encoding that is used on the current thread.
static void set_default_encoding (const XMOG_WCHAR *_enc, xmog_localenv *env=NULL)
 Sets the default encoding that is used on the current thread.
static void set_default_encoding (xmog_base *_enc, xmog_localenv *env=NULL)
 Sets the default encoding that is used on the current thread.
static jstring from_char (const char *_str, jint _len=-1, xmog_base *_enc=NULL, xmog_localenv *env=NULL, xmog_base *pStr=NULL, char **pCache=NULL)
 Returns a jstring for the given character string.
static void from_char (xmog_base *_this, xmog_flags _flags, const char *_str, jint _len=-1, xmog_base *_enc=NULL, xmog_localenv *env=NULL, xmog_base *pStr=NULL, char **pCache=NULL)
 Returns a jstring for the given character string.
static jstring from_charUtf8 (const char *_strUTF, xmog_localenv *env=NULL)
 Returns a jstring for the given UTF-8 character string.
static void from_charUtf8 (xmog_base *_this, xmog_flags _flags, const char *_strUTF, xmog_localenv *env=NULL)
 Returns a jstring for the given UTF-8 character string.
static char * to_char (jstring _str, xmog_localenv *env=NULL, xmog_base *pStr=NULL, char **pCache=NULL)
 Returns a char string for the given Java string.
static char * to_char (jstring _str, xmog_base *_enc=NULL, xmog_localenv *env=NULL, xmog_base *pStr=NULL, char **pCache=NULL)
 Returns a char string for the given Java string.
static char * to_charUtf8 (jstring _str, xmog_localenv *env=NULL, xmog_base *pStr=NULL, char **pCache=NULL)
 Returns a UTF-8 string for the given Java string.
static unsigned short * to_u16 (jstring _str, xmog_localenv *env=NULL)
 Returns a unsigned short string for the given Java string.
static void free (char *&str)
 Frees a previously allocated string.
static void free_u16 (unsigned short *&str)
 Frees a previously allocated string.

Static Public Attributes

static xmog_baseUS_ASCII
 The US-ASCII character set.
static xmog_baseISO_8859_1
 The ISO-8859-1 character set.
static xmog_baseUTF_8
 The UTF-8 character set.
static xmog_baseUTF_16BE
 The UTF-16BE character set.
static xmog_baseUTF_16LE
 The UTF-16LE character set.
static xmog_baseUTF_16
 The UTF-16 character set.

Detailed Description

A mixin or utility class for Java string features.

This class provides different variations of the same API to allow use from singlebyte and multibyte (UNICODE) clients. It also declares several static encoding instances that can be used to support the built-in encodings.


Member Function Documentation

static void xmog_java_string::free char *&  str  )  [static]
 

Frees a previously allocated string.

This method relies on the fact that the string that is to be freed was previously allocated using the framework's memory allocator.

Warning:
free Do not use this method on strings that were allocated using different methods.

static void xmog_java_string::free_u16 unsigned short *&  str  )  [static]
 

Frees a previously allocated string.

This method relies on the fact that the string that is to be freed was previously allocated using the framework's memory allocator.

Warning:
free Do not use this method on strings that were allocated using different methods.

static void xmog_java_string::from_char xmog_base _this,
xmog_flags  _flags,
const char *  _str,
jint  _len = -1,
xmog_base _enc = NULL,
xmog_localenv env = NULL,
xmog_base pStr = NULL,
char **  pCache = NULL
[static]
 

Returns a jstring for the given character string.

Parameters:
_this the instance into which the jstring instance is set.
_flags the bitflags containing the reference type.
_str the native string to convert to a jstring.
_len the optional length to use. If different from -1, specifies the number of characters to use. If -1, assume a zero-terminated string and calculate its length.
_enc the encoding to use. May be NULL, in which case the default encoding is used.
env the local calling context. May be NULL.
pStr the optional pointer to the proxy instance. May be NULL.
pCache the optional pointer to the caching pointer. May be NULL.
Returns:
a local reference to the created string.

static jstring xmog_java_string::from_char const char *  _str,
jint  _len = -1,
xmog_base _enc = NULL,
xmog_localenv env = NULL,
xmog_base pStr = NULL,
char **  pCache = NULL
[static]
 

Returns a jstring for the given character string.

Parameters:
_str the native string to convert to a jstring.
_len the optional length to use. If different from -1, specifies the number of characters to use. If -1, assume a zero-terminated string and calculate its length.
_enc the encoding to use. May be NULL, in which case the default encoding is used.
env the local calling context. May be NULL.
pStr the optional pointer to the proxy instance. May be NULL.
pCache the optional pointer to the caching pointer. May be NULL.
Returns:
a local reference to the created string.

static void xmog_java_string::from_charUtf8 xmog_base _this,
xmog_flags  _flags,
const char *  _strUTF,
xmog_localenv env = NULL
[static]
 

Returns a jstring for the given UTF-8 character string.

Parameters:
_this the instance into which the jstring instance is set.
_flags the bitflags containing the reference type.
_strUTF the UTF-8 string to convert to a jstring.
env the local calling context. May be NULL.
Returns:
a local reference to the created string.

static jstring xmog_java_string::from_charUtf8 const char *  _strUTF,
xmog_localenv env = NULL
[static]
 

Returns a jstring for the given UTF-8 character string.

Parameters:
_strUTF the UTF-8 string to convert to a jstring.
env the local calling context. May be NULL.
Returns:
a local reference to the created string.

static void xmog_java_string::init_encodings xmog_localenv env = NULL  )  [static]
 

Initializes the static instances.

This method is called internally by the xmog_java_string class and by the xmog_jvm class when the JVM is loaded.

static void xmog_java_string::set_default_encoding xmog_base _enc,
xmog_localenv env = NULL
[static]
 

Sets the default encoding that is used on the current thread.

An encoding is always thread-specific to support servers that have to run threads on behalf of more than one user.

Parameters:
_enc the default encoding to use on the current thread.
env the local calling context. May be NULL.

static void xmog_java_string::set_default_encoding const XMOG_WCHAR *  _enc,
xmog_localenv env = NULL
[static]
 

Sets the default encoding that is used on the current thread.

An encoding is always thread-specific to support servers that have to run threads on behalf of more than one user.

Parameters:
_enc the name of the default encoding to use on the current thread.
env the local calling context. May be NULL.

static void xmog_java_string::set_default_encoding const char *  _enc,
xmog_localenv env = NULL
[static]
 

Sets the default encoding that is used on the current thread.

An encoding is always thread-specific to support servers that have to run threads on behalf of more than one user.

Parameters:
_enc the name of the default encoding to use on the current thread.
env the local calling context. May be NULL.

static char* xmog_java_string::to_char jstring  _str,
xmog_base _enc = NULL,
xmog_localenv env = NULL,
xmog_base pStr = NULL,
char **  pCache = NULL
[static]
 

Returns a char string for the given Java string.

Parameters:
_str the Java string handle.
_enc the encoding used for the character extraction. May be NULL.
env the local calling context. May be NULL.
pStr the optional pointer to the proxy instance. May be NULL.
pCache the optional pointer to the caching pointer. May be NULL.
Returns:
a char string that was allocated using xmog_util::setString(char*&,const char*). It should be deallocated using xmog_util::setString( char*& , NULL );

static char* xmog_java_string::to_char jstring  _str,
xmog_localenv env = NULL,
xmog_base pStr = NULL,
char **  pCache = NULL
[static]
 

Returns a char string for the given Java string.

Parameters:
_str the Java string handle.
env the local calling context. May be NULL.
pStr the optional pointer to the proxy instance. May be NULL.
pCache the optional pointer to the caching pointer. May be NULL.
Returns:
a char string that was allocated using xmog_util::setString(char*&,const char*). It should be deallocated using xmog_util::setString( char*& , NULL );

static char* xmog_java_string::to_charUtf8 jstring  _str,
xmog_localenv env = NULL,
xmog_base pStr = NULL,
char **  pCache = NULL
[static]
 

Returns a UTF-8 string for the given Java string.

Parameters:
_str the Java string handle.
env the local calling context. May be NULL.
pStr the optional pointer to the proxy instance. May be NULL.
pCache the optional pointer to the caching pointer. May be NULL.
Returns:
a char string that was allocated using xmog_util::setString(char*&,const char*). It should be deallocated using xmog_util::setString( char*& , NULL );

static unsigned short* xmog_java_string::to_u16 jstring  _str,
xmog_localenv env = NULL
[static]
 

Returns a unsigned short string for the given Java string.

Parameters:
_str the Java string handle.
env the local calling context. May be NULL.
Returns:
a wchar_t string that was allocated using xmog_util::setString(wchar_t*&,const wchar_t*). It should be deallocated using xmog_util::setString( wchar_t*& , NULL );


The documentation for this class was generated from the following file:
Generated on Wed May 31 14:01:32 2006 for Shared Codemesh Runtime Library API Reference by  doxygen 1.4.1