* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
-
#ifndef KITADATINFO_H
#define KITADATINFO_H
-#include <qobject.h>
+#include <QtCore/QDateTime>
+#include <QtCore/QList>
+#include <QtCore/QObject>
+#include <QtCore/QVector>
+
#include <kurl.h>
-#include <qvaluevector.h>
-#include <qdatetime.h>
-#include <qmutex.h>
+
+#include "threadindex.h"
class QStringList;
/* return val of DatInfo::getHTML() */
enum{
- KITA_HTML_NOTPARSED,
- KITA_HTML_NORMAL,
- KITA_HTML_ABONE,
- KITA_HTML_BROKEN
+ HTML_NOTPARSED,
+ HTML_NORMAL,
+ HTML_ABONE,
+ HTML_BROKEN
};
int to;
};
-typedef QValueList<ANCNUM> AncList;
+typedef QList<ANCNUM> AncList;
/* Data Base of response */
/* Is this res responsed by other one? */
bool isResponsed;
};
-typedef QValueVector<RESDAT> ResDatVec;
+typedef QVector<RESDAT> ResDatVec;
namespace Kita
/*-----------------------*/
- class DatInfo : public QObject
+ class KDE_EXPORT DatInfo : public QObject
{
Q_OBJECT
Thread* m_thread;
/* basic information */
- KURL m_datURL;
+ KUrl m_datUrl;
+ ThreadIndex m_threadIndex;
bool m_broken;
ResDatVec m_resDatVec;
bool m_isOpened;
public:
DatInfo();
- DatInfo( const KURL& url );
+ DatInfo(const KUrl& url);
~DatInfo();
void init();
- const KURL& url();
+ const KUrl& url() const;
/* for caching */
- bool updateCache( const QObject* parent );
- int getResponseCode();
- int getServerTime();
+ bool updateCache(const QObject* parent);
+ int getResponseCode() const;
+ int getServerTime() const;
bool deleteCache();
- bool isLoadingNow();
- void stopLoading();
+ bool isLoadingNow() const;
+ void stopLoading() const;
/* string data */
- const QString& getDat( int num );
- const QString& getId( int num );
- QString getPlainName( int num );
- QString getPlainTitle( int num );
- QString getPlainBody( int num );
+ QString getDat(int num);
+ QString getId(int num);
+ QString getPlainName(int num);
+ QString getPlainTitle(int num);
+ QString getPlainBody(int num);
/* HTML data */
- int getHTML( int num, bool checkAbone, QString& titleHTML, QString& bodyHTML );
- QString getHTMLString( int startnum, int endnum, bool checkAbone = TRUE );
- QString getHtmlByID( const QString& strid, int &count );
- QString getTreeByRes( const int rootnum, int& count );
- QString getTreeByResReverse( const int rootnum, int& count );
+ int getHTML(int num, bool checkAbone, QString& titleHTML,
+ QString& bodyHTML);
+ QString getHTMLString(int startnum, int endnum,
+ bool checkAbone = true);
+ QString getHtmlById(const QString& strid, int &count);
+ QString getTreeByRes(int rootnum, int& count);
+ QString getTreeByResReverse(int rootnum, int& count);
/* numerical data */
- int getResNum();
- int getReadNum();
- int getViewPos();
- int getNumByID( const QString& strid );
- int getDatSize();
-
- /* several informations */
- const bool isResponsed ( int num ) const;
- bool isResValid( int num );
- bool isBroken();
- bool isResBroken( int num );
- bool checkID( const QString& strid, int num );
- bool checkWord( QStringList& stlist, int num, bool checkOR );
- bool isOpened();
- void setIsOpened( bool isOpened );
+ int getResNum() const;
+ int getReadNum() const;
+ int getViewPos() const;
+ int getNumById(const QString& strid);
+ int getDatSize() const;
+
+ /* several information */
+ bool isResponsed (int num) const;
+ bool isResValid(int num);
+ bool isBroken() const;
+ bool isResBroken(int num);
+ bool checkId(const QString& strid, int num);
+ bool checkWord(const QStringList& stlist, int num, bool checkOr);
+ bool isOpened() const;
+ void setOpened(bool isOpened);
/* abone check */
- bool checkAbone( int num );
+ bool checkAbone(int num);
void resetAbone();
/*-------------------------*/
private:
- void initPrivate( bool loadCache = TRUE );
- void resetResDat( RESDAT& resdat );
- void increaseResDatVec( int delta );
+ void initPrivate(bool loadCache = true);
+ void resetResDat(RESDAT& resdat) const;
+ void increaseResDatVec(int delta);
void deleteAccessJob();
/* copy data */
- bool copyOneLineToResDat( const QString& line );
+ bool copyOneLineToResDat(const QString& line);
/* HTML data */
- int getHTMLPrivate( int num, bool checkAbone, QString& titleHTML, QString& bodyHTML );
- void getHTMLofOneRes( int num, bool checkAbone, QString& html );
- QString getTreeByResPrivate( const int rootnum, bool reverse, int& count );
- QString getTreeByResCore( const int rootnum, bool reverse, int& count, QString prestr );
- bool checkRes( const int num, const int target );
+ int getHTMLPrivate(int num, bool checkAbone, QString& titleHTML,
+ QString& bodyHTML);
+ void getHtmlOfOneRes(int num, bool checkAbone, QString& html);
+ QString getTreeByResPrivate(int rootnum, bool reverse, int& count);
+ QString getTreeByResCore(int rootnum, bool reverse, int& count,
+ const QString& prestr);
+ bool checkRes(int num, int target);
/* for abone */
void resetAbonePrivate();
- bool checkAbonePrivate( int num );
- bool checkAboneCore( const QString& str, QStringList strlist );
+ bool checkAbonePrivate(int num);
+ bool checkAboneCore(const QString& str, const QStringList& strlist)
+ const;
+
+ /* parsing functions */
+ bool parseDat(int num);
- /* parsing funtions */
- bool parseDat( int num );
+ void createTitleHtml(RESDAT& resdat, QString& titleHtml);
+ DatInfo(const DatInfo&);
+ DatInfo& operator=(const DatInfo&);
/*----------------------------*/
private slots:
- void slotReceiveData( const QStringList& lineList );
+ void slotReceiveData(const QStringList& lineList);
void slotFinishLoad();
signals: