Loading...
Searching...
No Matches
user_group_bases.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 USER_GROUP_BASES_HPP
#define USER_GROUP_BASES_HPP
#include "../my_config.h"
#ifdef __DYNAMIC__
extern "C"
{
#if MUTEX_WORKS
#if HAVE_PTHREAD_H
#include <pthread.h>
#endif
#endif
}
#include <map>
#include <string>
#include "infinint.hpp"
namespace libdar
{
class user_group_bases
{
public:
user_group_bases() : filled(false) {};
user_group_bases(const user_group_bases & ref) = default;
user_group_bases(user_group_bases && ref) noexcept = default;
user_group_bases & operator = (const user_group_bases & ref) = default;
user_group_bases & operator = (user_group_bases && ref) noexcept = default;
~user_group_bases() = default;
const std::string & get_username(const infinint & uid) const;
const std::string & get_groupname(const infinint & gid) const;
private:
bool filled;
std::map<infinint, std::string> user_database;
std::map<infinint, std::string> group_database;
void fill() const;
static const std::string empty_string;
#if MUTEX_WORKS
static pthread_mutex_t lock_fill;
#endif
};
} // end of namespace
#endif
#endif
infinint.hpp
switch module to limitint (32 ou 64 bits integers) or infinint
libdar
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47