19 #ifndef avro_Parser_hh__
20 #define avro_Parser_hh__
32 template<
class Reader>
33 class Parser :
private boost::noncopyable
39 explicit Parser(
const InputBuffer &in) :
50 reader_.readValue(null);
55 reader_.readValue(val);
61 reader_.readValue(val);
67 reader_.readValue(val);
73 reader_.readValue(val);
79 reader_.readValue(val);
83 void readString(std::string &val) {
84 reader_.readValue(val);
87 void readBytes(std::vector<uint8_t> &val) {
88 reader_.readBytes(val);
92 void readFixed(uint8_t (&val)[N]) {
93 reader_.readFixed(val);
97 void readFixed(boost::array<uint8_t, N> &val) {
98 reader_.readFixed(val);
102 reader_.readRecord();
105 void readRecordEnd() {
106 reader_.readRecordEnd();
109 int64_t readArrayBlockSize() {
110 return reader_.readArrayBlockSize();
113 int64_t readUnion() {
114 return reader_.readUnion();
118 return reader_.readEnum();
121 int64_t readMapBlockSize() {
122 return reader_.readMapBlockSize();
127 friend Type nextType(Parser<ValidatingReader> &p);
128 friend bool currentRecordName(Parser<ValidatingReader> &p, std::string &name);
129 friend bool nextFieldName(Parser<ValidatingReader> &p, std::string &name);
135 inline Type nextType(Parser<ValidatingReader> &p) {
136 return p.reader_.nextType();
139 inline bool currentRecordName(Parser<ValidatingReader> &p, std::string &name) {
140 return p.reader_.currentRecordName(name);
143 inline bool nextFieldName(Parser<ValidatingReader> &p, std::string &name) {
144 return p.reader_.nextFieldName(name);
Type
The "type" for the schema.
Definition: Types.hh:31
A bunch of templates and specializations for encoding and decoding specific types.
Definition: AvroParse.hh:31
Class that wraps a reader or ValidatingReade with an interface that uses explicit get* names instead ...
Definition: Parser.hh:33
define a type to identify Null in template functions
Definition: Types.hh:102
A ValidSchema is basically a non-mutable Schema that has passed some minumum of sanity checks...
Definition: ValidSchema.hh:40
Parser(const ValidSchema &schema, const InputBuffer &in)
Constructor only works with ValidatingWriter.
Definition: Parser.hh:44