Xerces-C++ 3.2.4

Public Types | List of all members
XMLTranscoder Class Referenceabstract

`XMLTranscoder` is for transcoding non-local code page encodings, i.e. More...

`#include <xercesc/util/TransService.hpp>`

Inheritance diagram for XMLTranscoder:

## Public Types

enum | UnRepOpts { UnRep_Throw , UnRep_RepChar }
| This enum is used by the `transcodeTo()` method to indicate how to react to unrepresentable characters. More...

## Public Member Functions

Destructor.
virtual | ~XMLTranscoder ()
| Destructor for XMLTranscoder. More...
The virtual transcoding interface
virtual XMLSize_t | transcodeFrom (const XMLByte *const srcData, const XMLSize_t srcCount, XMLCh *const toFill, const XMLSize_t maxChars, XMLSize_t &bytesEaten, unsigned char *const charSizes)=0
| Converts from the encoding of the service to the internal XMLCh* encoding. More...
virtual XMLSize_t | transcodeTo (const XMLCh *const srcData, const XMLSize_t srcCount, XMLByte *const toFill, const XMLSize_t maxBytes, XMLSize_t &charsEaten, const UnRepOpts options)=0
| Converts from the internal XMLCh* encoding to the encoding of the service. More...
virtual bool | canTranscodeTo (const unsigned int toCheck)=0
| Query whether the transcoder can handle a given character. More...
Public Member Functions inherited from XMemory
void * | operator new (size_t size)
| This method overrides operator new. More...
void * | operator new (size_t size, MemoryManager *memMgr)
| This method defines a custom operator new, that will use the provided memory manager to perform the allocation. More...
void * | operator new (size_t size, void *ptr)
| This method overrides placement operator new. More...
void | operator delete (void *p)
| This method overrides operator delete. More...
void | operator delete (void *p, MemoryManager *memMgr)
| This method provides a matching delete for the custom operator new. More...
void | operator delete (void *p, void *ptr)
| This method provides a matching delete for the placement new. More...

## Getter methods

XMLSize_t | getBlockSize () const
| Get the internal block size. More...
const XMLCh * | getEncodingName () const
| Get the encoding name. More...
MemoryManager * | getMemoryManager () const
| Get the plugged-in memory manager. More...
| XMLTranscoder (const XMLCh *const encodingName, const XMLSize_t blockSize, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)

## Additional Inherited Members

Protected Member Functions inherited from XMemory
| XMemory ()
| Protected default constructor. More...

## Detailed Description

`XMLTranscoder` is for transcoding non-local code page encodings, i.e.

named encodings. These are used internally by the scanner to internalize raw XML into the internal Unicode format, and by writer classes to convert that internal Unicode format (which comes out of the parser) back out to a format that the receiving client code wants to use.

## Member Enumeration Documentation

## ◆ UnRepOpts

enum XMLTranscoder::UnRepOpts

This enum is used by the `transcodeTo()` method to indicate how to react to unrepresentable characters.

The `transcodeFrom()` method always works the same. It will consider any invalid data to be an error and throw.

Enumerator
UnRep_Throw | Throw an exception.
UnRep_RepChar | Use the replacement char.

## Constructor & Destructor Documentation

## ◆ ~XMLTranscoder()

virtual XMLTranscoder::~XMLTranscoder | ( |  | ) |

virtual

Destructor for XMLTranscoder.

## ◆ XMLTranscoder()

XMLTranscoder::XMLTranscoder | ( | const XMLCh *const | encodingName,
|  | const XMLSize_t | blockSize,
|  | MemoryManager *const | manager = `XMLPlatformUtils::fgMemoryManager`
| ) |  |

protected

## Member Function Documentation

## ◆ canTranscodeTo()

virtual bool XMLTranscoder::canTranscodeTo | ( | const unsigned int | toCheck | ) |

pure virtual

Query whether the transcoder can handle a given character.

Parameters

  toCheck | the character code point to check

## ◆ getBlockSize()

XMLSize_t XMLTranscoder::getBlockSize | ( |  | ) | const

Get the internal block size.

Returns
  The block size indicated in the constructor.

## ◆ getEncodingName()

const XMLCh * XMLTranscoder::getEncodingName | ( |  | ) | const

Get the encoding name.

Returns
  the name of the encoding that this `XMLTranscoder` object is for

## ◆ getMemoryManager()

MemoryManager * XMLTranscoder::getMemoryManager | ( |  | ) | const

Get the plugged-in memory manager.

This method returns the plugged-in memory manager user for dynamic memory allocation/deallocation.

Returns
  the plugged-in memory manager

## ◆ transcodeFrom()

virtual XMLSize_t XMLTranscoder::transcodeFrom | ( | const XMLByte *const | srcData,
|  | const XMLSize_t | srcCount,
|  | XMLCh *const | toFill,
|  | const XMLSize_t | maxChars,
|  | XMLSize_t & | bytesEaten,
|  | unsigned char *const | charSizes
| ) |  |

pure virtual

Converts from the encoding of the service to the internal XMLCh* encoding.

Parameters

  srcData | the source buffer to be transcoded
  srcCount | number of bytes in the source buffer
  toFill | the destination buffer
  maxChars | the max number of characters in the destination buffer
  bytesEaten | after transcoding, this will hold the number of bytes that were processed from the source buffer
  charSizes | an array which must be at least as big as maxChars into which will be inserted values that indicate how many bytes from the input went into each XMLCh that was created into toFill. Since many encodings use variable numbers of byte per character, this provides a means to find out what bytes in the input went into making a particular output UTF-16 character.

Returns
  Returns the number of chars put into the target buffer

## ◆ transcodeTo()

virtual XMLSize_t XMLTranscoder::transcodeTo | ( | const XMLCh *const | srcData,
|  | const XMLSize_t | srcCount,
|  | XMLByte *const | toFill,
|  | const XMLSize_t | maxBytes,
|  | XMLSize_t & | charsEaten,
|  | const UnRepOpts | options
| ) |  |

pure virtual

Converts from the internal XMLCh* encoding to the encoding of the service.

Parameters

  srcData | the source buffer to be transcoded
  srcCount | number of characters in the source buffer
  toFill | the destination buffer
  maxBytes | the max number of bytes in the destination buffer
  charsEaten | after transcoding, this will hold the number of chars that were processed from the source buffer
  options | options to pass to the transcoder that explain how to respond to an unrepresentable character

Returns
  Returns the number of chars put into the target buffer

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

- TransService.hpp