summaryrefslogtreecommitdiff
path: root/sax/inc/sax_decoder_factory.hh
diff options
context:
space:
mode:
Diffstat (limited to 'sax/inc/sax_decoder_factory.hh')
-rw-r--r--sax/inc/sax_decoder_factory.hh35
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