OSDN Git Service

Use `//' style comments
[kita/kita.git] / src / libkita / datinfo.cpp
index 51b29cf..e4427af 100644 (file)
@@ -42,33 +42,33 @@ DatInfo::DatInfo(const KUrl& url) : m_threadIndex(m_datUrl),
     QString refstr;
     m_datUrl = getDatUrl(url, refstr);
     m_threadIndex = ThreadIndex(m_datUrl);
-    /* get the pointer of Thread class */
+    // get the pointer of Thread class
     m_thread = Thread::getByUrlNew(m_datUrl);
     if (m_thread == 0) {
 
-        /* create Thread */
+        // create Thread
         m_thread = Thread::getByUrl(m_datUrl);
         if (m_thread == 0) return ;
 
-        /* read idx file */
+        // read idx file
         m_threadIndex.loadIndex(m_thread);
     }
 
     m_thread = Thread::getByUrl(m_datUrl);
 
-    /* japanese strings */
+    // japanese strings
     m_spacestr = QString::fromUtf8(KITAUTF8_ZENSPACE);
-    m_framestr1 = QString::fromUtf8(KITAUTF8_FRAME1); /* |  */
-    m_framestr2 = QString::fromUtf8(KITAUTF8_FRAME2); /* |- */
-    m_framestr3 = QString::fromUtf8(KITAUTF8_FRAME3); /* L  */
+    m_framestr1 = QString::fromUtf8(KITAUTF8_FRAME1); // |
+    m_framestr2 = QString::fromUtf8(KITAUTF8_FRAME2); // |-
+    m_framestr3 = QString::fromUtf8(KITAUTF8_FRAME3); // L
 
-    /* make directory */
+    // make directory
     Cache cache(m_datUrl);
     QString cacheDir = cache.getDirPath();
     if (!QDir::root().mkpath(cacheDir)) return ;
 
     initPrivate(
-        true /* load cache */
+        true // load cache
    );
 }
 
@@ -88,22 +88,22 @@ void DatInfo::init()
 /* Init. If loadCache = true, load data from cache. */ /* private */
 void DatInfo::initPrivate(bool loadCache)
 {
-    /* stop & delete dat loader */
+    // stop & delete dat loader
     deleteAccessJob();
 
-    /* init variables */
+    // init variables
     m_broken = false;
     m_nowLoading = false;
     m_lastLine.clear();
 
-    /* clear ResDatVec */
+    // clear ResDatVec
     m_resDatVec.clear();
     increaseResDatVec(RESDAT_DEFAULTSIZE);
 
-    /* reset Abone */
+    // reset Abone
     resetAbonePrivate();
 
-    /* create dat loader */
+    // create dat loader
     m_access = new Access(m_datUrl);
 
     connect(m_access, SIGNAL(receiveData(const QStringList&)),
@@ -112,15 +112,15 @@ void DatInfo::initPrivate(bool loadCache)
 
     if (!loadCache) return ;
 
-    /* reset ReadNum before loading cache. */
-    /* ReadNum & subject are updated by Access::getcache() */
+    // reset ReadNum before loading cache.
+    // ReadNum & subject are updated by Access::getcache()
     m_thread->setReadNum(0);
 
-    /* get dat from cahce  */
-    /* slotReceiveData() is called from Access::getcache() */
+    // get dat from cahce
+    // slotReceiveData() is called from Access::getcache()
     m_access->getcache();
 
-    /* save up-to-date thread information */
+    // save up-to-date thread information
     m_threadIndex.saveIndex(m_thread);
 }
 
@@ -216,7 +216,7 @@ void DatInfo::slotReceiveData(const QStringList& lineList)
 
     if (rescode != 200 && rescode != 206) return ;
 
-    /* copy lines to buffer */
+    // copy lines to buffer
     int count = lineList.count();
     for (int i = 0; i < count ; ++i)
         copyOneLineToResDat(lineList[ i ]);
@@ -231,28 +231,28 @@ bool DatInfo::copyOneLineToResDat(const QString& line)
 {
     if (line.isEmpty()) return false;
 
-    /* update ReadNum */
+    // update ReadNum
     const int num = m_thread->readNum() + 1;
     m_thread->setReadNum(num);
 
-    /* If resdat vector is short, then resize the vector. */
+    // If resdat vector is short, then resize the vector.
     while ((int) m_resDatVec.size() <= num)
         increaseResDatVec(RESDAT_DELTA);
 
-    /* reset ResDat */
+    // reset ResDat
     RESDAT& resdat = m_resDatVec[ num ];
     resetResDat(resdat);
 
     resdat.num = num;
     resdat.linestr = line;
 
-    /* get subject */
+    // get subject
     if (num == 1) parseDat(num);
 
-    /* search all responses which are responsed by this line. */
+    // search all responses which are responsed by this line.
     if (GlobalConfig::checkResponsed()) {
 
-        if (parseDat(num) && !checkAbonePrivate(num)) { /* parse line here to get AncList */
+        if (parseDat(num) && !checkAbonePrivate(num)) { // parse line here to get AncList
 
             const int maxRange = 10;
 
@@ -279,10 +279,10 @@ bool DatInfo::copyOneLineToResDat(const QString& line)
    finished loading new dat */      /* private  slot */
 void DatInfo::slotFinishLoad()
 {
-    /* save thread information */
+    // save thread information
     m_threadIndex.saveIndex(m_thread);
 
-    /* re-try by offlaw.cgi */
+    // re-try by offlaw.cgi
     DatManager datManager(m_datUrl);
     if (m_thread->readNum() == 0 && m_access2 == 0
             && datManager.is2chThread()) {
@@ -296,11 +296,11 @@ void DatInfo::slotFinishLoad()
             return ;
         }
     }
-    /* finish loading session & emit signal to the parent object */
+    // finish loading session & emit signal to the parent object
     m_nowLoading = false;
     emit finishLoad();
 
-    /* disconnect signals */
+    // disconnect signals
     disconnect(SIGNAL(receiveData()));
     disconnect(SIGNAL(finishLoad()));
 }
@@ -344,10 +344,10 @@ bool DatInfo::isLoadingNow() const
 void DatInfo::stopLoading() const
 {
 
-    /* Don't lock the mutex here !!!
-       It will cause deadlock , because
-       Access::stopJob() calls HTMLPart::slotFinishLoad() back,
-       then HTMLPart::slotFinishLoad() calls another functions in DatInfo. */
+    // Don't lock the mutex here !!!
+    // It will cause deadlock , because
+    // Access::stopJob() calls HTMLPart::slotFinishLoad() back,
+    // then HTMLPart::slotFinishLoad() calls another functions in DatInfo.
     if (m_access == 0)
         return;
     if (!m_nowLoading)
@@ -586,7 +586,7 @@ QString DatInfo::getTreeByResCore(int rootnum,
 
     if (!reverse) {
 
-        /* collect responses that have anchor to rootnum */
+        // collect responses that have anchor to rootnum
         for (int i = rootnum + 1; i <= m_thread->readNum(); i++) {
             if (checkAbonePrivate(i)) continue;
             if (checkRes(i, rootnum)) {
@@ -595,7 +595,7 @@ QString DatInfo::getTreeByResCore(int rootnum,
             }
         }
 
-    } else { /* collect responses for which rootnum has anchors */
+    } else { // collect responses for which rootnum has anchors
 
         AncList& anclist = m_resDatVec[ rootnum ].anclist;
         for (AncList::iterator it = anclist.begin(); it != anclist.end(); ++it) {
@@ -607,21 +607,21 @@ QString DatInfo::getTreeByResCore(int rootnum,
         }
     }
 
-    /* make HTML document */
+    // make HTML document
     if (count) {
 
         for (QStringList::iterator it = strlists.begin(); it != strlists.end(); ++it) {
             QString tmpstr;
-            if ((*it) == strlists.last()) tmpstr = m_framestr3;  /* 'L' */
-            else tmpstr = m_framestr2;  /* '|-' */
+            if ((*it) == strlists.last()) tmpstr = m_framestr3;  // 'L'
+            else tmpstr = m_framestr2;  // '|-'
 
             retstr += prestr + tmpstr + "<a href=\"#" + (*it) + "\">&gt;&gt;" + (*it) + "</a><br>";
 
-            /* call myself recursively */
+            // call myself recursively
             int tmpnum;
             tmpstr = prestr;
-            if ((*it) == strlists.last()) tmpstr += m_spacestr + m_spacestr + m_spacestr; /* "   " */
-            else tmpstr += m_framestr1 + m_spacestr; /* "| " */
+            if ((*it) == strlists.last()) tmpstr += m_spacestr + m_spacestr + m_spacestr; // "   "
+            else tmpstr += m_framestr1 + m_spacestr; // "| "
             retstr += getTreeByResCore((*it).toInt(), reverse, tmpnum, tmpstr);
             count += tmpnum;
         }
@@ -731,10 +731,10 @@ bool DatInfo::isBroken() const
     int rescode = m_access->responseCode();
     bool invalid = m_access->invalidDataReceived();
 
-    /* see also Access::slotReceiveThreadData() */
+    // see also Access::slotReceiveThreadData()
     if (invalid && (rescode == 200 || rescode == 206)) return true;
 
-    /* maybe "Dat Ochi" */
+    // maybe "Dat Ochi"
     return false;
 }
 
@@ -771,11 +771,11 @@ bool DatInfo::checkWord(const QStringList& stlist,   /* list of keywords */
         QRegExp regexp((*it));
         regexp.setCaseSensitivity(Qt::CaseInsensitive);
 
-        if (checkOr) { /* OR */
+        if (checkOr) { // OR
             if (str_text.indexOf(regexp, 0) != -1) {
                 return true;
             }
-        } else { /* AND */
+        } else { // AND
             if (str_text.indexOf(regexp, 0) == -1) return false;
         }
     }
@@ -858,7 +858,7 @@ bool DatInfo::checkAbonePrivate(int num)
             int refNum = (*it).from;
             int refNum2 = (*it).to;
 
-            /* I don't want to enter loop... */
+            // I don't want to enter loop...
             if (refNum >= num) continue;
             if (refNum2 >= num) refNum2 = num - 1;
 
@@ -945,23 +945,23 @@ void DatInfo::createTitleHtml(RESDAT& resdat, QString& titleHtml)
 
     if (useTableTag) titleHtml += "<table class=\"res_title\"><tr>";
 
-    /* res number */
+    // res number
     if (useTableTag) titleHtml += "<td class=\"res_title_number\">";
     titleHtml += "<a href=\"#write" + QString::number(resdat.num) + "\">";
     titleHtml += QString::number(resdat.num);
     titleHtml += "</a> ";
 
-    /* name & mail address */
+    // name & mail address
     if (useTableTag) titleHtml += "<td class=\"res_title_name\">";
     titleHtml += "<b>" + QString::fromUtf8(KITAUTF8_NAME);
 
-    /* show name with mail address */
+    // show name with mail address
     if (showMailAddress) {
 
         titleHtml += resdat.nameHTML;
         if (!resdat.address.isEmpty()) titleHtml += " [" + resdat.address + ']';
 
-    } else { /* don't show mail address */
+    } else { // don't show mail address
 
         if (resdat.address.isEmpty()) {
 
@@ -980,12 +980,12 @@ void DatInfo::createTitleHtml(RESDAT& resdat, QString& titleHtml)
 
     titleHtml += "</b> ";
 
-    /* date */
+    // date
     if (useTableTag) titleHtml += "<td class=\"res_title_date\">";
     titleHtml += QString::fromUtf8(KITAUTF8_COLON) + resdat.date;
     if (useTableTag) titleHtml += "</td>";
 
-    /* ID */
+    // ID
     if (!resdat.id.isEmpty()) {
 
         if (useTableTag) titleHtml += "<td class=\"res_title_id\">";
@@ -994,7 +994,7 @@ void DatInfo::createTitleHtml(RESDAT& resdat, QString& titleHtml)
         if (useTableTag) titleHtml += "</td>";
     }
 
-    /* BE */
+    // BE
     if (!resdat.be.isEmpty()) {
 
         if (useTableTag) titleHtml += "<td class=\"res_title_be\">";
@@ -1002,7 +1002,7 @@ void DatInfo::createTitleHtml(RESDAT& resdat, QString& titleHtml)
         if (useTableTag) titleHtml += "</td>";
     }
 
-    /* host */
+    // host
     if (!resdat.host.isEmpty()) {
 
         if (useTableTag) titleHtml += "<td class=\"res_title_host\">";