1 /*
2    mkvmerge -- utility for splicing together matroska files
3    from component media subtypes
4 
5    Distributed under the GPL v2
6    see the file COPYING for details
7    or visit https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
8 
9    Written by Moritz Bunkus <moritz@bunkus.org>.
10 */
11 
12 #pragma once
13 
14 #include "common/common_pch.h"
15 
16 namespace libebml {
17 class EbmlElement;
18 }
19 
20 class mm_io_c;
21 
22 namespace mtx {
23 
24 class doc_type_version_handler_private_c;
25 class doc_type_version_handler_c {
26 protected:
27   MTX_DECLARE_PRIVATE(doc_type_version_handler_private_c)
28 
29   std::unique_ptr<doc_type_version_handler_private_c> const p_ptr;
30 
31   explicit doc_type_version_handler_c(doc_type_version_handler_private_c &p);
32 
33 public:
34   enum class update_result_e {
35     ok_no_update_needed,
36     ok_updated,
37     err_no_head_found,
38     err_not_enough_space,
39     err_read_or_write_failure,
40   };
41 
42 public:
43 
44   doc_type_version_handler_c();
45   virtual ~doc_type_version_handler_c();
46 
47   libebml::EbmlElement &account(libebml::EbmlElement &element, bool with_default = false);
48   libebml::EbmlElement &render(libebml::EbmlElement &element, mm_io_c &file, bool with_default = false);
49 
50   update_result_e update_ebml_head(mm_io_c &file);
51 
52 private:
53   update_result_e do_update_ebml_head(mm_io_c &file);
54 };
55 
56 } // namespace mtx
57