ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
ftools.hpp
Go to the documentation of this file.
1/** ************************************************************************************************
2 * \file
3 * This header file is part of module \alib_files of the \aliblong.
4 *
5 * \emoji :copyright: 2013-2024 A-Worx GmbH, Germany.
6 * Published under \ref mainpage_license "Boost Software License".
7 **************************************************************************************************/
8#ifndef HPP_ALIB_FILES_FTOOLS
9#define HPP_ALIB_FILES_FTOOLS 1
10
11#if !defined (HPP_ALIB_FILES_FINFO)
12# include "alib/files/finfo.hpp"
13#endif
14
15namespace alib { namespace files {
16
17/** ************************************************************************************************
18 * Simple helper class to resolve owner and group ids to strings names. The simple approach
19 * here is to store the last recently requested ID/name pairs and return this if a subsequent
20 * request asks for the same id. Otherwise, a system call is performed.
21 **************************************************************************************************/
23{
24 protected:
25 FInfo::TOwnerAndGroupID lastUID; ///< The last requested user ID..
26 FInfo::TOwnerAndGroupID lastGID; ///< The last requested group ID.
27 AString lastUIDResult; ///< The result associated with #lastUID.
28 AString lastGIDResult; ///< The result associated with #lastGID.
29
30 public:
31 /** Constructor */
33 : lastUID(FInfo::UnknownID), lastGID(FInfo::UnknownID)
34 , lastUIDResult("?"), lastGIDResult("?")
35 {}
36
37
39 /**
40 * Writes owner and group names of \p{finfo} to the given strings.
41 * @param finfo The file to examine.
42 * @return A pair of strings, denoting the owner and group name.
43 */
44 std::pair<String,String> Get( const FInfo& finfo );
45
46}; //class OwnerAndGroupResolver
47
48} // namespace alib[::files]
49
50
51/// Type alias in namespace \b alib.
53
54} // namespace [alib]
55
56#endif // HPP_ALIB_FILES_FTOOLS
uint32_t TOwnerAndGroupID
Definition finfo.hpp:95
FInfo::TOwnerAndGroupID lastUID
The last requested user ID..
Definition ftools.hpp:25
ALIB_API std::pair< String, String > Get(const FInfo &finfo)
Definition ftools.cpp:23
FInfo::TOwnerAndGroupID lastGID
The last requested group ID.
Definition ftools.hpp:26
AString lastUIDResult
The result associated with lastUID.
Definition ftools.hpp:27
AString lastGIDResult
The result associated with lastGID.
Definition ftools.hpp:28
#define ALIB_API
Definition alib.hpp:538
Definition alib.cpp:57