diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2023-06-13 10:07:16 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2023-06-13 10:07:16 +0200 |
| commit | fc4547b412e28164af1bf8981234c6af959ccc0b (patch) | |
| tree | 061253e7a4f6abaca282223b36d10f0bed8cad23 /sax/inc/sax_decoder_factory.hh | |
WIP
Diffstat (limited to 'sax/inc/sax_decoder_factory.hh')
| -rw-r--r-- | sax/inc/sax_decoder_factory.hh | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/sax/inc/sax_decoder_factory.hh b/sax/inc/sax_decoder_factory.hh new file mode 100644 index 0000000..80f1af3 --- /dev/null +++ b/sax/inc/sax_decoder_factory.hh @@ -0,0 +1,35 @@ +#ifndef SAX_DECODER_FACTORY_HH +#define SAX_DECODER_FACTORY_HH + +#include <memory> +#include <string> + +namespace modxml { +namespace sax { + +class Decoder; + +/** + * Factory for decoders. You can give one to ProcessBuilder. + */ +class DecoderFactory { + public: + virtual ~DecoderFactory() = default; + + /** + * If encoding is supported, return a decoder for that encoding. + * Return nullptr if not supported and Processor will return + * UNKNOWN_ENCODING error. + * Note that encoding value isn't cleaned up or validated in any way, it is + * reported EXACTLY as found (even if not valid per XML spec). + */ + virtual std::unique_ptr<Decoder> create(std::string const& encoding) = 0; + + protected: + DecoderFactory() = default; +}; + +} // namespace sax +} // namespace modxml + +#endif // SAX_DECODER_FACTORY_HH |
