]> Git trees. - libqmvoc.git/commitdiff
Consistently use the term identifier instead of language
authorPeter Hedlund <peter@peterandlinda.com>
Wed, 20 Jul 2005 01:47:20 +0000 (01:47 +0000)
committerPeter Hedlund <peter@peterandlinda.com>
Wed, 20 Jul 2005 01:47:20 +0000 (01:47 +0000)
svn path=/branches/work/kwordquiz/src/keduvocdocument.h; revision=436597

kwordquiz/keduvocdocument.cpp
kwordquiz/keduvocdocument.h
kwordquiz/keduvockvtmlreader.cpp
kwordquiz/keduvockvtmlwriter.cpp
kwordquiz/keduvocwqlreader.cpp

index 36496ec78a6b939c5c9fbac370b9a044a5822c43..39811f79ecb4f5dd5fa1f88d617c07d18f9c48e0 100644 (file)
@@ -74,7 +74,7 @@ void KEduVocDocument::Init ()
   m_lessonDescriptions.clear();
   m_typeDescriptions.clear();
   m_tenseDescriptions.clear();
-  m_languages.clear();
+  m_identifiers.clear();
   m_sortLanguage.clear();
   m_extraSizeHints.clear();
   m_sizeHints.clear();
@@ -306,9 +306,9 @@ void KEduVocDocument::removeEntry(int index)
 
 int KEduVocDocument::findIdentifier(const QString &lang) const
 {
-  QStringList::const_iterator first = m_languages.begin();
+  QStringList::const_iterator first = m_identifiers.begin();
   int count = 0;
-  while (first != m_languages.end()) {
+  while (first != m_identifiers.end()) {
     if ( *first == lang)
       return count;
     first++;
@@ -320,17 +320,17 @@ int KEduVocDocument::findIdentifier(const QString &lang) const
 
 QString KEduVocDocument::identifier(int index) const
 {
-  if (index >= (int)m_languages.size() || index < 1 )
+  if (index >= (int)m_identifiers.size() || index < 1 )
     return "";
   else
-    return m_languages[index];
+    return m_identifiers[index];
 }
 
 
 void KEduVocDocument::setIdentifier(int idx, const QString &id)
 {
-  if (idx < (int)m_languages.size() && idx >= 1 ) {
-    m_languages[idx] = id;
+  if (idx < (int)m_identifiers.size() && idx >= 1 ) {
+    m_identifiers[idx] = id;
   }
 }
 
@@ -504,8 +504,8 @@ public:
 
 void KEduVocDocument::removeIdentifier(int index)
 {
-  if (index < (int)m_languages.size() && index >= 1 ) {
-    m_languages.erase(m_languages.at(index));
+  if (index < (int)m_identifiers.size() && index >= 1 ) {
+    m_identifiers.erase(m_identifiers.at(index));
     for_each (m_vocabulary.begin(), m_vocabulary.end(), eraseTrans(index));
   }
 }
@@ -513,8 +513,8 @@ void KEduVocDocument::removeIdentifier(int index)
 
 QString KEduVocDocument::originalIdentifier() const
 {
-  if (m_languages.size() > 0)
-    return m_languages[0];
+  if (m_identifiers.size() > 0)
+    return m_identifiers[0];
   else
     return "";
 }
@@ -522,8 +522,8 @@ QString KEduVocDocument::originalIdentifier() const
 
 void KEduVocDocument::setOriginalIdentifier(const QString &id)
 {
-  if (m_languages.size() > 0) {
-    m_languages[0] = id;
+  if (m_identifiers.size() > 0) {
+    m_identifiers[0] = id;
   }
 }
 
@@ -933,7 +933,7 @@ int KEduVocDocument::search(QString substr, int id,
    if (first < 0)
      first = 0;
 
-   if (id >= numLanguages()
+   if (id >= numIdentifiers()
       || last < first
       )
      return -1;
@@ -1119,7 +1119,7 @@ int KEduVocDocument::cleanUp()
 
     bool equal = true;
     if (kve1->original() == kve2->original() ) {
-      for (int l = 1; equal && l < (int) numLanguages(); l++ )
+      for (int l = 1; equal && l < (int) numIdentifiers(); l++ )
         if (kve1->translation(l) != kve2->translation(l))
           equal = false;
 
index 77c5b26757d4e225e53eaefb9f455d89195b65d0..063cba294e571ad58579a8e144660408195c4bba 100644 (file)
@@ -459,13 +459,15 @@ class KEduVocDocument : public QObject
    */
   void resetEntry(int index = -1, int lesson = 0);
 
-  /** returns count of different languages
+  /** returns the number of different identifiers (usually languages)
    */
-  inline int numLanguages() const { return m_languages.count(); } // org + translations
+  inline int numIdentifiers() const { return m_identifiers.count(); } // org + translations
 
-  /** append new lang ident
+  /** appends a new identifier (usually a language)
+   *
+   * @param id         the identifier to append
    */
-  inline void appendLanguage(const QString & id) { m_languages.append(id); }
+  inline void appendIdentifier(const QString & id) { m_identifiers.append(id); }
 
   /** returns pointer to expression object x
    *
@@ -664,7 +666,7 @@ protected:
   bool                  m_enableSorting;
 
   // save these to document
-  QStringList           m_languages;      //0= origin, 1,.. translations
+  QStringList           m_identifiers;      //0= origin, 1,.. translations
   int                   m_cols;
   int                   m_lines;
   int                   m_currentLesson;
index f2ca8458e8c4daf46697cb6f4dc582614e2ec736..d8a3352672700e7bbf8b1faebbef8554d0b27af0 100644 (file)
@@ -141,18 +141,18 @@ bool KEduVocKvtmlReader::readArticle(QDomElement &domElementParent)
     QString lang;
     QDomAttr domAttrLang = domElementEntry.attributeNode(KV_LANG);
 
-    if ((int)m_doc->m_languages.size() <= count)
+    if ((int)m_doc->m_identifiers.size() <= count)
     {
       // first entry
       if (!domAttrLang.isNull())         // no definition in first entry
         lang = domAttrLang.value();
       else
         lang = "original";
-      m_doc->m_languages.push_back(lang);
+      m_doc->m_identifiers.push_back(lang);
     }
     else
     {
-      if (!domAttrLang.isNull() && domAttrLang.value() != m_doc->m_languages[count])
+      if (!domAttrLang.isNull() && domAttrLang.value() != m_doc->m_identifiers[count])
       {
         // different originals ?
         domError(i18n("ambiguous definition of language code"));
@@ -300,18 +300,18 @@ bool KEduVocKvtmlReader::readConjug(QDomElement &domElementParent,
       QString lang;
       QDomAttr domAttrLang = domElementConjugChild.attributeNode(KV_LANG);
 
-      if ((int)m_doc->m_languages.size() <= count)
+      if ((int)m_doc->m_identifiers.size() <= count)
       {
         // first entry
         if (!domAttrLang.isNull())            // no definition in first entry
           lang = domAttrLang.value();
         else
           lang = "original";
-        m_doc->m_languages.push_back(lang);
+        m_doc->m_identifiers.push_back(lang);
       }
       else
       {
-        if (!domAttrLang.isNull() && domAttrLang.value() != m_doc->m_languages[count])
+        if (!domAttrLang.isNull() && domAttrLang.value() != m_doc->m_identifiers[count])
         {
           // different originals ?
           domError(i18n("ambiguous definition of language code"));
@@ -1104,17 +1104,17 @@ bool KEduVocKvtmlReader::readExpression(QDomElement &domElementParent)
       q_trans = lang;
   }
 
-  if (m_doc->m_languages.size() == 0)
+  if (m_doc->m_identifiers.size() == 0)
   {
     // first entry
     if (lang.isEmpty())                 // no definition in first entry
       lang = "original";
-    m_doc->m_languages.push_back(lang);
+    m_doc->m_identifiers.push_back(lang);
 
   }
   else
   {
-    if (lang != m_doc->m_languages[0] && !lang.isEmpty())
+    if (lang != m_doc->m_identifiers[0] && !lang.isEmpty())
     {
       // different originals ?
       domError(i18n("ambiguous definition of language code"));
@@ -1280,21 +1280,21 @@ bool KEduVocKvtmlReader::readExpression(QDomElement &domElementParent)
 
     }
 
-    if (m_doc->m_languages.size() <= count)
+    if (m_doc->m_identifiers.size() <= count)
     {
       // new translation
       if (lang.isEmpty())
       {
         // no definition in first entry ?
-        lang.setNum (m_doc->m_languages.size() );
+        lang.setNum (m_doc->m_identifiers.size() );
         lang.insert (0, "translation ");
       }
-      m_doc->m_languages.push_back(lang);
+      m_doc->m_identifiers.push_back(lang);
 
     }
     else
     {
-      if (lang != m_doc->m_languages[count] && !lang.isEmpty())
+      if (lang != m_doc->m_identifiers[count] && !lang.isEmpty())
       { // different language ?
         domError(i18n("ambiguous definition of language code"));
         return false;
@@ -1575,7 +1575,7 @@ bool KEduVocKvtmlReader::readDoc(KEduVocDocument *doc)
     return false;
   }
 
-  m_doc->m_languages.clear();
+  m_doc->m_identifiers.clear();
   m_doc->m_vocabulary.clear();
 
   m_doc->m_generator = "";
index be97bd7569ad9af3a4018cc16bcd8e1ee101a335..1bc986f4368a1ab7fb593f89f5e5e8b99aedd8a4 100644 (file)
@@ -268,7 +268,7 @@ bool KEduVocKvtmlWriter::saveConjugHeader(QDomDocument &domDoc, QDomElement &dom
   QDomElement domElementConjug = domDoc.createElement(KV_CONJUG_GRP);
   QString s;
 
-  for (int ent = 0; ent < QMIN((int) curr_conjug.size(), m_doc->numLanguages()); ent++)
+  for (int ent = 0; ent < QMIN((int) curr_conjug.size(), m_doc->numIdentifiers()); ent++)
   {
     QDomElement domElementEntry = domDoc.createElement(KV_CON_ENTRY);
 
@@ -478,7 +478,7 @@ bool KEduVocKvtmlWriter::saveArticleKvtMl(QDomDocument &domDoc, QDomElement &dom
   QDomElement domElementArticle = domDoc.createElement(KV_ARTICLE_GRP);
   QString def, indef, s;
 
-  for (int lfn = 0; lfn < QMIN((int) m_doc->m_articles.size(), m_doc->numLanguages()); lfn++)
+  for (int lfn = 0; lfn < QMIN((int) m_doc->m_articles.size(), m_doc->numIdentifiers()); lfn++)
   {
     QDomElement domElementEntry = domDoc.createElement(KV_ART_ENTRY);
     if (lfn == 0)
@@ -648,8 +648,8 @@ bool KEduVocKvtmlWriter::writeDoc(KEduVocDocument *doc, const QString &generator
   domElementKvtml.setAttribute(KV_ENCODING, (QString)"UTF-8");
 
   domElementKvtml.setAttribute(KV_GENERATOR, generator);
-  domElementKvtml.setAttribute(KV_COLS, m_doc->numLanguages() );
-  domElementKvtml.setAttribute(KV_LINES, m_doc->numEntries() );
+  domElementKvtml.setAttribute(KV_COLS, m_doc->numIdentifiers());
+  domElementKvtml.setAttribute(KV_LINES, m_doc->numEntries());
 
   if (!m_doc->m_title.isEmpty())
     domElementKvtml.setAttribute(KV_TITLE, m_doc->m_title);
@@ -808,7 +808,7 @@ bool KEduVocKvtmlWriter::writeDoc(KEduVocDocument *doc, const QString &generator
     domElementExpression.appendChild(domElementOriginal);
 
     int trans = 1;
-    while (trans < (int)m_doc->m_languages.size())
+    while (trans < (int)m_doc->m_identifiers.size())
     {
       QDomElement domElementTranslation = domDoc.createElement(KV_TRANS);
       if (first_expr)
index 37a0f9d0a0d7d50c95b17e4bdbccdbe26ac327c6..7cf060e5402b9d8667d46519257b6684fcd07113 100644 (file)
@@ -138,8 +138,8 @@ bool KEduVocWqlReader::readDoc(KEduVocDocument *doc)
   p = s.find("   [", 0);
   s = s.left(p);
   s = s.stripWhiteSpace();
-  m_doc->m_languages.push_back(s);
-  m_doc->m_languages.push_back(inputStream.readLine());
+  m_doc->m_identifiers.push_back(s);
+  m_doc->m_identifiers.push_back(inputStream.readLine());
 
   while (!s.isNull())
   {