cohtml::ITextTransformationManager

Implement this interface to support text transformations. The class is used when the text-transform proeperty is used. Most languages require Unicode support to implement casing and cohtml delegates this work to the embedder. OS-specific APIs in Win32, Mac OS X and cross-platform libraries like ICU can implement the required functionality. An instance must be optionally set in SystemSettings. More…

#include <TextTransformation.h>

Public Classes

Name
structTransformationResult

Public Types

Name
enum classCaseOperation { Uppercase, Lowercase, Capitalize}
The type of text transformation that is required Examples: Uppercase -> “my text” becomes “MY TEXT”, each character is uppercase Lowercase -> “My Text” becomes “my text”, each character is lowercase Capitalize -> “my text” becomes “My Text”, each first character of each word is uppercase.

Public Functions

Name
ITextTransformationManager()
virtual~ITextTransformationManager()
virtual boolCaseMapCharacters(CaseOperation operation, const char * utf8Text, unsigned bytesCount, char * transformed, unsigned transformedBytesCount) const
Called when a text needs casing transformations.
virtual boolCaseMapCharacters(CaseOperation operation, const char * utf8Text, unsigned bytesCount, TransformationResult * transformed) const
Called when a text needs casing transformations.

Detailed Description

class cohtml::ITextTransformationManager;

Implement this interface to support text transformations. The class is used when the text-transform proeperty is used. Most languages require Unicode support to implement casing and cohtml delegates this work to the embedder. OS-specific APIs in Win32, Mac OS X and cross-platform libraries like ICU can implement the required functionality. An instance must be optionally set in SystemSettings.

Warning: THIS CLASS MUST BE THREAD-SAFE as it WILL be called from different threads

Public Types Documentation

enum CaseOperation

EnumeratorValueDescription
Uppercase
Lowercase
Capitalize

The type of text transformation that is required Examples: Uppercase -> “my text” becomes “MY TEXT”, each character is uppercase Lowercase -> “My Text” becomes “my text”, each character is lowercase Capitalize -> “my text” becomes “My Text”, each first character of each word is uppercase.

Public Functions Documentation

function ITextTransformationManager

ITextTransformationManager()

function ~ITextTransformationManager

virtual ~ITextTransformationManager()

function CaseMapCharacters

inline virtual bool CaseMapCharacters(
    CaseOperation operation,
    const char * utf8Text,
    unsigned bytesCount,
    char * transformed,
    unsigned transformedBytesCount
) const

Called when a text needs casing transformations.

Parameters:

  • operation The operation required by the function
  • utf8Text The text in UTF-8 format to be case-transformed
  • bytesCount The length in bytes of the text to be transformed
  • transformed Output buffer where the changed text must be put - should be in UTF-8
  • transformedBytesCount The size in bytes of the output buffer. The size is very conservative and should accomodate the new string.

Return: Returns if the transformation was successfull.

function CaseMapCharacters

inline virtual bool CaseMapCharacters(
    CaseOperation operation,
    const char * utf8Text,
    unsigned bytesCount,
    TransformationResult * transformed
) const

Called when a text needs casing transformations.

Parameters:

  • operation The operation required by the function
  • utf8Text The text in UTF-8 format to be case-transformed
  • bytesCount The length in bytes of the text to be transformed
  • transformed TransformationResult to receive the transformed text The size is very conservative and should accomodate the new string.

Return: Returns if the transformation was successfull.