BasicASN1Reader: read from the buffer and commit v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sat, 19 Jun 2021 22:43:00 +0200
branchv_0
changeset 11 8fbe93f78e2b
parent 10 6904e4448807
child 12 243ef6c91dbb
BasicASN1Reader: read from the buffer and commit
src/lib/BasicASN1Reader.h
--- a/src/lib/BasicASN1Reader.h	Sat Jun 19 12:59:07 2021 +0200
+++ b/src/lib/BasicASN1Reader.h	Sat Jun 19 22:43:00 2021 +0200
@@ -42,9 +42,10 @@
 
 	bool started = false;
 
-protected:
-
-	void update() override {
+	void readNext() {
+		char type;
+		read(&type, 1);
+		commit();
 
 		if (!started) {
 			handlers.writeStreamStart();
@@ -54,7 +55,7 @@
 		handlers.writeCollectionStart(ASN1ContentHandler::CollectionType::Sequence);
 		handlers.writeNull();
 		handlers.writeBoolean(true);
-		handlers.writeInteger(123);
+		handlers.writeInteger(type);
 		handlers.writeString(ASN1ContentHandler::StringType::UTF8String, "relational pipes");
 		handlers.writeCollectionEnd();
 
@@ -67,6 +68,12 @@
 		}
 	}
 
+protected:
+
+	void update() override {
+		while (true) readNext();
+	}
+
 public:
 
 	void close() override {