ost::BayonneTranslator Class Reference

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

#include <bayonne.h>

Inheritance diagram for ost::BayonneTranslator:

ost::Bayonne

List of all members.

Public Member Functions

 BayonneTranslator (const char *iso)
 Create a translator instance for a specific language identifier.
virtual ~BayonneTranslator ()
BayonneTranslatorgetNext ()
 Get next translator.
virtual unsigned digits (BayonneSession *sessiob, unsigned count, const char *string)
 Translate a simple set of digits to spoken speech.
virtual unsigned spell (BayonneSession *session, unsigned count, const char *string)
 Spell out the string as individual letters.
virtual unsigned sayorder (BayonneSession *session, unsigned count, const char *string)
 Translate an ordinal number (xxnth) to prompts.
virtual unsigned number (BayonneSession *session, unsigned count, const char *string)
 Translate a number to spoken speech.
virtual unsigned saynumber (BayonneSession *session, unsigned count, const char *string)
 Translate generic numbers to spoken speech.
virtual unsigned saycount (BayonneSession *session, unsigned count, const char *string)
 Translate a counting number (integer) to spoken speech.
virtual unsigned sayhour (BayonneSession *session, unsigned count, const char *string)
 Translate a string for time into short hours.
virtual unsigned saytime (BayonneSession *session, unsigned count, const char *string)
 Translate a string for time into speech.
virtual unsigned weekday (BayonneSession *session, unsigned count, const char *string)
 Translate a string with a date into the spoken weekday.
virtual unsigned sayday (BayonneSession *session, unsigned count, const char *string)
virtual unsigned saydate (BayonneSession *session, unsigned count, const char *string)
 Translate a string with a date into a spoken date.
virtual unsigned saybool (BayonneSession *session, unsigned count, const char *string)
 Translate a logical value and speak as yes/no.
virtual unsigned phone (BayonneSession *session, unsigned count, const char *string)
 Translate and speak a phone number.
virtual unsigned extension (BayonneSession *session, unsigned count, const char *string)
 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 *iso)
 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.

Author:
David Sugar <dyfet@gnutelephony.org> Phrasebook translation base class.

Constructor & Destructor Documentation

ost::BayonneTranslator::BayonneTranslator ( const char *  iso  ) 

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.

virtual ost::BayonneTranslator::~BayonneTranslator (  )  [virtual]


Member Function Documentation

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

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

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

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.

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

Get next translator.

Returns:
next translator.

static BayonneTranslator* ost::BayonneTranslator::loadTranslator ( const char *  iso  )  [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::digits ( BayonneSession sessiob,
unsigned  count,
const char *  string 
) [virtual]

Translate a simple set of digits to spoken speech.

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

virtual unsigned ost::BayonneTranslator::spell ( BayonneSession session,
unsigned  count,
const char *  string 
) [virtual]

Spell out the string as individual letters.

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

virtual unsigned ost::BayonneTranslator::sayorder ( BayonneSession session,
unsigned  count,
const char *  string 
) [virtual]

Translate an ordinal number (xxnth) to prompts.

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

virtual unsigned ost::BayonneTranslator::number ( BayonneSession session,
unsigned  count,
const char *  string 
) [virtual]

Translate a number to spoken speech.

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

virtual unsigned ost::BayonneTranslator::saynumber ( BayonneSession session,
unsigned  count,
const char *  string 
) [virtual]

Translate generic numbers to spoken speech.

This is the one used by the &number rule.

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

virtual unsigned ost::BayonneTranslator::saycount ( BayonneSession session,
unsigned  count,
const char *  string 
) [virtual]

Translate a counting number (integer) to spoken speech.

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

virtual unsigned ost::BayonneTranslator::sayhour ( BayonneSession session,
unsigned  count,
const char *  string 
) [virtual]

Translate a string for time into short hours.

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

virtual unsigned ost::BayonneTranslator::saytime ( BayonneSession session,
unsigned  count,
const char *  string 
) [virtual]

Translate a string for time into speech.

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

virtual unsigned ost::BayonneTranslator::weekday ( BayonneSession session,
unsigned  count,
const char *  string 
) [virtual]

Translate a string with a date into the spoken weekday.

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

virtual unsigned ost::BayonneTranslator::sayday ( BayonneSession session,
unsigned  count,
const char *  string 
) [virtual]

virtual unsigned ost::BayonneTranslator::saydate ( BayonneSession session,
unsigned  count,
const char *  string 
) [virtual]

Translate a string with a date into a spoken date.

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

virtual unsigned ost::BayonneTranslator::saybool ( BayonneSession session,
unsigned  count,
const char *  string 
) [virtual]

Translate a logical value and speak as yes/no.

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

virtual unsigned ost::BayonneTranslator::phone ( BayonneSession session,
unsigned  count,
const char *  string 
) [virtual]

Translate and speak a phone number.

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

virtual unsigned ost::BayonneTranslator::extension ( BayonneSession session,
unsigned  count,
const char *  string 
) [virtual]

Translate and speak a phone extension.

Parameters:
session to save list of prompts.
count of current 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:
session to process a command from.
line of compiled script to process.

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

Get the id string.

Returns:
id string.


Member Data Documentation

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


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

Generated on Sat Aug 2 01:04:49 2008 for Bayonne by  doxygen 1.5.6