• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2016 The WebM project authors. All Rights Reserved.
2 //
3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the LICENSE file in the root of the source
5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS.  All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree.
8 #ifndef SRC_SIZE_PARSER_H_
9 #define SRC_SIZE_PARSER_H_
10 
11 #include <cstdint>
12 
13 #include "src/parser.h"
14 #include "src/var_int_parser.h"
15 #include "webm/callback.h"
16 #include "webm/reader.h"
17 #include "webm/status.h"
18 
19 namespace webm {
20 
21 class SizeParser : public Parser {
22  public:
23   SizeParser() = default;
24   SizeParser(SizeParser&&) = default;
25   SizeParser& operator=(SizeParser&&) = default;
26 
27   SizeParser(const SizeParser&) = delete;
28   SizeParser& operator=(const SizeParser&) = delete;
29 
30   Status Feed(Callback* callback, Reader* reader,
31               std::uint64_t* num_bytes_read) override;
32 
33   // Gets the parsed size. This must not be called until the parse had been
34   // successfully completed.
35   std::uint64_t size() const;
36 
37  private:
38   VarIntParser uint_parser_;
39 };
40 
41 }  // namespace webm
42 
43 #endif  // SRC_SIZE_PARSER_H_
44