author | František Kučera <franta-hg@frantovo.cz> |
Sun, 30 Sep 2018 20:54:35 +0200 | |
branch | v_0 |
changeset 20 | b13e7ed9eea3 |
parent 18 | 16784291982f |
child 29 | 0f9f7d6564cd |
permissions | -rw-r--r-- |
13
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
1 |
#pragma once |
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
2 |
|
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
3 |
#include <QObject> |
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
4 |
|
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
5 |
#include <relpipe/reader/typedefs.h> |
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
6 |
#include <relpipe/reader/TypeId.h> |
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
7 |
#include <relpipe/reader/handlers/RelationalReaderStringHandler.h> |
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
8 |
#include <relpipe/reader/handlers/AttributeMetadata.h> |
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
9 |
|
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
10 |
using namespace relpipe::reader; |
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
11 |
using namespace relpipe::reader::handlers; |
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
12 |
|
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
13 |
class QtRelationalReaderStringHadler : public QObject, public RelationalReaderStringHadler { |
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
14 |
|
20
b13e7ed9eea3
better use of signal/slot mechanism, threads, Qt::ConnectionType::QueuedConnection
František Kučera <franta-hg@frantovo.cz>
parents:
18
diff
changeset
|
15 |
Q_OBJECT |
b13e7ed9eea3
better use of signal/slot mechanism, threads, Qt::ConnectionType::QueuedConnection
František Kučera <franta-hg@frantovo.cz>
parents:
18
diff
changeset
|
16 |
public: |
b13e7ed9eea3
better use of signal/slot mechanism, threads, Qt::ConnectionType::QueuedConnection
František Kučera <franta-hg@frantovo.cz>
parents:
18
diff
changeset
|
17 |
QtRelationalReaderStringHadler(QObject* parent) : QObject(parent) { |
13
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
18 |
} |
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
19 |
|
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
20 |
virtual ~QtRelationalReaderStringHadler() { |
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
21 |
} |
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
22 |
|
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
23 |
virtual void startRelation(string_t name, std::vector<AttributeMetadata> attributes) override { |
20
b13e7ed9eea3
better use of signal/slot mechanism, threads, Qt::ConnectionType::QueuedConnection
František Kučera <franta-hg@frantovo.cz>
parents:
18
diff
changeset
|
24 |
emit startRelationReceived(name, attributes); |
13
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
25 |
} |
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
26 |
|
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
27 |
virtual void attribute(const string_t& value) override { |
20
b13e7ed9eea3
better use of signal/slot mechanism, threads, Qt::ConnectionType::QueuedConnection
František Kučera <franta-hg@frantovo.cz>
parents:
18
diff
changeset
|
28 |
emit attributeReceived(value); |
13
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
29 |
}; |
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
30 |
|
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
31 |
virtual void endOfPipe() override { |
20
b13e7ed9eea3
better use of signal/slot mechanism, threads, Qt::ConnectionType::QueuedConnection
František Kučera <franta-hg@frantovo.cz>
parents:
18
diff
changeset
|
32 |
emit endOfPipeReceived(); |
13
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
33 |
}; |
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
34 |
|
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
35 |
signals: |
20
b13e7ed9eea3
better use of signal/slot mechanism, threads, Qt::ConnectionType::QueuedConnection
František Kučera <franta-hg@frantovo.cz>
parents:
18
diff
changeset
|
36 |
void startRelationReceived(const string_t name, std::vector<AttributeMetadata> attributes); |
b13e7ed9eea3
better use of signal/slot mechanism, threads, Qt::ConnectionType::QueuedConnection
František Kučera <franta-hg@frantovo.cz>
parents:
18
diff
changeset
|
37 |
void attributeReceived(const string_t value); |
b13e7ed9eea3
better use of signal/slot mechanism, threads, Qt::ConnectionType::QueuedConnection
František Kučera <franta-hg@frantovo.cz>
parents:
18
diff
changeset
|
38 |
void endOfPipeReceived(); |
13
c84042d014c9
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
39 |
}; |