equal
deleted
inserted
replaced
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 */ |
16 */ |
17 #pragma once |
17 #pragma once |
18 |
18 |
19 #include <memory> |
19 #include <memory> |
|
20 #include <stdexcept> |
20 |
21 |
21 #include <libxml++-2.6/libxml++/libxml++.h> |
22 #include <libxml++-2.6/libxml++/libxml++.h> |
22 |
23 |
23 #include "lib/BasicASN1Reader.h" |
24 #include "lib/BasicASN1Reader.h" |
24 #include "lib/GenericASN1ContentHandler.h" |
25 #include "lib/GenericASN1ContentHandler.h" |
51 reader.addHandler(asn1handler); |
52 reader.addHandler(asn1handler); |
52 |
53 |
53 |
54 |
54 try { |
55 try { |
55 // TODO: buffering? (reader itself also buffers) |
56 // TODO: buffering? (reader itself also buffers) |
56 for (char ch = input->get(); input->good(); ch = input->get()) reader.write(&ch, 1); |
57 for (uint8_t b = input->get(); input->good(); b = input->get()) reader.write(&b, 1); |
57 } catch (const relpipe::in::asn1::lib::TransactionalBuffer::WriteBufferOverflowException& e) { |
58 } catch (const relpipe::in::asn1::lib::TransactionalBuffer::WriteBufferOverflowException& e) { |
58 // TODO: avoid leaky abstraction and use different exception |
59 // TODO: avoid leaky abstraction and use different exception |
59 throw relpipe::writer::RelpipeWriterException(L"Transactional buffer for ASN.1 input is too small"); |
60 throw relpipe::writer::RelpipeWriterException(L"Transactional buffer for ASN.1 input is too small"); |
60 } |
61 } |
61 |
62 |