Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

nglStringConv Class Reference

#include <nglStringConv.h>

Inheritance diagram for nglStringConv:

nglError List of all members.

Detailed Description

String conversion processor.

To convert from a given encoding to another one, you have to setup a nglStringConv object. You can then process any chunk of text data with multiple calls to Process(). Note that converting is not a trivial job and many errors can arise. See Process() documentation for more info.

Most of the time, you will just want to important a text using a foreign locale into a nglString object, or the opposite, export into a foreign locale from a nglString object. The nglString::Import() and nglString::Export() methods will provide you an easy and convenient way to do this.


Public Member Functions

 nglStringConv (nglTextEncoding From, nglTextEncoding To, nglChar Default=nglStringConv::mUnknown)
virtual ~nglStringConv ()
int Process (const char *&pSource, int &rToRead, char *&pTarget, int &rToWrite)

Static Public Attributes

static nglChar mUnknown


Constructor & Destructor Documentation

nglStringConv::nglStringConv nglTextEncoding  From,
nglTextEncoding  To,
nglChar  Default = nglStringConv::mUnknown
 

Create a conversion context

Parameters:
From source encoding
To target encoding
Default char to display in place of invalid or unconvertible input sequences. If set to '\0', do not display a default char.

virtual nglStringConv::~nglStringConv  )  [virtual]
 


Member Function Documentation

int nglStringConv::Process const char *&  pSource,
int &  rToRead,
char *&  pTarget,
int &  rToWrite
 

Process with conversion

Parameters:
pSource source buffer
rToRead number of bytes to read from source buffer
pTarget target buffer
rToWrite maximum number of bytes to write to target buffer
Returns:
number of input errors encountered
Proceed conversion from pSource to pTarget. Both rToRead and rToWrite values are updated to reflect respectively the number of bytes left to read and the number of bytes that can be still written. Any conversion error (either an illegal input sequence or an inconvertible sequence) is replaced with the default char passed to the constructor. You must check GetError() after this call to resolve the different issues that may arise.


Member Data Documentation

nglChar nglStringConv::mUnknown [static]
 

Default char used to mark in place a conversion error. Unused if set to '\0'.


Generated on Thu Feb 3 22:26:10 2005 for NGL by  doxygen 1.4.1