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

Loading...
Searching...
No Matches
user_group_bases.hpp
Go to the documentation of this file.
1/*********************************************************************/
2// dar - disk archive - a backup/restoration program
3// Copyright (C) 2002-2025 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 USER_GROUP_BASES_HPP
27#define USER_GROUP_BASES_HPP
28
29#include "../my_config.h"
30
31#ifdef __DYNAMIC__
32
33extern "C"
34{
35#if MUTEX_WORKS
36#if HAVE_PTHREAD_H
37#include <pthread.h>
38#endif
39#endif
40}
41
42#include <map>
43#include <string>
44#include "infinint.hpp"
45
46namespace libdar
47{
48
51
52 class user_group_bases
53 {
54 public:
55 user_group_bases() : filled(false) {};
56 user_group_bases(const user_group_bases & ref) = default;
57 user_group_bases(user_group_bases && ref) noexcept = default;
58 user_group_bases & operator = (const user_group_bases & ref) = default;
59 user_group_bases & operator = (user_group_bases && ref) noexcept = default;
60 ~user_group_bases() = default;
61
63
65 const std::string & get_username(const infinint & uid) const;
66
67
69
71 const std::string & get_groupname(const infinint & gid) const;
72
73
74 private:
75 bool filled;
76 std::map<infinint, std::string> user_database;
77 std::map<infinint, std::string> group_database;
78
79 void fill() const;
80
81 static const std::string empty_string;
82#if MUTEX_WORKS
84
90 static pthread_mutex_t lock_fill;
91#endif
92 };
93
94
96
97} // end of namespace
98
99#endif
100
101#endif
infinint.hpp
switch module to limitint (32 ou 64 bits integers) or infinint
my_config.h
include macro defined by the configure script and some specific additional ones
libdar
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47