scim::IConvert Class Reference
Accessories

A class to convert strings between UCS-4 and local encodings. More...

`#include <scim_iconv.h>`

## Public Member Functions

| IConvert (const String &encoding=String())
| Constructor.
| IConvert (const IConvert &iconvert)
| Copy constructor.
| ~IConvert ()
const IConvert & | operator= (const IConvert &iconvert)
| Assign operator.
bool | set_encoding (const String &encoding)
| Set the working local encoding.
String | get_encoding () const
| Get the current working local encoding.
bool | convert (String &dest, const WideString &src) const
| Convert a UCS-4 encoded WideString into a local encoded String.
bool | convert (String &dest, const ucs4_t *src, int src_len) const
| Convert a UCS-4 encoded WideString into a local encoded String.
bool | convert (WideString &dest, const String &src) const
| Convert a local encoded String into a UCS-4 encoded WideString.
bool | convert (WideString &dest, const char *src, int src_len) const
| Convert a local encoded String into a UCS-4 encoded WideString.
bool | test_convert (const WideString &src) const
| Test if a UCS-4 encoded WideString can be converted to a local encoded String.
bool | test_convert (const ucs4_t *src, int src_len) const
| Test if a ucs-4 encoded string can be converted to a local encoded String.
bool | test_convert (const String &src) const
| Test if a local encoded string can be converted to a UCS-4 encoded WideString.
bool | test_convert (const char *src, int src_len) const
| Test if a local encoded string can be converted to a UCS-4 encoded WideString.

## Detailed Description

A class to convert strings between UCS-4 and local encodings.

## Constructor & Destructor Documentation

## IConvert() [1/2]

scim::IConvert::IConvert | ( | const String & | encoding = String() | ) |

Constructor.

Parameters

  encoding | the local encoding to be used.

Referenced by IConvert(), and operator=().

## IConvert() [2/2]

scim::IConvert::IConvert | ( | const IConvert & | iconvert | ) |

Copy constructor.

References IConvert().

## ~IConvert()

scim::IConvert::~IConvert | ( |  | ) |

## Member Function Documentation

## operator=()

const IConvert & scim::IConvert::operator= | ( | const IConvert & | iconvert | ) |

Assign operator.

References IConvert().

## set_encoding()

bool scim::IConvert::set_encoding | ( | const String & | encoding | ) |

Set the working local encoding.

Parameters

  encoding | the local encoding to be used.

Returns
  whether the encoding is ok or not.

## get_encoding()

String scim::IConvert::get_encoding | ( |  | ) | const

Get the current working local encoding.

Returns
  The name of the local encoding, like "UTF-8", "GB2312" etc.

## convert() [1/4]

bool scim::IConvert::convert | ( | String & | dest,
|  | const WideString & | src ) const

Convert a UCS-4 encoded WideString into a local encoded String.

Parameters

  dest | the result string will be stored here.
  src | the WideString to be converted.

Returns
  true if success.

## convert() [2/4]

bool scim::IConvert::convert | ( | String & | dest,
|  | const ucs4_t * | src,
|  | int | src_len ) const

Convert a UCS-4 encoded WideString into a local encoded String.

Parameters

  dest | the result string will be stored here.
  src | the ucs-4 encoded string to be converted.
  src_len | the length of source string.

Returns
  true if success.

## convert() [3/4]

bool scim::IConvert::convert | ( | WideString & | dest,
|  | const String & | src ) const

Convert a local encoded String into a UCS-4 encoded WideString.

Parameters

  dest | the result string will be stored here.
  src | the local encoded string to be converted.

Returns
  ture if success.

## convert() [4/4]

bool scim::IConvert::convert | ( | WideString & | dest,
|  | const char * | src,
|  | int | src_len ) const

Convert a local encoded String into a UCS-4 encoded WideString.

Parameters

  dest | the result string will be stored here.
  src | the local encoded string to be converted.
  src_len | the length of source string.

Returns
  ture if success.

## test_convert() [1/4]

bool scim::IConvert::test_convert | ( | const WideString & | src | ) | const

Test if a UCS-4 encoded WideString can be converted to a local encoded String.

Parameters

  src | the ucs-4 encoded string to be test.

Returns
  true if it can be converted without any problem.

## test_convert() [2/4]

bool scim::IConvert::test_convert | ( | const ucs4_t * | src,
|  | int | src_len ) const

Test if a ucs-4 encoded string can be converted to a local encoded String.

Parameters

  src | the ucs-4 encoded string to be test.
  src_len | the length of source string.

Returns
  true if it can be converted without any problem.

## test_convert() [3/4]

bool scim::IConvert::test_convert | ( | const String & | src | ) | const

Test if a local encoded string can be converted to a UCS-4 encoded WideString.

Parameters

  src | the local encoded string to be test.

Returns
  true if it can be converted without any problem.

## test_convert() [4/4]

bool scim::IConvert::test_convert | ( | const char * | src,
|  | int | src_len ) const

Test if a local encoded string can be converted to a UCS-4 encoded WideString.

Parameters

  src | the local encoded string to be test.
  src_len | the length of source string.

Returns
  true if it can be converted without any problem.

The documentation for this class was generated from the following file:

- scim_iconv.h