ost::BayonneTranslator Class Reference

A core class to support language translation services in Bayonne phrasebook.Phrasebook translation base class. More...

#include <bayonne.h>

Inheritance diagram for ost::BayonneTranslator:

ost::Bayonne List of all members.

Public Member Functions

 BayonneTranslator (const char *id)
 Create a translator instance for a specific language identifier.
BayonneTranslatorgetNext ()
 Get next translator.
virtual unsigned digits (BayonneSession *s, unsigned count, const char *cp)
 Translate a simple set of digits to spoken speech.
virtual unsigned spell (BayonneSession *s, unsigned count, const char *cp)
 Spell out the string as individual letters.
virtual unsigned sayorder (BayonneSession *s, unsigned count, const char *cp)
 Translate an ordinal number (xxnth) to prompts.
virtual unsigned number (BayonneSession *s, unsigned count, const char *cp)
 Translate a number to spoken speech.
virtual unsigned saynumber (BayonneSession *s, unsigned count, const char *cp)
 Translate generic numbers to spoken speech.
virtual unsigned saycount (BayonneSession *s, unsigned count, const char *cp)
 Translate a counting number (integer) to spoken speech.
virtual unsigned saytime (BayonneSession *s, unsigned count, const char *cp)
 Translate a string for time into speech.
virtual unsigned weekday (BayonneSession *s, unsigned count, const char *cp)
 Translate a string with a date into the spoken weekday.
virtual unsigned saydate (BayonneSession *s, unsigned count, const char *cp)
 Translate a string with a date into a spoken date.
virtual unsigned saybool (BayonneSession *s, unsigned count, const char *cp)
 Translate a logical value and speak as yes/no.
virtual unsigned phone (BayonneSession *s, unsigned count, const char *cp)
 Translate and speak a phone number.
virtual unsigned extension (BayonneSession *s, unsigned count, const char *cp)
 Translate and speak a phone extension.
virtual const char * speak (BayonneSession *session, Line *line=NULL)
 Translation dispatch, processes script and invokes other methods.
const char * getId (void)
 Get the id string.

Static Public Member Functions

static BayonneTranslatorget (const char *name)
 Find a translator for a given name/location.
static BayonneTranslatorgetFirst (void)
 Get first translator.
static BayonneTranslatorloadTranslator (const char *name)
 Load a named translator into memory for use.

Static Protected Member Functions

static const char * getToken (BayonneSession *s, Line *l, unsigned *idx)
static unsigned addItem (BayonneSession *s, unsigned count, const char *text)
static const char * getLast (BayonneSession *s, unsigned count)

Protected Attributes

BayonneTranslatornext
const char * id

Static Protected Attributes

static BayonneTranslatorfirst

Detailed Description

A core class to support language translation services in Bayonne phrasebook.Phrasebook translation base class.

Author:
David Sugar <dyfet@gnutelephony.org>


Constructor & Destructor Documentation

ost::BayonneTranslator::BayonneTranslator const char *  id  ) 
 

Create a translator instance for a specific language identifier.

Generally iso names will be sued. Sometimes iso sub-identifiers may be used for nation specific versions of phrasebook.

Parameters:
iso name of language/locale.


Member Function Documentation

static unsigned ost::BayonneTranslator::addItem BayonneSession s,
unsigned  count,
const char *  text
[static, protected]
 

virtual unsigned ost::BayonneTranslator::digits BayonneSession s,
unsigned  count,
const char *  cp
[virtual]
 

Translate a simple set of digits to spoken speech.

Parameters:
timeslot session to save list of prompts.
current count of prompts used.
string to be processed.
Returns:
new count of prompts used.

virtual unsigned ost::BayonneTranslator::extension BayonneSession s,
unsigned  count,
const char *  cp
[virtual]
 

Translate and speak a phone extension.

Parameters:
timeslot session to save list of prompts.
current count of prompts used.
string to be processed.
Returns:
new count of prompts used.

static BayonneTranslator* ost::BayonneTranslator::get const char *  name  )  [static]
 

Find a translator for a given name/location.

Parameters:
iso language/locale name of translator to find.
Returns:
derived translator class for translator.

static BayonneTranslator* ost::BayonneTranslator::getFirst void   )  [inline, static]
 

Get first translator.

Returns:
pointer to first translator.

const char* ost::BayonneTranslator::getId void   )  [inline]
 

Get the id string.

Returns:
id string.

static const char* ost::BayonneTranslator::getLast BayonneSession s,
unsigned  count
[static, protected]
 

BayonneTranslator* ost::BayonneTranslator::getNext  )  [inline]
 

Get next translator.

Returns:
next translator.

static const char* ost::BayonneTranslator::getToken BayonneSession s,
Line *  l,
unsigned *  idx
[static, protected]
 

static BayonneTranslator* ost::BayonneTranslator::loadTranslator const char *  name  )  [static]
 

Load a named translator into memory for use.

This is used by the fifo/script language command.

Parameters:
iso module name to load.
Returns:
true if successful.

virtual unsigned ost::BayonneTranslator::number BayonneSession s,
unsigned  count,
const char *  cp
[virtual]
 

Translate a number to spoken speech.

Parameters:
timeslot session to save list of prompts.
current count of prompts used.
string to be processed.
Returns:
new count of prompts used.

virtual unsigned ost::BayonneTranslator::phone BayonneSession s,
unsigned  count,
const char *  cp
[virtual]
 

Translate and speak a phone number.

Parameters:
timeslot session to save list of prompts.
current count of prompts used.
string to be processed.
Returns:
new count of prompts used.

virtual unsigned ost::BayonneTranslator::saybool BayonneSession s,
unsigned  count,
const char *  cp
[virtual]
 

Translate a logical value and speak as yes/no.

Parameters:
timeslot session to save list of prompts.
current count of prompts used.
string to be processed.
Returns:
new count of prompts used.

virtual unsigned ost::BayonneTranslator::saycount BayonneSession s,
unsigned  count,
const char *  cp
[virtual]
 

Translate a counting number (integer) to spoken speech.

Parameters:
timeslot session to save list of prompts.
current count of prompts used.
string to be processed.
Returns:
new count of prompts used.

virtual unsigned ost::BayonneTranslator::saydate BayonneSession s,
unsigned  count,
const char *  cp
[virtual]
 

Translate a string with a date into a spoken date.

Parameters:
timeslot session to save list of prompts.
current count of prompts used.
string to be processed.
Returns:
new count of prompts used.

virtual unsigned ost::BayonneTranslator::saynumber BayonneSession s,
unsigned  count,
const char *  cp
[virtual]
 

Translate generic numbers to spoken speech.

This is the one used by the &number rule.

Parameters:
timeslot session to save list of prompts.
current count of prompts used.
string to be processed.
Returns:
new count of prompts used.

virtual unsigned ost::BayonneTranslator::sayorder BayonneSession s,
unsigned  count,
const char *  cp
[virtual]
 

Translate an ordinal number (xxnth) to prompts.

Parameters:
timeslot session to save list of prompts.
current count of prompts used.
string to be processed.
Returns:
new count of prompts used.

virtual unsigned ost::BayonneTranslator::saytime BayonneSession s,
unsigned  count,
const char *  cp
[virtual]
 

Translate a string for time into speech.

Parameters:
timeslot session to save list of prompts.
current count of prompts used.
string to be processed.
Returns:
new count of prompts used.

virtual const char* ost::BayonneTranslator::speak BayonneSession session,
Line *  line = NULL
[virtual]
 

Translation dispatch, processes script and invokes other methods.

Returns:
error message or NULL if okay
Parameters:
timeslot session to process a command from.

virtual unsigned ost::BayonneTranslator::spell BayonneSession s,
unsigned  count,
const char *  cp
[virtual]
 

Spell out the string as individual letters.

Parameters:
timeslot session to save list of prompts.
current count of prompts used.
string to be processed.
Returns:
new count of prompts used.

virtual unsigned ost::BayonneTranslator::weekday BayonneSession s,
unsigned  count,
const char *  cp
[virtual]
 

Translate a string with a date into the spoken weekday.

Parameters:
timeslot session to save list of prompts.
current count of prompts used.
string to be processed.
Returns:
new count of prompts used.


Member Data Documentation

BayonneTranslator* ost::BayonneTranslator::first [static, protected]
 

const char* ost::BayonneTranslator::id [protected]
 

BayonneTranslator* ost::BayonneTranslator::next [protected]
 


The documentation for this class was generated from the following file:
Generated on Tue May 2 13:21:09 2006 for Bayonne by  doxygen 1.4.6