19 #ifndef avro_Parser_hh__
20 #define avro_Parser_hh__
34 template<
class Reader>
35 class Parser :
private boost::noncopyable {
39 explicit Parser(
const InputBuffer &in) : reader_(in) {}
46 reader_.readValue(
null);
51 reader_.readValue(val);
57 reader_.readValue(val);
63 reader_.readValue(val);
69 reader_.readValue(val);
75 reader_.readValue(val);
79 void readString(std::string &val) {
80 reader_.readValue(val);
83 void readBytes(std::vector<uint8_t> &val) {
84 reader_.readBytes(val);
88 void readFixed(uint8_t (&val)[N]) {
89 reader_.readFixed(val);
93 void readFixed(std::array<uint8_t, N> &val) {
94 reader_.readFixed(val);
101 void readRecordEnd() {
102 reader_.readRecordEnd();
105 int64_t readArrayBlockSize() {
106 return reader_.readArrayBlockSize();
109 int64_t readUnion() {
110 return reader_.readUnion();
114 return reader_.readEnum();
117 int64_t readMapBlockSize() {
118 return reader_.readMapBlockSize();
122 friend Type nextType(Parser<ValidatingReader> &p);
123 friend bool currentRecordName(Parser<ValidatingReader> &p, std::string &name);
124 friend bool nextFieldName(Parser<ValidatingReader> &p, std::string &name);
129 inline Type nextType(Parser<ValidatingReader> &p) {
130 return p.reader_.nextType();
133 inline bool currentRecordName(Parser<ValidatingReader> &p, std::string &name) {
134 return p.reader_.currentRecordName(name);
137 inline bool nextFieldName(Parser<ValidatingReader> &p, std::string &name) {
138 return p.reader_.nextFieldName(name);