OSDN Git Service

ソケットの終了処理追加。
[wordring-tm/wordring-tm.git] / proxy / tmservice.h
1 #ifndef TMSERVICE_H
2 #define TMSERVICE_H
3
4 #include "language.h"
5
6 #include <QObject>
7 #include <QString>
8 #include <QByteArray>
9 #include <QJsonArray>
10 #include <QMap>
11
12 #include <QIcon>
13
14 #include <QMutex>
15
16 QT_BEGIN_NAMESPACE
17 QT_END_NAMESPACE
18
19 class Language;
20 class Settings;
21
22 namespace TM
23 {
24
25 class Database;
26
27 class Service : public QObject
28 {
29         Q_OBJECT
30 public:
31         Service(Settings *settings, QObject *parent = 0);
32
33         void load_languages(QString const &path);
34
35         Text::pointer divide_into_sentences(int code, QString string);
36         Text::pointer divide_into_words(int code, Text::pointer sentence);
37
38         void insert_sentence(int site_id, int scode, Text::pointer ssentence,
39                                         int tcode, Text::pointer tsentence, QJsonArray json);
40         bool find_sentence(int site_id, int scode, Text::pointer ssentence, int tcode,
41                                         Text::pointer *tsentence, QJsonArray *json);
42
43 signals:
44         /*!
45          * \brief 言語プラグインが読み込まれたときに発火するシグナルです。
46          * \param code 言語コードです。
47          * \param name 言語名です。
48          * \param icon 言語を表現するアイコンです。
49          */
50         void languageLoaded(int code, QString name, QIcon icon);
51
52 public slots:
53
54 public:
55         QMutex m_mutex;
56
57         Settings *m_settings;
58         QMap<int, Language*> m_languages;
59         Database *m_database;
60 };
61
62 } // namespace TM
63
64 #endif // TMSERVICE_H