Disk ARchive  2.6.8
Full featured and portable backup and archiving tool
tlv_list.hpp
Go to the documentation of this file.
1 /*********************************************************************/
2 // dar - disk archive - a backup/restoration program
3 // Copyright (C) 2002-2020 Denis Corbin
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // to contact the author : http://dar.linux.free.fr/email.html
20 /*********************************************************************/
21 
25 
26 #ifndef TLV_LIST_HPP
27 #define TLV_LIST_HPP
28 
29 #include "tlv.hpp"
30 #include "generic_file.hpp"
31 
32 #include <deque>
33 
34 namespace libdar
35 {
36 
39 
40  class tlv_list
41  {
42  public:
43  tlv_list() = default;
44  tlv_list(generic_file & f) { init(f); };
45  tlv_list(const tlv_list & ref) = default;
46  tlv_list(tlv_list && ref) = default;
47  tlv_list & operator = (const tlv_list & ref) = default;
48  tlv_list & operator = (tlv_list && ref) noexcept = default;
49  ~tlv_list() = default;
50 
51  void dump(generic_file & f) const;
52  void read(generic_file & f) { init(f); };
53  U_I size() const { return contents.size(); };
54  tlv & operator[] (U_I item) const;
55  void clear() { contents.clear(); };
56  void add(const tlv & next) { contents.push_back(next); };
57 
58  private:
59  std::deque<tlv> contents;
60 
61  void init(generic_file & f);
62  };
63 
65 
66 } // end of namespace
67 
68 
69 #endif
tlv.hpp
Generic Type Length Value data structures.
generic_file.hpp
class generic_file is defined here as well as class fichier
libdar
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:46