/***************************************************************************
-
- C++ Implementation: keduvocidentifier
-
- -----------------------------------------------------------------------
-
- begin : Mi Aug 29 2007
-
- copyright : (C) 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
-
- -----------------------------------------------------------------------
-
+ Copyright 2007-2008 Frederik Gladhorn <gladhorn@kde.org>
***************************************************************************/
/***************************************************************************
QString m_type;
/** I, you, he, she, it... */
- KEduVocPersonalPronoun m_personalPronouns;
+ KEduVocPersonalPronoun m_personalPronouns;
/** the for english ;)
der, die, das ... in german */
- KEduVocArticle m_articles;
+ KEduVocArticle m_articles;
/** Future, present and past... and many more */
- QSet < QString > m_tenses;
-
- /** Size hint for the width of this column - has to go somewere. Here at least we have the headers... */
- int m_sizeHint;
+ QStringList m_tenses;
};
-
KEduVocIdentifier::KEduVocIdentifier()
: d( new Private )
{
d->m_locale = "en";
}
-
KEduVocIdentifier::~KEduVocIdentifier()
{
delete d;
}
-
KEduVocIdentifier::KEduVocIdentifier( const KEduVocIdentifier &other )
: d( new Private )
{
d->m_articles = other.d->m_articles;
d->m_personalPronouns = other.d->m_personalPronouns;
d->m_comment = other.d->m_comment;
- d->m_sizeHint = other.d->m_sizeHint;
d->m_tenses = other.d->m_tenses;
d->m_type = other.d->m_type;
}
-
KEduVocIdentifier& KEduVocIdentifier::operator= ( const KEduVocIdentifier &other )
{
d->m_locale = other.d->m_locale;
d->m_name = other.d->m_name;
d->m_articles = other.d->m_articles;
d->m_personalPronouns = other.d->m_personalPronouns;
+ d->m_comment = other.d->m_comment;
+ d->m_tenses = other.d->m_tenses;
+ d->m_type = other.d->m_type;
return *this;
}
-
QString KEduVocIdentifier::name() const
{
return d->m_name;
d->m_locale = locale;
}
-
void KEduVocIdentifier::setArticle( const KEduVocArticle& articles )
{
d->m_articles = articles;
{
d->m_personalPronouns = pronouns;
}
+
+const QString& KEduVocIdentifier::tense(int tenseIndex) const
+{
+ Q_ASSERT(d->m_tenses.size() > tenseIndex);
+ return d->m_tenses.value(tenseIndex);
+}
+
+void KEduVocIdentifier::setTense(int tenseIndex, const QString& tense)
+{
+ Q_ASSERT(d->m_tenses.size() >= tenseIndex);
+ if (tenseIndex == d->m_tenses.size()) {
+ d->m_tenses.append(tense);
+ } else {
+ d->m_tenses[tenseIndex] = tense;
+ }
+}
+
/***************************************************************************
-
- C++ Interface: keduvocidentifier
-
- -----------------------------------------------------------------------
-
- begin : Mi Aug 29 2007
-
- copyright : (C) 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
-
- -----------------------------------------------------------------------
-
+ Copyright 2007-2008 Frederik Gladhorn <gladhorn@kde.org>
***************************************************************************/
/***************************************************************************
/**
Class to store meta information about a language or any other category in the vocabulary.
-
- @author
*/
class KEDUVOCDOCUMENT_EXPORT KEduVocIdentifier
{
*/
void setLocale( const QString& name );
-
/**
* Articles (a, the in English, el, la,... in Spanish)
* @returns articles
*/
void setArticle( const KEduVocArticle& article );
-
/**
* Get the personal pronouns for this identifier
* @returns a KEduVocPersonalPronoun containing the personal pronouns
*/
void setPersonalPronouns( const KEduVocPersonalPronoun &pronouns );
+ /**
+ * Returns the name of tense number @p tenseIndex
+ * @param tenseIndex desired tense
+ * @return name of the tense
+ */
+ const QString& tense(int tenseIndex) const;
+
+ /**
+ * Sets the name of a tense for this language
+ * @param tenseIndex
+ * @param tense
+ */
+ void setTense(int tenseIndex, const QString& tense);
+
private:
class Private;
Private * const d;
-
};
#endif