OSDN Git Service

refactoring.
[kita/kita.git] / kita / src / libkita / thread.h
1 /***************************************************************************
2 *   Copyright (C) 2003 by Hideki Ikemoto                                  *
3 *   ikemo@users.sourceforge.jp                                            *
4 *                                                                         *
5 *   This program is free software; you can redistribute it and/or modify  *
6 *   it under the terms of the GNU General Public License as published by  *
7 *   the Free Software Foundation; either version 2 of the License, or     *
8 *   (at your option) any later version.                                   *
9 ***************************************************************************/
10
11 #ifndef KITATHREAD_H
12 #define KITATHREAD_H
13
14 #include <qobject.h>
15 #include <qxml.h>
16 #include <qdict.h>
17
18 #include <stdio.h>
19
20 namespace KIO
21 {
22     class Job;
23 }
24
25 class KURL;
26
27 namespace Kita
28 {
29     /**
30     @author Hideki Ikemoto
31     */
32     class Thread
33     {
34         Thread( const QString& datURL, const QString& threadName = QString::null );
35
36     protected:
37         Thread();
38
39     public:
40         ~Thread();
41
42         const QString& datURL() const;
43         const QString& name() const;
44
45         static Thread* getByURL( const QString& datURL );
46         static Thread* getByURLNew( const KURL& datURL );
47         static void setName( const QString& datURL, QString threadName );
48         static void replace( const QString& fromURL, const QString& toURL );
49     private:
50         QString m_datURL;
51         QString m_threadName;
52         static QDict<Thread>* m_threadDict;
53     };
54
55     class NullThread : public Thread
56     {
57     public:
58         NullThread();
59         ~NullThread();
60     };
61 }
62
63 #endif