40 #ifndef _LETTERALPHABET_ 41 #define _LETTERALPHABET_ 80 #ifndef NO_VIRTUAL_COV 95 throw BadCharException(state,
"LetterAlphabet::charToInt: Unknown state",
this);
96 return letters_[
static_cast<unsigned int>(state[0])];
103 letters_[
static_cast<unsigned int>(st->getLetter()[0])] = st->getNum();
105 letters_[
static_cast<unsigned int>(tolower(st->getLetter()[0]))] = st->getNum();
106 letters_[
static_cast<unsigned int>(toupper(st->getLetter()[0]))] = st->getNum();
113 letters_[
static_cast<unsigned int>(st->getLetter()[0])] = st->getNum();
115 letters_[
static_cast<unsigned int>(tolower(st->getLetter()[0]))] = st->getNum();
116 letters_[
static_cast<unsigned int>(toupper(st->getLetter()[0]))] = st->getNum();
123 #endif // _LETTERALPHABET_ LetterAlphabet & operator=(const LetterAlphabet &bia)
This is the base class to describe states in an Alphabet.
An alphabet exception thrown when trying to specify a bad char to the alphabet.
LetterAlphabet(const LetterAlphabet &bia)
std::vector< int > letters_
This alphabet is used to deal NumericAlphabet.
virtual LetterAlphabet * clone() const =0
AbstractAlphabet & operator=(const AbstractAlphabet &alph)
Specialized partial implementation of Alphabet using single letters.
bool isCharInAlphabet(char state) const
void registerState(AlphabetState *st)
Add a state to the Alphabet.
static const int LETTER_UNDEF_VALUE
virtual void setState(size_t pos, AlphabetState *st)
Set a state in the Alphabet.
void setState(size_t pos, AlphabetState *st)
Set a state in the Alphabet.
A partial implementation of the Alphabet interface.
virtual ~LetterAlphabet()
LetterAlphabet(bool caseSensitive=false)
virtual void registerState(AlphabetState *st)
Add a state to the Alphabet.
bool isCharInAlphabet(const std::string &state) const
Tell if a state (specified by its string description) is allowed by the the alphabet.
int charToInt(const std::string &state) const
Give the int description of a state given its string description.