| Disk ARchive 2.7.14 Full featured and portable backup and archiving tool

Loading...
Searching...
No Matches
tlv_list.hpp
Go to the documentation of this file.
1/*********************************************************************/
2// dar - disk archive - a backup/restoration program
3// Copyright (C) 2002-2024 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, see the AUTHOR file
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:
44 tlv_list() {}; // field "contents" is an object initialized by its default constructor
45 tlv_list(generic_file & f) { init(f); };
46 tlv_list(const tlv_list & ref) = default;
47 tlv_list(tlv_list && ref) = default;
48 tlv_list & operator = (const tlv_list & ref) = default;
49 tlv_list & operator = (tlv_list && ref) noexcept = default;
50 ~tlv_list() = default;
51
52 void dump(generic_file & f) const;
53 void read(generic_file & f) { init(f); };
54 U_I size() const { return contents.size(); };
55 tlv & operator[] (U_I item) const;
56 void clear() { contents.clear(); };
57 void add(const tlv & next) { contents.push_back(next); };
58
59 private:
60 std::deque<tlv> contents;
61
62 void init(generic_file & f);
63 };
64
66
67} // end of namespace
68
69
70#endif
generic_file.hpp
class generic_file is defined here as well as class fichier
libdar
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47
tlv.hpp
Generic Type Length Value data structures.