svnno****@sourc*****
svnno****@sourc*****
2009年 8月 9日 (日) 17:02:09 JST
Revision: 2537 http://sourceforge.jp/projects/kita/svn/view?view=rev&revision=2537 Author: nogu Date: 2009-08-09 17:02:09 +0900 (Sun, 09 Aug 2009) Log Message: ----------- style Modified Paths: -------------- kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp Modified: kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp 2009-08-09 07:55:18 UTC (rev 2536) +++ kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp 2009-08-09 08:02:09 UTC (rev 2537) @@ -184,8 +184,10 @@ DatInfo emits the finishLoad signal to the parent object */ /* public */ bool DatInfo::updateCache(const QObject* parent) { - if (m_access == 0) return false; - if (m_nowLoading) return false; + if (m_access == 0) + return false; + if (m_nowLoading) + return false; m_nowLoading = true; @@ -214,7 +216,8 @@ /* copy lines to buffer */ int count = lineList.count(); - for (int i = 0; i < count ; ++i) copyOneLineToResDat(lineList[ i ]); + for (int i = 0; i < count ; ++i) + copyOneLineToResDat(lineList[ i ]); emit receiveData(); } @@ -304,25 +307,22 @@ /* public */ int DatInfo::getResponseCode() const { - if (m_access == 0) return 0; - - return m_access->responseCode(); + return (m_access == 0) ? 0 : m_access->responseCode(); } /* public */ int DatInfo::getServerTime() const { - if (m_access == 0) return 0; - - return m_access->serverTime(); + return (m_access == 0) ? 0 : m_access->serverTime(); } /* public */ bool DatInfo::deleteCache() { - if (m_nowLoading) return false; + if (m_nowLoading) + return false; initPrivate(false); @@ -346,8 +346,10 @@ 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) return ; + if (m_access == 0) + return; + if (!m_nowLoading) + return; m_access->stopJob(); } @@ -359,24 +361,18 @@ QString DatInfo::getDat(int num) { - if (!parseDat(num)) return QString(); - - return m_resDatVec[ num ].linestr; + return (!parseDat(num)) ? QString() : m_resDatVec[ num ].linestr; } QString DatInfo::getId(int num) { - if (!parseDat(num)) return QString(); - - return m_resDatVec[ num ].id; + return (!parseDat(num)) ? QString() : m_resDatVec[ num ].id; } /* plain strings of name */ QString DatInfo::getPlainName(int num) { - if (!parseDat(num)) return QString(); - - return m_resDatVec[ num ].name; + return (!parseDat(num)) ? QString() : m_resDatVec[ num ].name; } @@ -518,7 +514,9 @@ if (getHTMLPrivate(num, checkAbone, titleHTML, bodyHTML) == HTML_NOTPARSED) return; - if (m_resDatVec[ num ].isResponsed) titleHTML.replace("<a href=\"#write", "<a class=\"coloredLink\" href=\"#write"); + if (m_resDatVec[ num ].isResponsed) + titleHTML.replace( + "<a href=\"#write", "<a class=\"coloredLink\" href=\"#write"); html += "<div class=\"pop_res_title\">" + titleHTML + "</div>"; html += "<div class=\"pop_res_body\">" + bodyHTML + "</div>"; } @@ -575,8 +573,10 @@ QString DatInfo::getTreeByResCore(int rootnum, bool reverse /* reverse search */, int& count, const QString& prestr) { - if (!parseDat(rootnum)) return QString(); - if (checkAbonePrivate(rootnum)) return QString(); + if (!parseDat(rootnum)) + return QString(); + if (checkAbonePrivate(rootnum)) + return QString(); QString retstr; count = 0; @@ -638,13 +638,16 @@ bool DatInfo::checkRes(int num, int target) { const int range = 20; - if (!parseDat(num)) return false; + if (!parseDat(num)) + return false; AncList& anclist = m_resDatVec[ num ].anclist; for (AncList::iterator it = anclist.begin(); it != anclist.end(); ++it) { - if ((*it).to - (*it).from > range) continue; - if (target >= (*it).from && target <= (*it).to) return true; + if ((*it).to - (*it).from > range) + continue; + if (target >= (*it).from && target <= (*it).to) + return true; } return false; @@ -697,9 +700,7 @@ /* public */ int DatInfo::getDatSize() const { - if (m_access == 0) return 0; - - return m_access->dataSize(); + return (m_access == 0) ? 0 : m_access->dataSize(); } @@ -719,9 +720,11 @@ /* public */ bool DatInfo::isBroken() const { - if (m_broken) return m_broken; + if (m_broken) + return m_broken; - if (m_access == 0) return false; + if (m_access == 0) + return false; int rescode = m_access->responseCode(); bool invalid = m_access->invalidDataReceived(); @@ -736,17 +739,17 @@ /* public */ bool DatInfo::isResBroken(int num) { - if (!parseDat(num)) return false; - - return m_resDatVec[ num ].broken; + return (!parseDat(num)) ? false : m_resDatVec[ num ].broken; } /* ID = strid ? */ /* public */ bool DatInfo::checkId(const QString& strid, int num) { - if (!parseDat(num)) return false; + if (!parseDat(num)) + return false; - if (m_resDatVec[ num ].id == strid) return true; + if (m_resDatVec[ num ].id == strid) + return true; return false; } @@ -756,7 +759,8 @@ bool DatInfo::checkWord(const QStringList& stlist, /* list of keywords */ int num, bool checkOr /* AND or OR search */) { - if (!parseDat(num)) return false; + if (!parseDat(num)) + return false; QString str_text = m_resDatVec[ num ].bodyHTML; @@ -895,15 +899,19 @@ /* This function parses the raw data by parseResDat() */ /* private */ bool DatInfo::parseDat(int num) { - if (num <= 0 || m_thread->readNum() < num) return false; - if (m_resDatVec[ num ].parsed) return true; + if (num <= 0 || m_thread->readNum() < num) + return false; + if (m_resDatVec[ num ].parsed) + return true; // qDebug("parseDat %d",num); QString subject; parseResDat(m_resDatVec[ num ], subject); - if (num == 1 && !subject.isEmpty()) m_thread->setThreadName(subject); - if (m_resDatVec[ num ].broken) m_broken = true; + if (num == 1 && !subject.isEmpty()) + m_thread->setThreadName(subject); + if (m_resDatVec[ num ].broken) + m_broken = true; return true; }