src/lib/ASN1ContentHandler.h
branchv_0
changeset 27 d9cc2d356cdb
parent 26 e39de9b8b3a1
child 35 bf2c546f49d1
--- a/src/lib/ASN1ContentHandler.h	Sun Jul 04 11:37:27 2021 +0200
+++ b/src/lib/ASN1ContentHandler.h	Sun Jul 04 11:51:13 2021 +0200
@@ -91,33 +91,6 @@
 		uint64_t tag;
 	};
 
-	enum class StringType : uint64_t {
-		UTF8String = 0xC,
-		NumericString = 0x12,
-		PrintableString = 0x13,
-		T61String = 0x14,
-		VideotexString = 0x15,
-		IA5String = 0x16,
-		GraphicString = 0x19,
-		VisibleString = 0x1A,
-		GeneralString = 0x1B,
-		UniversalString = 0x1C,
-		CharacterString = 0x1D,
-		BMPString = 0x1E,
-	};
-
-	enum class DateTimeType : uint64_t {
-		UTCTime,
-		GeneralizedTime,
-		Time,
-		Date,
-		TimeOfDay,
-		DateTime,
-		Duration,
-		// TODO: review date/time types
-	};
-
-
 	// TODO: separate implementation of particular types from the interface, separate SPI from API?
 
 	class Integer {
@@ -292,24 +265,24 @@
 
 	virtual void writeCollectionStart(const Header& header) = 0;
 	virtual void writeCollectionEnd() = 0;
-	virtual void writeBoolean(bool value) = 0;
-	virtual void writeNull() = 0;
-	virtual void writeInteger(Integer value) = 0;
+	virtual void writeBoolean(const Header& header, bool value) = 0;
+	virtual void writeNull(const Header& header) = 0;
+	virtual void writeInteger(const Header& header, Integer value) = 0;
 	/**
 	 * @param type original type in ASN.1
 	 * @param value original text converted to UTF-8
 	 */
-	virtual void writeTextString(StringType type, std::string value) = 0;
+	virtual void writeTextString(const Header& header, std::string value) = 0;
 	/**
 	 * @param value arbitrary sequence of octets (bytes), usually not a human-readable text
 	 */
-	virtual void writeOctetString(std::string value) = 0;
+	virtual void writeOctetString(const Header& header, std::string value) = 0;
 	/**
 	 * @param value arbitrary sequence of bits (booleans), usually not a human-readable text
 	 */
-	virtual void writeBitString(std::vector<bool> value) = 0;
-	virtual void writeOID(ObjectIdentifier value) = 0;
-	virtual void writeDateTime(DateTimeType type, DateTime value) = 0;
+	virtual void writeBitString(const Header& header, std::vector<bool> value) = 0;
+	virtual void writeOID(const Header& header, ObjectIdentifier value) = 0;
+	virtual void writeDateTime(const Header& header, DateTime value) = 0;
 	// Object descriptor
 	// virtual void writeReal(float value) = 0;
 	// Enumerated
@@ -345,36 +318,36 @@
 		handlers.forward(&ASN1ContentHandler::writeCollectionEnd);
 	}
 
-	void writeBoolean(bool value) override {
-		handlers.forward(&ASN1ContentHandler::writeBoolean, value);
+	void writeBoolean(const Header& header, bool value) override {
+		handlers.forward(&ASN1ContentHandler::writeBoolean, header, value);
 	}
 
-	void writeNull() override {
-		handlers.forward(&ASN1ContentHandler::writeNull);
+	void writeNull(const Header& header) override {
+		handlers.forward(&ASN1ContentHandler::writeNull, header);
 	}
 
-	void writeInteger(Integer value) override {
-		handlers.forward(&ASN1ContentHandler::writeInteger, value);
+	void writeInteger(const Header& header, Integer value) override {
+		handlers.forward(&ASN1ContentHandler::writeInteger, header, value);
 	}
 
-	void writeTextString(StringType type, std::string value) override {
-		handlers.forward(&ASN1ContentHandler::writeTextString, type, value);
+	void writeTextString(const Header& header, std::string value) override {
+		handlers.forward(&ASN1ContentHandler::writeTextString, header, value);
 	}
 
-	void writeOctetString(std::string value) override {
-		handlers.forward(&ASN1ContentHandler::writeOctetString, value);
+	void writeOctetString(const Header& header, std::string value) override {
+		handlers.forward(&ASN1ContentHandler::writeOctetString, header, value);
 	}
 
-	void writeBitString(std::vector<bool> value) override {
-		handlers.forward(&ASN1ContentHandler::writeBitString, value);
+	void writeBitString(const Header& header, std::vector<bool> value) override {
+		handlers.forward(&ASN1ContentHandler::writeBitString, header, value);
 	}
 
-	void writeOID(ObjectIdentifier value) override {
-		handlers.forward(&ASN1ContentHandler::writeOID, value);
+	void writeOID(const Header& header, ObjectIdentifier value) override {
+		handlers.forward(&ASN1ContentHandler::writeOID, header, value);
 	}
 
-	void writeDateTime(DateTimeType type, DateTime value) override {
-		handlers.forward(&ASN1ContentHandler::writeDateTime, type, value);
+	void writeDateTime(const Header& header, DateTime value) override {
+		handlers.forward(&ASN1ContentHandler::writeDateTime, header, value);
 	}
 
 };