The ExerciseValidator class provides methods for exercise validation to QML code.
More...
#include "framework/validator/internal/ExerciseValidator.h"
|
QList< MistakeRecord > | compareLists (QList< QVariant > source, QList< QVariant > target, QVector< CharacterRecord > *recordedCharacters=nullptr, int *hits=nullptr, int *inputPos=nullptr) |
|
QList< MistakeRecord > | compareStrings (QString source, QString target, QVector< CharacterRecord > *recordedCharacters=nullptr, int *hits=nullptr, int *inputPos=nullptr) |
|
QMap< int, MistakeRecord > | generateDiffList (QStringList *sourceWords, QStringList *targetWords, QList< int > *mergeList=nullptr) |
|
QList< MistakeRecord > | findMistakes (QString exerciseText, QString input, QVector< CharacterRecord > recordedCharacters, int *totalHits=nullptr, QStringList *errorWords=nullptr) |
|
QList< MistakeRecord > | validateExercise (QString exerciseText, QString inputText, QVector< CharacterRecord > recordedCharacters, int *totalHits, int *mistakeCount, QStringList *errorWords=nullptr, bool timed=false, int timeSecs=0) |
|
QString | addMistakes (QString exerciseText, QList< MistakeRecord * > recordedMistakes) |
|
QStringList | splitWordsByPunct (QStringList source) |
|
|
QString | m_exerciseText |
|
QString | m_inputText |
|
QList< MistakeRecord > | m_mistakes |
|
QList< CharacterRecord > | m_characters |
|
bool | m_timed = false |
|
qreal | m_time = 0 |
|
int | m_grossHits = 0 |
|
int | m_mistakeCount = 0 |
|
QStringList | m_errorWords |
|
QString | m_generatedInputText |
|
QString | m_generatedMistakeText |
|
|
void | validated () |
|
void | exerciseTextChanged () |
|
void | inputTextChanged () |
|
void | mistakesChanged () |
|
void | charactersChanged () |
|
void | timedChanged () |
|
void | timeChanged () |
|
The ExerciseValidator class provides methods for exercise validation to QML code.
◆ addCharacter()
◆ addMistake()
◆ addMistakes()
QString ExerciseValidator::addMistakes |
( |
QString |
exerciseText, |
|
|
QList< MistakeRecord * > |
recordedMistakes |
|
) |
| |
|
private |
Adds mistakes to an exercise with mistake correction enabled.
◆ characters()
◆ clearCharacters()
void ExerciseValidator::clearCharacters |
( |
void |
| ) |
|
|
overridevirtual |
◆ clearMistakes()
void ExerciseValidator::clearMistakes |
( |
void |
| ) |
|
|
overridevirtual |
◆ compareLists()
QList< MistakeRecord > ExerciseValidator::compareLists |
( |
QList< QVariant > |
source, |
|
|
QList< QVariant > |
target, |
|
|
QVector< CharacterRecord > * |
recordedCharacters = nullptr , |
|
|
int * |
hits = nullptr , |
|
|
int * |
inputPos = nullptr |
|
) |
| |
|
private |
Compares 2 lists using longest common subsequence.
◆ compareStrings()
QList< MistakeRecord > ExerciseValidator::compareStrings |
( |
QString |
source, |
|
|
QString |
target, |
|
|
QVector< CharacterRecord > * |
recordedCharacters = nullptr , |
|
|
int * |
hits = nullptr , |
|
|
int * |
inputPos = nullptr |
|
) |
| |
|
private |
Compares 2 strings using longest common subsequence.
◆ errorWords()
QStringList ExerciseValidator::errorWords |
( |
void |
| ) |
|
|
overridevirtual |
◆ exerciseText()
QString ExerciseValidator::exerciseText |
( |
void |
| ) |
|
|
overridevirtual |
◆ findMistakes()
QList< MistakeRecord > ExerciseValidator::findMistakes |
( |
QString |
exerciseText, |
|
|
QString |
input, |
|
|
QVector< CharacterRecord > |
recordedCharacters, |
|
|
int * |
totalHits = nullptr , |
|
|
QStringList * |
errorWords = nullptr |
|
) |
| |
|
private |
Compares input text with exercise text and finds mistakes.
◆ generateDiffList()
QMap< int, MistakeRecord > ExerciseValidator::generateDiffList |
( |
QStringList * |
sourceWords, |
|
|
QStringList * |
targetWords, |
|
|
QList< int > * |
mergeList = nullptr |
|
) |
| |
|
private |
Recursively generates a diff list from source and target word list.
◆ generatedInputText()
QString ExerciseValidator::generatedInputText |
( |
void |
| ) |
|
|
overridevirtual |
◆ generatedMistakeText()
QString ExerciseValidator::generatedMistakeText |
( |
void |
| ) |
|
|
overridevirtual |
◆ generateMistakeText()
void ExerciseValidator::generateMistakeText |
( |
bool |
correctMistakes | ) |
|
|
overridevirtual |
◆ grossHits()
int ExerciseValidator::grossHits |
( |
void |
| ) |
|
|
overridevirtual |
◆ inputText()
QString ExerciseValidator::inputText |
( |
void |
| ) |
|
|
overridevirtual |
◆ mistakeCount()
int ExerciseValidator::mistakeCount |
( |
void |
| ) |
|
|
overridevirtual |
◆ mistakes()
◆ setCharacters()
void ExerciseValidator::setCharacters |
( |
QList< CharacterRecord > |
characterList | ) |
|
|
overridevirtual |
◆ setExerciseText()
void ExerciseValidator::setExerciseText |
( |
QString |
text | ) |
|
|
overridevirtual |
◆ setInputText()
void ExerciseValidator::setInputText |
( |
QString |
text | ) |
|
|
overridevirtual |
◆ setMistakes()
void ExerciseValidator::setMistakes |
( |
QList< MistakeRecord > |
mistakeList | ) |
|
|
overridevirtual |
◆ setTime()
void ExerciseValidator::setTime |
( |
qreal |
seconds | ) |
|
|
overridevirtual |
◆ setTimed()
void ExerciseValidator::setTimed |
( |
bool |
value | ) |
|
|
overridevirtual |
◆ splitWordsByPunct()
QStringList ExerciseValidator::splitWordsByPunct |
( |
QStringList |
source | ) |
|
|
private |
Splits each word by punctuation marks.
◆ textWithMistakes()
QString ExerciseValidator::textWithMistakes |
( |
void |
| ) |
|
|
overridevirtual |
◆ time()
qreal ExerciseValidator::time |
( |
void |
| ) |
|
|
overridevirtual |
◆ timed()
bool ExerciseValidator::timed |
( |
void |
| ) |
|
|
overridevirtual |
◆ validate() [1/2]
void ExerciseValidator::validate |
( |
int |
grossHits, |
|
|
QStringList |
errorWords |
|
) |
| |
|
overridevirtual |
Sets a custom result without actually validating the exercise.
Implements IExerciseValidator.
◆ validate() [2/2]
void ExerciseValidator::validate |
( |
void |
| ) |
|
|
overridevirtual |
Validates the exercise and calculates the results (list of mistakes, number of hits, etc.).
Implements IExerciseValidator.
◆ validateExercise()
QList< MistakeRecord > ExerciseValidator::validateExercise |
( |
QString |
exerciseText, |
|
|
QString |
inputText, |
|
|
QVector< CharacterRecord > |
recordedCharacters, |
|
|
int * |
totalHits, |
|
|
int * |
mistakeCount, |
|
|
QStringList * |
errorWords = nullptr , |
|
|
bool |
timed = false , |
|
|
int |
timeSecs = 0 |
|
) |
| |
|
private |
◆ characters
◆ exerciseText
QString ExerciseValidator::exerciseText |
|
readwrite |
◆ inputText
QString ExerciseValidator::inputText |
|
readwrite |
◆ mistakes
◆ time
qreal ExerciseValidator::time |
|
readwrite |
Returns exercise time (in seconds).
◆ timed
bool ExerciseValidator::timed |
|
readwrite |
Set this to true if this is a timed exercise.
The documentation for this class was generated from the following files:
- src/framework/validator/internal/ExerciseValidator.h
- src/framework/validator/internal/ExerciseValidator.cpp