CVocTrainer Class Reference

Vocabulary Trainer class. More...

#include <voctrainer.H>

List of all members.

Public Member Functions

 CVocTrainer (CVocPrinter *pvpPrinter)
 Constructor.
 ~CVocTrainer ()
 Default destructor.
int Init (char **files, const int &nNumFiles, const bool &bSynonym, const enVocLang &enLang)
 Initialization function.
void Learn (const enVocMode &enMode, const enVocLang &enLang, const int &nNumPasses, const bool &bDebugMode, const bool &bStackMode, const bool &bCaseMode, const bool &bBeep)
 Learning function.

Private Member Functions

bool compareStrings (std::string str1, std::string str2, const bool &casemode)
 Helper function.
bool checkWord (const std::string &word, const std::vector< std::string > &words, const bool &casemode)
 Helper function.
void sortVocabulary (const enVocLang &enLang)
 Helper function This function sorts the vocabulary alphabetically.

Static Private Member Functions

static bool compareLeftLanguage (const SWord &word1, const SWord &word2)
 Static helper function.
static bool compareRightLanguage (const SWord &word1, const SWord &word2)
 Static helper function.

Private Attributes

std::vector< SWordm_vocabulary
 vector with the hole vocabulary
CVocPrinterm_pvpPrinter
 pointer to printer class

Detailed Description

Vocabulary Trainer class.

This class provides the training process. It starts the learning process and checks the user-input.


Constructor & Destructor Documentation

CVocTrainer::CVocTrainer ( CVocPrinter pvpPrinter  ) 

Constructor.

Parameters:
pvpPrinter Pointer to CVocPrinter class which will be used to write strings

Member Function Documentation

bool CVocTrainer::checkWord ( const std::string &  word,
const std::vector< std::string > &  words,
const bool &  casemode 
) [private]

Helper function.

This function checks if the word is in the vector words.

Parameters:
word word to check
words vector with words
casemode case-sensitive setting
Returns:
This function returns true, if the word is in the vector; otherwise false.
See also:
compareStrings()

References compareStrings().

Referenced by Learn().

bool CVocTrainer::compareLeftLanguage ( const SWord word1,
const SWord word2 
) [static, private]

Static helper function.

This function compares two words from the left language.

Parameters:
word1 first word
word2 second word
Returns:
This function returns false, if word1.lang1[0] is less than word2.lang1[0]; otherwise true.
See also:
sortVocabulary()

References SWord::lang1.

Referenced by sortVocabulary().

bool CVocTrainer::compareRightLanguage ( const SWord word1,
const SWord word2 
) [static, private]

Static helper function.

This function compare two words from the right language.

Parameters:
word1 first word
word2 second word
Returns:
This function returns false, if word1.lang2[0] is less than word2.lang2[0]; otherwise true.
See also:
sortVocabulary()

References SWord::lang2.

Referenced by sortVocabulary().

bool CVocTrainer::compareStrings ( std::string  str1,
std::string  str2,
const bool &  casemode 
) [private]

Helper function.

This function compares two strings case-sensitively or case-insensitively.

Parameters:
str1 string one
str2 string two
casemode case-sensitive setting
Returns:
This function returns true, if the strings are equal; otherwise false.

Referenced by checkWord().

int CVocTrainer::Init ( char **  files,
const int &  nNumFiles,
const bool &  bSynonym,
const enVocLang &  enLang 
)

Initialization function.

This function initializes the m_vocabulary vector with the help of CVocFile.

Parameters:
files null-terminated file string array
nNumFiles number of files
bSynonym synonym mode
enLang inquiry language
Returns:
This function returns -1 if successful; otherwise a exit code.
See also:
CVocFile
m_vocabulary

References CVocFile::AppendVocabulary(), CVocatraInfo::GetName(), and m_vocabulary.

void CVocTrainer::Learn ( const enVocMode &  enMode,
const enVocLang &  enLang,
const int &  nNumPasses,
const bool &  bDebugMode,
const bool &  bStackMode,
const bool &  bCaseMode,
const bool &  bBeep 
)

Learning function.

This function starts the learning process and queries the user with the help of CVocAdmin.

Parameters:
enMode inquiry mode
enLang inquiry language
nNumPasses number of passes
bDebugMode debug mode setting
bStackMode stack mode setting
bCaseMode case-sensitive mode setting
bBeep enable beep sound
See also:
CVocAdmin

References checkWord(), m_pvpPrinter, m_vocabulary, CVocPrinter::PrintCorrectString(), CVocPrinter::PrintEndString(), CVocPrinter::PrintStartString(), CVocPrinter::PrintWords(), CVocPrinter::PrintWrongString(), and sortVocabulary().

void CVocTrainer::sortVocabulary ( const enVocLang &  enLang  )  [private]

Helper function This function sorts the vocabulary alphabetically.

Parameters:
enLang If enLang is vlRight the right language will be sorted; otherwise the left one.

References compareLeftLanguage(), compareRightLanguage(), and m_vocabulary.

Referenced by Learn().


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

Get Vocatra at SourceForge.net. Fast, secure and Free Open Source software downloads Generated for Vocatra by doxygen