#include "keduvocexpression.h"
-void KEduVocExpression::Init()
+
+class KEduVocExpression::Private
+{
+public:
+ Private(KEduVocExpression* qq)
+ : q(qq)
+ {
+ init();
+ }
+
+ void init();
+
+ bool operator==(const Private &p) const;
+
+ KEduVocExpression* q;
+
+ QString m_original;
+
+ // all these vectors must be deleted in removeTranslation()
+ QStringList m_expressionTypes;
+ QStringList m_translations;
+ QStringList m_remarks;
+ QStringList m_usageLabels;
+ QStringList m_paraphrases;
+ QStringList m_fauxAmi;
+ QStringList m_reverseFauxAmi;
+ QStringList m_synonym;
+ QStringList m_example;
+ QStringList m_antonym;
+ QStringList m_pronunciations;
+ QList<grade_t> m_grades;
+ QList<grade_t> m_reverseGrades;
+ QList<count_t> m_queryCounts;
+ QList<count_t> m_reverseQueryCounts;
+ QList<count_t> m_badCounts;
+ QList<count_t> m_reverseBadCounts;
+ QList<QDateTime> m_queryDates;
+ QList<QDateTime> m_reverseQueryDates;
+ QList<KEduVocConjugation> m_conjugations;
+ QList<KEduVocComparison> m_comparisons;
+ QList<KEduVocMultipleChoice> m_multipleChoices;
+
+ QString m_leitnerBox;
+ int m_sortIndex;
+ int m_lesson;
+ bool m_inQuery;
+ bool m_active;
+};
+
+
+void KEduVocExpression::Private::init()
{
m_grades.append(KV_NORM_GRADE);
m_reverseGrades.append(KV_NORM_GRADE);
m_sortIndex = 0;
}
+
+bool KEduVocExpression::Private::operator==(const KEduVocExpression::Private &p) const
+{
+ return m_original == p.m_original &&
+ m_expressionTypes == p.m_expressionTypes &&
+ m_translations == p.m_translations &&
+ m_remarks == p.m_remarks &&
+ m_usageLabels == p.m_usageLabels &&
+ m_paraphrases == p.m_paraphrases &&
+ m_fauxAmi == p.m_fauxAmi &&
+ m_reverseFauxAmi == p.m_reverseFauxAmi &&
+ m_synonym == p.m_synonym &&
+ m_example == p.m_example &&
+ m_antonym == p.m_antonym &&
+ m_pronunciations == p.m_pronunciations &&
+ m_grades == p.m_grades &&
+ m_reverseGrades == p.m_reverseGrades &&
+ m_queryCounts == p.m_queryCounts &&
+ m_reverseQueryCounts == p.m_reverseQueryCounts &&
+ m_badCounts == p.m_badCounts &&
+ m_reverseBadCounts == p.m_reverseBadCounts &&
+ m_queryDates == p.m_queryDates &&
+ m_reverseQueryDates == p.m_reverseQueryDates &&
+ m_conjugations == p.m_conjugations &&
+ m_comparisons == p.m_comparisons &&
+ m_multipleChoices == p.m_multipleChoices &&
+ m_leitnerBox == p.m_leitnerBox &&
+ m_lesson == p.m_lesson &&
+ m_sortIndex == p.m_sortIndex &&
+ m_inQuery == p.m_inQuery &&
+ m_active == p.m_active;
+}
+
+
KEduVocExpression::KEduVocExpression()
+ : d(new Private(this))
{
- Init();
}
KEduVocExpression::KEduVocExpression(const QString & expression, int lesson)
+ : d(new Private(this))
{
- Init();
setOriginal(expression.simplified());
- m_lesson = lesson;
+ d->m_lesson = lesson;
}
KEduVocExpression::KEduVocExpression(const QString & expression, const QString & separator, int lesson)
+ : d(new Private(this))
{
- Init();
QString se;
QString expr = expression;
- m_lesson = lesson;
+ d->m_lesson = lesson;
if (separator.length()) {
int pos = expr.indexOf(separator);
}
}
+
+KEduVocExpression::KEduVocExpression(const KEduVocExpression &expression)
+ : d(new Private(*expression.d))
+{
+}
+
+
+KEduVocExpression::~KEduVocExpression()
+{
+ delete d;
+}
+
+
int KEduVocExpression::translationCount() const
{
- return m_translations.count();
+ return d->m_translations.count();
}
QString KEduVocExpression::remark(int index) const
{
- if (index >= m_remarks.count() || index < 0) {
+ if (index >= d->m_remarks.count() || index < 0) {
return "";
}
else {
- return m_remarks[index];
+ return d->m_remarks[index];
}
}
return;
// extend remarks with empty strings if necessary
- if (m_remarks.count() <= index)
- for (int i = m_remarks.count(); i < index + 1; i++)
- m_remarks.append("");
+ if (d->m_remarks.count() <= index)
+ for (int i = d->m_remarks.count(); i < index + 1; i++)
+ d->m_remarks.append("");
- m_remarks[index] = expr.simplified();
+ d->m_remarks[index] = expr.simplified();
}
if (rev_ami) {
// extend friend with empty strings if necessary
- if (m_reverseFauxAmi.count() <= index)
- for (int i = m_reverseFauxAmi.count(); i < index + 1; i++)
- m_reverseFauxAmi.append("");
+ if (d->m_reverseFauxAmi.count() <= index)
+ for (int i = d->m_reverseFauxAmi.count(); i < index + 1; i++)
+ d->m_reverseFauxAmi.append("");
- m_reverseFauxAmi[index] = expr.simplified();
+ d->m_reverseFauxAmi[index] = expr.simplified();
}
else {
// extend friend with empty strings if necessary
- if (m_fauxAmi.count() <= index)
- for (int i = m_fauxAmi.count(); i < index + 1; i++)
- m_fauxAmi.append("");
+ if (d->m_fauxAmi.count() <= index)
+ for (int i = d->m_fauxAmi.count(); i < index + 1; i++)
+ d->m_fauxAmi.append("");
- m_fauxAmi[index] = expr.simplified();
+ d->m_fauxAmi[index] = expr.simplified();
}
}
QString KEduVocExpression::fauxAmi(int index, bool rev_ami) const
{
if (rev_ami) {
- if (index >= m_reverseFauxAmi.count() || index < 1) {
+ if (index >= d->m_reverseFauxAmi.count() || index < 1) {
return "";
}
- return m_reverseFauxAmi[index];
+ return d->m_reverseFauxAmi[index];
}
- if (index >= m_fauxAmi.count() || index < 1) {
+ if (index >= d->m_fauxAmi.count() || index < 1) {
return "";
}
- return m_fauxAmi[index];
+ return d->m_fauxAmi[index];
}
return;
// extend synonym with empty strings if necessary
- if (m_synonym.count() <= index)
- for (int i = m_synonym.count(); i < index + 1; i++)
- m_synonym.append("-");
+ if (d->m_synonym.count() <= index)
+ for (int i = d->m_synonym.count(); i < index + 1; i++)
+ d->m_synonym.append("-");
- m_synonym[index] = expr.simplified();
+ d->m_synonym[index] = expr.simplified();
}
QString KEduVocExpression::synonym(int index) const
{
- if (index >= m_synonym.count() || index < 0) {
+ if (index >= d->m_synonym.count() || index < 0) {
return "";
}
else {
- return m_synonym[index];
+ return d->m_synonym[index];
}
}
return;
// extend exampls with empty strings if necessary
- if (m_example.count() <= index)
- for (int i = m_example.count(); i < index + 1; i++)
- m_example.append("");
+ if (d->m_example.count() <= index)
+ for (int i = d->m_example.count(); i < index + 1; i++)
+ d->m_example.append("");
- m_example[index] = expr.simplified();
+ d->m_example[index] = expr.simplified();
}
QString KEduVocExpression::example(int index) const
{
- if (index >= m_example.count() || index < 0) {
+ if (index >= d->m_example.count() || index < 0) {
return "";
}
else {
- return m_example[index];
+ return d->m_example[index];
}
}
return;
// extend labels with empty strings if necessary
- if (m_usageLabels.count() <= index)
- for (int i = m_usageLabels.count(); i < index + 1; i++)
- m_usageLabels.append("");
+ if (d->m_usageLabels.count() <= index)
+ for (int i = d->m_usageLabels.count(); i < index + 1; i++)
+ d->m_usageLabels.append("");
- m_usageLabels[index] = expr.simplified();
+ d->m_usageLabels[index] = expr.simplified();
}
QString KEduVocExpression::usageLabel(int index) const
{
- if (index >= m_usageLabels.count() || index < 0) {
+ if (index >= d->m_usageLabels.count() || index < 0) {
return "";
}
else {
- return m_usageLabels[index];
+ return d->m_usageLabels[index];
}
}
return;
// extend phrase with empty strings if necessary
- if (m_paraphrases.count() <= index)
- for (int i = m_paraphrases.count(); i < index + 1; i++)
- m_paraphrases.append("");
+ if (d->m_paraphrases.count() <= index)
+ for (int i = d->m_paraphrases.count(); i < index + 1; i++)
+ d->m_paraphrases.append("");
- m_paraphrases[index] = expr.simplified();
+ d->m_paraphrases[index] = expr.simplified();
}
QString KEduVocExpression::paraphrase(int index) const
{
- if (index >= m_paraphrases.count() || index < 0) {
+ if (index >= d->m_paraphrases.count() || index < 0) {
return "";
}
else {
- return m_paraphrases[index];
+ return d->m_paraphrases[index];
}
}
return;
// extend antonym with empty strings if necessary
- if (m_antonym.count() <= index)
- for (int i = m_antonym.count(); i < index + 1; i++)
- m_antonym.append("");
+ if (d->m_antonym.count() <= index)
+ for (int i = d->m_antonym.count(); i < index + 1; i++)
+ d->m_antonym.append("");
- m_antonym[index] = expr.simplified();
+ d->m_antonym[index] = expr.simplified();
}
QString KEduVocExpression::antonym(int index) const
{
- if (index >= m_antonym.count() || index < 0) {
+ if (index >= d->m_antonym.count() || index < 0) {
return "";
}
else {
- return m_antonym[index];
+ return d->m_antonym[index];
}
}
return;
// extend conjugation with empty elements
- if (m_conjugations.count() <= index)
- for (int i = m_conjugations.count(); i < index + 1; i++)
- m_conjugations.append(KEduVocConjugation());
+ if (d->m_conjugations.count() <= index)
+ for (int i = d->m_conjugations.count(); i < index + 1; i++)
+ d->m_conjugations.append(KEduVocConjugation());
- m_conjugations[index] = con;
+ d->m_conjugations[index] = con;
}
KEduVocConjugation KEduVocExpression::conjugation(int index) const
{
- if (index >= m_conjugations.count() || index < 0) {
+ if (index >= d->m_conjugations.count() || index < 0) {
return KEduVocConjugation();
}
else {
- return m_conjugations[index];
+ return d->m_conjugations[index];
}
}
return;
// extend comparison with empty elements
- if (m_comparisons.count() <= index)
- for (int i = m_comparisons.count(); i < index + 1; i++)
- m_comparisons.append(KEduVocComparison());
+ if (d->m_comparisons.count() <= index)
+ for (int i = d->m_comparisons.count(); i < index + 1; i++)
+ d->m_comparisons.append(KEduVocComparison());
- m_comparisons[index] = con;
+ d->m_comparisons[index] = con;
}
KEduVocComparison KEduVocExpression::comparison (int index) const
{
- if (index >= m_comparisons.count() || index < 0) {
+ if (index >= d->m_comparisons.count() || index < 0) {
return KEduVocComparison();
}
else {
- return m_comparisons[index];
+ return d->m_comparisons[index];
}
}
return;
// extend comparison with empty elements
- if (m_multipleChoices.count() <= index)
- for (int i = m_multipleChoices.count(); i < index + 1; i++)
- m_multipleChoices.append(KEduVocMultipleChoice());
+ if (d->m_multipleChoices.count() <= index)
+ for (int i = d->m_multipleChoices.count(); i < index + 1; i++)
+ d->m_multipleChoices.append(KEduVocMultipleChoice());
- m_multipleChoices[index] = mc;
+ d->m_multipleChoices[index] = mc;
}
KEduVocMultipleChoice KEduVocExpression::multipleChoice(int index) const
{
- if (index >= m_multipleChoices.count() || index < 0) {
+ if (index >= d->m_multipleChoices.count() || index < 0) {
return KEduVocMultipleChoice();
}
else {
- return m_multipleChoices[index];
+ return d->m_multipleChoices[index];
}
}
QString KEduVocExpression::pronunciation(int index) const
{
- if (index >= m_pronunciations.count() || index < 0) {
+ if (index >= d->m_pronunciations.count() || index < 0) {
return "";
}
else {
- return m_pronunciations[index];
+ return d->m_pronunciations[index];
}
}
if (index < 0) return;
// extend with empty strings if necessary
- if (m_pronunciations.count() <= index)
- for (int i = m_pronunciations.count(); i < index + 1; i++)
- m_pronunciations.append("");
+ if (d->m_pronunciations.count() <= index)
+ for (int i = d->m_pronunciations.count(); i < index + 1; i++)
+ d->m_pronunciations.append("");
- m_pronunciations[index] = expr.simplified();
+ d->m_pronunciations[index] = expr.simplified();
}
if (rev_grade > KV_MAX_GRADE)
rev_grade = KV_MAX_GRADE;
- m_grades.append(grade);
- m_reverseGrades.append(rev_grade);
- m_translations.append(expr.simplified());
+ d->m_grades.append(grade);
+ d->m_reverseGrades.append(rev_grade);
+ d->m_translations.append(expr.simplified());
}
QString KEduVocExpression::translation(int index) const
{
- if (index > m_translations.count() || index < 1)
+ if (index > d->m_translations.count() || index < 1)
return "";
else
- return m_translations[index-1];
+ return d->m_translations[index-1];
}
return;
if (index <= translationCount())
- m_translations.removeAt(index - 1);
+ d->m_translations.removeAt(index - 1);
- if (index < m_remarks.count())
- m_remarks.removeAt(index - 1);
+ if (index < d->m_remarks.count())
+ d->m_remarks.removeAt(index - 1);
- if (index < m_conjugations.count())
- m_conjugations.removeAt(index -1);
+ if (index < d->m_conjugations.count())
+ d->m_conjugations.removeAt(index -1);
- if (index < m_comparisons.count())
- m_comparisons.removeAt(index - 1);
+ if (index < d->m_comparisons.count())
+ d->m_comparisons.removeAt(index - 1);
- if (index < m_fauxAmi.count())
- m_fauxAmi.removeAt(index - 1);
+ if (index < d->m_fauxAmi.count())
+ d->m_fauxAmi.removeAt(index - 1);
- if (index < m_reverseFauxAmi.count())
- m_reverseFauxAmi.removeAt(index - 1);
+ if (index < d->m_reverseFauxAmi.count())
+ d->m_reverseFauxAmi.removeAt(index - 1);
- if (index < m_synonym.count())
- m_synonym.removeAt(index - 1);
+ if (index < d->m_synonym.count())
+ d->m_synonym.removeAt(index - 1);
- if (index < m_example.count())
- m_example.removeAt(index - 1);
+ if (index < d->m_example.count())
+ d->m_example.removeAt(index - 1);
- if (index < m_usageLabels.count())
- m_usageLabels.removeAt(index - 1);
+ if (index < d->m_usageLabels.count())
+ d->m_usageLabels.removeAt(index - 1);
- if (index < m_paraphrases.count())
- m_paraphrases.removeAt(index - 1);
+ if (index < d->m_paraphrases.count())
+ d->m_paraphrases.removeAt(index - 1);
- if (index < m_antonym.count())
- m_antonym.removeAt(index - 1);
+ if (index < d->m_antonym.count())
+ d->m_antonym.removeAt(index - 1);
- if (index < m_expressionTypes.count())
- m_expressionTypes.removeAt(index - 1);
+ if (index < d->m_expressionTypes.count())
+ d->m_expressionTypes.removeAt(index - 1);
- if (index < m_pronunciations.count())
- m_pronunciations.removeAt(index - 1);
+ if (index < d->m_pronunciations.count())
+ d->m_pronunciations.removeAt(index - 1);
- if (index < m_grades.count())
- m_grades.removeAt(index - 1);
+ if (index < d->m_grades.count())
+ d->m_grades.removeAt(index - 1);
- if (index < m_reverseGrades.count())
- m_reverseGrades.removeAt(index - 1);
+ if (index < d->m_reverseGrades.count())
+ d->m_reverseGrades.removeAt(index - 1);
- if (index < m_queryCounts.count())
- m_queryCounts.removeAt(index - 1);
+ if (index < d->m_queryCounts.count())
+ d->m_queryCounts.removeAt(index - 1);
- if (index < m_reverseQueryCounts.count())
- m_reverseQueryCounts.removeAt(index - 1);
+ if (index < d->m_reverseQueryCounts.count())
+ d->m_reverseQueryCounts.removeAt(index - 1);
- if (index < m_badCounts.count())
- m_badCounts.removeAt(index - 1);
+ if (index < d->m_badCounts.count())
+ d->m_badCounts.removeAt(index - 1);
- if (index < m_reverseBadCounts.count())
- m_reverseBadCounts.removeAt(index - 1);
+ if (index < d->m_reverseBadCounts.count())
+ d->m_reverseBadCounts.removeAt(index - 1);
- if (index < m_queryDates.count())
- m_queryDates.removeAt(index - 1);
+ if (index < d->m_queryDates.count())
+ d->m_queryDates.removeAt(index - 1);
- if (index < m_reverseQueryDates.count())
- m_reverseQueryDates.removeAt(index - 1);
+ if (index < d->m_reverseQueryDates.count())
+ d->m_reverseQueryDates.removeAt(index - 1);
}
return;
// extend translations with empty strings if necessary
- if (m_translations.count() < index)
- for (int i = m_translations.count(); i < index; i++)
- m_translations.append("");
+ if (d->m_translations.count() < index)
+ for (int i = d->m_translations.count(); i < index; i++)
+ d->m_translations.append("");
// if (index <= translations.count())
- m_translations[index-1] = expr.simplified();
+ d->m_translations[index-1] = expr.simplified();
}
grade_t KEduVocExpression::grade(int index, bool rev_grade) const
{
if (rev_grade) {
- if (index >= m_reverseGrades.count() || index < 1) {
+ if (index >= d->m_reverseGrades.count() || index < 1) {
return KV_NORM_GRADE;
}
- else if (m_reverseGrades[index] > KV_MAX_GRADE) {
+ else if (d->m_reverseGrades[index] > KV_MAX_GRADE) {
return KV_MAX_GRADE;
}
- return m_reverseGrades[index];
+ return d->m_reverseGrades[index];
}
else {
- if (index >= m_grades.count() || index < 1) {
+ if (index >= d->m_grades.count() || index < 1) {
return KV_NORM_GRADE;
}
- else if (m_grades[index] > KV_MAX_GRADE) {
+ else if (d->m_grades[index] > KV_MAX_GRADE) {
return KV_MAX_GRADE;
}
- return m_grades[index];
+ return d->m_grades[index];
}
}
if (rev_grade) {
// extend rev grades with standard grade if necessary
- if (m_reverseGrades.count() <= index)
- for (int i = m_reverseGrades.count(); i <= index; i++) {
- m_reverseGrades.append(KV_NORM_GRADE);
+ if (d->m_reverseGrades.count() <= index)
+ for (int i = d->m_reverseGrades.count(); i <= index; i++) {
+ d->m_reverseGrades.append(KV_NORM_GRADE);
}
- m_reverseGrades[index] = grade;
+ d->m_reverseGrades[index] = grade;
}
else {
// extend grades with standard grade if necessary
- if (m_grades.count() <= index)
- for (int i = m_grades.count(); i <= index; i++) {
- m_grades.append(KV_NORM_GRADE);
+ if (d->m_grades.count() <= index)
+ for (int i = d->m_grades.count(); i <= index; i++) {
+ d->m_grades.append(KV_NORM_GRADE);
}
- m_grades[index] = grade;
+ d->m_grades[index] = grade;
}
}
if (rev_grade) {
// extend rev grades with standard grade if necessary
- if (m_reverseGrades.count() <= index)
- for (int i = m_reverseGrades.count(); i <= index; i++) {
- m_reverseGrades.append(KV_NORM_GRADE);
+ if (d->m_reverseGrades.count() <= index)
+ for (int i = d->m_reverseGrades.count(); i <= index; i++) {
+ d->m_reverseGrades.append(KV_NORM_GRADE);
}
- if (m_reverseGrades[index] < KV_MAX_GRADE)
- m_reverseGrades[index]++;
+ if (d->m_reverseGrades[index] < KV_MAX_GRADE)
+ d->m_reverseGrades[index]++;
}
else {
// extend grades with standard grade if necessary
- if (m_grades.count() <= index)
- for (int i = m_grades.count(); i <= index; i++) {
- m_grades.append(KV_NORM_GRADE);
+ if (d->m_grades.count() <= index)
+ for (int i = d->m_grades.count(); i <= index; i++) {
+ d->m_grades.append(KV_NORM_GRADE);
}
- if (m_grades[index] < KV_MAX_GRADE)
- m_grades[index]++;
+ if (d->m_grades[index] < KV_MAX_GRADE)
+ d->m_grades[index]++;
}
}
if (rev_grade) {
// extend rev grades with standard grade if necessary
- if (m_reverseGrades.count() <= index)
- for (int i = m_reverseGrades.count(); i <= index; i++) {
- m_reverseGrades.append(KV_NORM_GRADE);
+ if (d->m_reverseGrades.count() <= index)
+ for (int i = d->m_reverseGrades.count(); i <= index; i++) {
+ d->m_reverseGrades.append(KV_NORM_GRADE);
}
- if (m_reverseGrades[index] > KV_MIN_GRADE)
- m_reverseGrades[index]--;
+ if (d->m_reverseGrades[index] > KV_MIN_GRADE)
+ d->m_reverseGrades[index]--;
}
else {
// extend grades with standard grade if necessary
- if (m_grades.count() <= index)
- for (int i = m_grades.count(); i <= index; i++) {
- m_grades.append(KV_NORM_GRADE);
+ if (d->m_grades.count() <= index)
+ for (int i = d->m_grades.count(); i <= index; i++) {
+ d->m_grades.append(KV_NORM_GRADE);
}
- if (m_grades[index] > KV_MIN_GRADE)
- m_grades[index]--;
+ if (d->m_grades[index] > KV_MIN_GRADE)
+ d->m_grades[index]--;
}
}
count_t KEduVocExpression::queryCount(int index, bool rev_count) const
{
if (rev_count) {
- if (index >= m_reverseQueryCounts.count() || index < 1) {
+ if (index >= d->m_reverseQueryCounts.count() || index < 1) {
return 0;
}
- return m_reverseQueryCounts[index];
+ return d->m_reverseQueryCounts[index];
}
- if (index >= m_queryCounts.count() || index < 1) {
+ if (index >= d->m_queryCounts.count() || index < 1) {
return 0;
}
- return m_queryCounts[index];
+ return d->m_queryCounts[index];
}
if (rev_count) {
// extend rev counts with 0 if necessary
- if (m_reverseQueryCounts.count() <= index)
- for (int i = m_reverseQueryCounts.count(); i <= index; i++) {
- m_reverseQueryCounts.append(0);
+ if (d->m_reverseQueryCounts.count() <= index)
+ for (int i = d->m_reverseQueryCounts.count(); i <= index; i++) {
+ d->m_reverseQueryCounts.append(0);
}
- m_reverseQueryCounts[index] = count;
+ d->m_reverseQueryCounts[index] = count;
}
else {
// extend counts with 0 if necessary
- if (m_queryCounts.count() <= index)
- for (int i = m_queryCounts.count(); i <= index; i++) {
- m_queryCounts.append(0);
+ if (d->m_queryCounts.count() <= index)
+ for (int i = d->m_queryCounts.count(); i <= index; i++) {
+ d->m_queryCounts.append(0);
}
- m_queryCounts[index] = count;
+ d->m_queryCounts[index] = count;
}
}
count_t KEduVocExpression::badCount(int index, bool rev_count) const
{
if (rev_count) {
- if (index >= m_reverseBadCounts.count() || index < 1) {
+ if (index >= d->m_reverseBadCounts.count() || index < 1) {
return 0;
}
- return m_reverseBadCounts[index];
+ return d->m_reverseBadCounts[index];
}
- if (index >= m_badCounts.count() || index < 1) {
+ if (index >= d->m_badCounts.count() || index < 1) {
return 0;
}
- return m_badCounts[index];
+ return d->m_badCounts[index];
}
if (rev_count) {
// extend rev counts with 0 if necessary
- if (m_reverseBadCounts.count() <= index)
- for (int i = m_reverseBadCounts.count(); i <= index; i++) {
- m_reverseBadCounts.append(0);
+ if (d->m_reverseBadCounts.count() <= index)
+ for (int i = d->m_reverseBadCounts.count(); i <= index; i++) {
+ d->m_reverseBadCounts.append(0);
}
- m_reverseBadCounts[index] = count;
+ d->m_reverseBadCounts[index] = count;
}
else {
// extend counts with 0 if necessary
- if (m_badCounts.count() <= index)
- for (int i = m_badCounts.count(); i <= index; i++) {
- m_badCounts.append(0);
+ if (d->m_badCounts.count() <= index)
+ for (int i = d->m_badCounts.count(); i <= index; i++) {
+ d->m_badCounts.append(0);
}
- m_badCounts[index] = count;
+ d->m_badCounts[index] = count;
}
}
QDateTime KEduVocExpression::queryDate(int index, bool rev_date) const
{
if (rev_date) {
- if (index >= m_reverseQueryDates.count() || index < 1)
+ if (index >= d->m_reverseQueryDates.count() || index < 1)
{
QDateTime dt;
dt.setTime_t(0);
return dt;
}
- return m_reverseQueryDates[index];
+ return d->m_reverseQueryDates[index];
}
- if (index >= m_queryDates.count() || index < 1)
+ if (index >= d->m_queryDates.count() || index < 1)
{
QDateTime dt;
dt.setTime_t(0);
return dt;
}
- return m_queryDates[index];
+ return d->m_queryDates[index];
}
if (rev_date) {
// extend rev dates with 0 if necessary
- if (m_reverseQueryDates.count() <= index)
- for (int i = m_reverseQueryDates.count(); i <= index; i++)
+ if (d->m_reverseQueryDates.count() <= index)
+ for (int i = d->m_reverseQueryDates.count(); i <= index; i++)
{
QDateTime dt;
dt.setTime_t(0);
- m_reverseQueryDates.append(dt);
+ d->m_reverseQueryDates.append(dt);
}
- m_reverseQueryDates[index] = date;
+ d->m_reverseQueryDates[index] = date;
}
else {
// extend dates with 0 if necessary
- if (m_queryDates.count() <= index)
- for (int i = m_queryDates.count(); i <= index; i++)
+ if (d->m_queryDates.count() <= index)
+ for (int i = d->m_queryDates.count(); i <= index; i++)
{
QDateTime dt;
dt.setTime_t(0);
- m_queryDates.append(dt);
+ d->m_queryDates.append(dt);
}
- m_queryDates[index] = date;
+ d->m_queryDates[index] = date;
}
}
QString KEduVocExpression::type(int index) const
{
- if (index >= m_expressionTypes.count() || index < 0) {
+ if (index >= d->m_expressionTypes.count() || index < 0) {
return "";
}
else {
- return m_expressionTypes[index];
+ return d->m_expressionTypes[index];
}
}
return;
// extend types with empty strings if necessary
- if (m_expressionTypes.count() <= index)
- for (int i = m_expressionTypes.count(); i < index + 1; i++)
- m_expressionTypes.append("");
+ if (d->m_expressionTypes.count() <= index)
+ for (int i = d->m_expressionTypes.count(); i < index + 1; i++)
+ d->m_expressionTypes.append("");
- m_expressionTypes[index] = type.simplified();
+ d->m_expressionTypes[index] = type.simplified();
}
int KEduVocExpression::lesson() const
{
- return m_lesson;
+ return d->m_lesson;
}
void KEduVocExpression::setLesson(int l)
{
- m_lesson = l;
+ d->m_lesson = l;
}
QString KEduVocExpression::original() const
{
- return m_original;
+ return d->m_original;
}
void KEduVocExpression::setOriginal(const QString & expr)
{
- m_original = expr;
+ d->m_original = expr;
}
-QString& KEduVocExpression::leitnerBox()
+QString KEduVocExpression::leitnerBox()
{
- return m_leitnerBox;
+ return d->m_leitnerBox;
}
void KEduVocExpression::setLeitnerBox(const QString& box)
{
- m_leitnerBox = box;
+ d->m_leitnerBox = box;
+}
+
+
+bool KEduVocExpression::isInQuery() const
+{
+ return d->m_inQuery;
+}
+
+
+void KEduVocExpression::setInQuery(bool flag)
+{
+ d->m_inQuery = flag;
+}
+
+
+bool KEduVocExpression::isActive() const
+{
+ return d->m_active;
+}
+
+
+void KEduVocExpression::setActive(bool flag)
+{
+ d->m_active = flag;
+}
+
+
+KEduVocExpression& KEduVocExpression::operator=(const KEduVocExpression &expression)
+{
+ *d = *expression.d;
+ return *this;
+}
+
+
+bool KEduVocExpression::operator==(const KEduVocExpression &expression) const
+{
+ return (*d == *expression.d);
}