author | František Kučera <franta-hg@frantovo.cz> |
Sat, 12 Jun 2021 19:15:58 +0200 | |
branch | v_0 |
changeset 5 | 15c3221e66af |
parent 4 | 7230e1ea0b07 |
child 8 | d37c1a5d09ce |
permissions | -rw-r--r-- |
1
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
1 |
/** |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
2 |
* Relational pipes |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
3 |
* Copyright © 2021 František Kučera (Frantovo.cz, GlobalCode.info) |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
4 |
* |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
5 |
* This program is free software: you can redistribute it and/or modify |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
7 |
* the Free Software Foundation, version 3 of the License. |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
8 |
* |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
13 |
* |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
15 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
16 |
*/ |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
17 |
#pragma once |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
18 |
|
4
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
19 |
#include <memory> |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
20 |
#include <vector> |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
21 |
|
1
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
22 |
namespace relpipe { |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
23 |
namespace in { |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
24 |
namespace asn1 { |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
25 |
namespace lib { |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
26 |
|
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
27 |
class ASN1ContentHandler { |
4
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
28 |
public: |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
29 |
|
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
30 |
virtual ~ASN1ContentHandler() = default; |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
31 |
|
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
32 |
virtual void abc() = 0; // FIXME: remove dummy method |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
33 |
virtual void def(int a) = 0; // FIXME: remove dummy method |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
34 |
virtual void ghi(int a, int b) = 0; // FIXME: remove dummy method |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
35 |
|
1
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
36 |
}; |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
37 |
|
4
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
38 |
class ASN1ContentHandlerProxy : public ASN1ContentHandler { |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
39 |
private: |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
40 |
std::vector<std::shared_ptr<ASN1ContentHandler>> handlers; |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
41 |
public: |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
42 |
|
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
43 |
void addHandler(std::shared_ptr<ASN1ContentHandler> handler) { |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
44 |
handlers.push_back(handler); |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
45 |
} |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
46 |
|
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
47 |
#define handler for (auto ___h : handlers) ___h |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
48 |
|
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
49 |
void abc() override { |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
50 |
handler->abc(); |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
51 |
} |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
52 |
|
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
53 |
void def(int a) override { |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
54 |
handler->def(a); |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
55 |
} |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
56 |
|
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
57 |
void ghi(int a, int b) override { |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
58 |
handler->ghi(a, b); |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
59 |
} |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
60 |
|
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
61 |
#undef handler |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
62 |
|
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
63 |
}; |
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
64 |
|
7230e1ea0b07
proxy handlers forwarding events to all subordinate handlers
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
65 |
|
1
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
66 |
} |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
67 |
} |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
68 |
} |
2179f13227f4
AbstractParser: AbstractParser, ASN1Reader, ASN1ContentHandler, SAXContentHandler, BasicASN1Reader, DOMBuildingSAXContentHandler, GenericASN1ContentHandler skeletons
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
69 |
} |