# ea.hpp

Go to the documentation of this file.

    00001 /*********************************************************************/
    00002 // dar - disk archive - a backup/restoration program
    00003 // Copyright (C) 2002-2052 Denis Corbin
    00004 //
    00005 // This program is free software; you can redistribute it and/or
    00006 // modify it under the terms of the GNU General Public License
    00007 // as published by the Free Software Foundation; either version 2
    00008 // of the License, or (at your option) any later version.
    00009 //
    00010 // This program is distributed in the hope that it will be useful,
    00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00013 // GNU General Public License for more details.
    00014 //
    00015 // You should have received a copy of the GNU General Public License
    00016 // along with this program; if not, write to the Free Software
    00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    00018 //
    00019 // to contact the author : dar.linux@free.fr
    00020 /*********************************************************************/
    00021 // $Id: ea.hpp,v 1.16 2005/05/08 12:12:00 edrusb Rel $
    00022 //
    00023 /*********************************************************************/
    00024
    00028
    00029
    00030 #ifndef EA_HPP
    00031 #define EA_HPP
    00032
    00033 #include "../my_config.h"
    00034 #include <vector>
    00035 #include <string>
    00036 #include "infinint.hpp"
    00037 #include "generic_file.hpp"
    00038 #include "special_alloc.hpp"
    00039 #include "mask.hpp"
    00040 #include "header_version.hpp"
    00041
    00042 namespace libdar
    00043 {
    00044
    00045     struct ea_entry
    00046     {
    00047         std::string key, value;
    00048
    00049         ea_entry() { key = value = ""; };
    00050         ea_entry(user_interaction & dialog, generic_file & f, const dar_version & edit);
    00051
    00052         void dump(generic_file & f) const;
    00053     };
    00054
    00055     class ea_attributs
    00056     {
    00057     public:
    00058         ea_attributs() { alire = attr.begin(); };
    00059         ea_attributs(user_interaction & dialog, generic_file & f, const dar_version & edit);
    00060         ea_attributs(const ea_attributs & ref);
    00061
    00062         void dump(generic_file & f) const;
    00063         void add(const ea_entry &x) { attr.push_back(x); };
    00064         void reset_read() const;
    00065         bool read(ea_entry & x) const;
    00066         infinint size() const { return attr.size(); };
    00067         void clear() { attr.clear(); alire = attr.begin(); };
    00068         bool find(const std::string &key, std::string & found_value) const;
    00069         bool diff(const ea_attributs & other, const mask & filter) const;
    00070
    00071 #ifdef LIBDAR_SPECIAL_ALLOC
    00072         USE_SPECIAL_ALLOC(ea_attributs);
    00073 #endif
    00074
    00075     private:
    00076         std::vector<ea_entry> attr;
    00077         std::vector<ea_entry>::iterator alire;
    00078     };
    00079
    00080 } // end of namespace
    00081
    00082 #endif