src/lib/BasicASN1Reader.h
branchv_0
changeset 12 243ef6c91dbb
parent 11 8fbe93f78e2b
child 13 d5e2cb9e31f1
equal deleted inserted replaced
11:8fbe93f78e2b 12:243ef6c91dbb
    16  */
    16  */
    17 #pragma once
    17 #pragma once
    18 
    18 
    19 #include <memory>
    19 #include <memory>
    20 #include <vector>
    20 #include <vector>
       
    21 #include <array>
    21 
    22 
    22 #include "ASN1Reader.h"
    23 #include "ASN1Reader.h"
    23 
    24 
    24 namespace relpipe {
    25 namespace relpipe {
    25 namespace in {
    26 namespace in {
    41 	State state = State::A;
    42 	State state = State::A;
    42 
    43 
    43 	bool started = false;
    44 	bool started = false;
    44 
    45 
    45 	void readNext() {
    46 	void readNext() {
    46 		char type;
    47 		std::array<char, 2> typeAndLength;
    47 		read(&type, 1);
    48 		read(typeAndLength.data(), typeAndLength.size());
    48 		commit();
    49 		commit();
    49 
    50 
    50 		if (!started) {
    51 		if (!started) {
    51 			handlers.writeStreamStart();
    52 			handlers.writeStreamStart();
    52 			started = true;
    53 			started = true;
    53 		}
    54 		}
    54 
    55 
    55 		handlers.writeCollectionStart(ASN1ContentHandler::CollectionType::Sequence);
    56 		handlers.writeCollectionStart(ASN1ContentHandler::CollectionType::Sequence);
    56 		handlers.writeNull();
    57 		handlers.writeNull();
    57 		handlers.writeBoolean(true);
    58 		handlers.writeBoolean(true);
    58 		handlers.writeInteger(type);
    59 		handlers.writeInteger(typeAndLength[0]);
       
    60 		handlers.writeInteger(typeAndLength[1]);
    59 		handlers.writeString(ASN1ContentHandler::StringType::UTF8String, "relational pipes");
    61 		handlers.writeString(ASN1ContentHandler::StringType::UTF8String, "relational pipes");
    60 		handlers.writeCollectionEnd();
    62 		handlers.writeCollectionEnd();
    61 
    63 
    62 		if (state == State::A) {
    64 		if (state == State::A) {
    63 
    65