ULAPI
8.0
|
The abstract parent of the classes that translate numbers in ULAPI's supported languages. More...
#include <ulnumbertranslator.h>
Public Member Functions | |
ULNumberTranslator () | |
ULNumberTranslator (const ULNumberTranslator &other) | |
virtual | ~ULNumberTranslator () |
virtual bool | isServiceAvailable (const ULServiceDescriptor &service)=0 |
virtual void | getAvailableServices (ULList< ULServiceDescriptor > &services)=0 |
virtual ULError | translateNumber (const ULString &digits, ULString &result)=0 |
Public Member Functions inherited from ULWorker | |
ULWorker () | |
virtual | ~ULWorker () |
virtual void | setCancelOperation (bool shouldCancel) |
virtual bool | shouldCancelOperation () const |
Static Public Member Functions | |
static ULNumberTranslator * | createNumberTranslator (const ULLanguage &language) |
Static Protected Member Functions | |
static bool | getPrimitiveNumberText (int n, const ULPrimitiveNumber *primitives, ULString &text) |
The abstract parent of the classes that translate numbers in ULAPI's supported languages.
ULNumberTranslator::ULNumberTranslator | ( | ) |
Default constructor.
ULNumberTranslator::ULNumberTranslator | ( | const ULNumberTranslator & | other | ) |
Copy constructor.
|
virtual |
Destructor.
|
static |
Static method that instantiates and initializes an object of the subclass appropriate for the specified language.
|
pure virtual |
|
staticprotected |
Private method used to extract the text for an integer from a list of (integer, text) ordered pairs. If the specified integer is not the first component of any of the pairs in the numberNames array, then name is set to the empty string. In general, the numberNames array will consist of the primitive number words from which the number translation algorithm constructs all numbers. Your algorithm can, for example, build "forty-three" from the parts "forty" and "three", but those primitive mappings (40, "forty") and (3, "three") just have to be stored in a table. This method extracts those words from such a table.
[in] | n | The integer to be converted into words. |
[in] | primitives | An array of ULPrimitiveNumber objects mapping integers to text. |
[out] | text | The text for the specified integer, or the empty string of the integer is not found in the primitives array. |
|
pure virtual |
|
pure virtual |
Computes the textual translation of a number. For example, if the given digit string is "123" and the language supported by this ULNumberTranslator object is English, then the result will be "one hundred (and) twenty-three".
[in] | digits | The string of digits to be translated. |
[out] | result | The translation. |