summaryrefslogtreecommitdiff
path: root/sax/inc/sax_decoder_factory.hh
blob: 80f1af3c1a40bcd8aef84ac3342a1b46da995006 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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