equal
deleted
inserted
replaced
|
1 /** |
|
2 * Relational pipes |
|
3 * Copyright © 2021 František Kučera (Frantovo.cz, GlobalCode.info) |
|
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, version 3 of the License. |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU General Public License |
|
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 */ |
|
17 #pragma once |
|
18 |
|
19 #include <memory> |
|
20 |
|
21 #include "ASN1Reader.h" |
|
22 |
|
23 namespace relpipe { |
|
24 namespace in { |
|
25 namespace asn1 { |
|
26 namespace lib { |
|
27 |
|
28 /** |
|
29 * Reads ASN.1 data encoded as BER (DER, CER). |
|
30 */ |
|
31 class BasicASN1Reader : public ASN1Reader { |
|
32 public: |
|
33 virtual ~BasicASN1Reader() = default; |
|
34 |
|
35 virtual void addHandler(std::shared_ptr<ASN1ContentHandler> handler) { |
|
36 }; |
|
37 |
|
38 virtual void process() { |
|
39 }; |
|
40 |
|
41 static ASN1Reader* create(std::istream& input) { |
|
42 return new BasicASN1Reader(); |
|
43 } |
|
44 |
|
45 private: |
|
46 |
|
47 enum class State { |
|
48 A, |
|
49 B, |
|
50 C |
|
51 }; |
|
52 |
|
53 State state = State::A; |
|
54 |
|
55 protected: |
|
56 |
|
57 void update() override { |
|
58 |
|
59 if (state == State::A) { |
|
60 |
|
61 } else if (state == State::B) { |
|
62 |
|
63 } else if (state == State::C) { |
|
64 |
|
65 } |
|
66 |
|
67 |
|
68 |
|
69 } |
|
70 |
|
71 }; |
|
72 |
|
73 } |
|
74 } |
|
75 } |
|
76 } |