Loading...
Searching...
No Matches
tlv.hpp
Go to the documentation of this file.
/*********************************************************************/
// dar - disk archive - a backup/restoration program
// Copyright (C) 2002-2024 Denis Corbin
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// to contact the author, see the AUTHOR file
/*********************************************************************/
#ifndef TLV_HPP
#define TLV_HPP
#include "memory_file.hpp"
namespace libdar
{
class tlv : public memory_file
{
public:
// constructors & Co.
tlv() { type = 0; };
tlv(generic_file & f) { init(f); };
tlv(const tlv & ref) = default;
tlv(tlv && ref) noexcept = default;
tlv & operator = (const tlv & ref) = default;
tlv & operator = (tlv && ref) noexcept = default;
~tlv() = default;
// methods (dump / setup tlv datastructure to/from file)
void setup(generic_file & f);
void dump(generic_file & f) const;
U_16 get_type() const { return type; };
void set_type(U_16 val) { type = val; };
private:
U_16 type;
void init(generic_file & f);
};
} // end of namespace
#endif
libdar::generic_file
this is the interface class from which all other data transfer classes inherit
Definition generic_file.hpp:77
libdar::memory_file
generic_file stored in memory
Definition memory_file.hpp:41
libdar::tlv
Definition tlv.hpp:44
libdar::tlv::type
U_16 type
set the TLV type
Definition tlv.hpp:66
libdar::tlv::setup
void setup(generic_file &f)
same as the constructor but on an existing object
libdar::tlv::set_type
void set_type(U_16 val)
get the TLV type
Definition tlv.hpp:63
libdar::tlv::dump
void dump(generic_file &f) const
dumps the tlv contents to file
memory_file.hpp
Memory_file is a generic_file class that only uses virtual memory.
libdar
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47