131 if (sequenceLevel) throw cli::RelpipeCLIException(L"Unable to close ASN1Writer because there are not ended sequences.", cli::CLI::EXIT_CODE_UNEXPECTED_ERROR); // should not happen, error in the program |
136 if (sequenceLevel) throw cli::RelpipeCLIException(L"Unable to close ASN1Writer because there are not ended sequences.", cli::CLI::EXIT_CODE_UNEXPECTED_ERROR); // should not happen, error in the program |
132 } |
137 } |
133 |
138 |
134 void writeStartSequence() { |
139 void writeStartSequence() { |
135 sequenceLevel++; |
140 sequenceLevel++; |
136 output.put('\x30'); |
141 writeIdentifier(TagClass::Universal, PC::Constructed, UniversalType::Sequence); |
137 output.put('\x80'); |
142 writeLengthIndefinite(); |
138 } |
143 } |
139 |
144 |
140 void writeEndSequence() { |
145 void writeEndSequence() { |
141 if (sequenceLevel == 0) throw cli::RelpipeCLIException(L"Unable to writeEndSequence() if not sequence is currently started.", cli::CLI::EXIT_CODE_UNEXPECTED_ERROR); // should not happen, error in the program |
146 if (sequenceLevel == 0) throw cli::RelpipeCLIException(L"Unable to writeEndSequence() if not sequence is currently started.", cli::CLI::EXIT_CODE_UNEXPECTED_ERROR); // should not happen, error in the program |
142 sequenceLevel--; |
147 sequenceLevel--; |
143 output.put('\x00'); |
148 writeIdentifier(TagClass::Universal, PC::Primitive, UniversalType::EndOfContent); |
144 output.put('\x00'); |
149 writeLength(0u); |
145 } |
150 } |
146 |
151 |
147 void writeBoolean(const boolean_t& value) { |
152 void writeBoolean(const boolean_t& value) { |
148 output.put('\x01'); |
153 writeIdentifier(TagClass::Universal, PC::Primitive, UniversalType::Boolean); |
149 output.put('\x01'); |
154 writeLength(1u); |
150 output.put(value ? '\xFF' : '\x00'); |
155 output.put(value ? '\xFF' : '\x00'); |
151 |
156 |
152 } |
157 } |
153 |
158 |
154 void writeInteger(const integer_t& value) { |
159 void writeInteger(const integer_t& value) { |