#include <OUX/system/user.hh> class OUX_User {
public:
static os_typespec* get_os_typespec();
OUX_User();
OUX_User(uid_t theUID);
OUX_User(OTC_String const& theName);
OUX_User(passwd const* thePwent);
OUX_User(OUX_User const& theUser);
OUX_User& operator=(OUX_User const& theUser);
OUX_User& operator=(passwd const* thePwent);
inline OTC_Boolean isValid() const;
inline OTC_String const& name() const;
inline OTC_String const& fullname() const;
inline uid_t uid() const;
inline operator uid_t() const;
inline gid_t gid() const;
};
OUX_User
class is a wrapper around the password entry
for a user.
OUX_User();
OUX_User(uid_t theUID);
theUID
. If theUID
doesn't describe a
valid user on this host then the user id
will still be used and the group id, and
user name will also be set to the user id.
Also, the full name of the user will be
empty.
OUX_User(OTC_String const& theName);
theName
. If theName
doesn't
describe a valid user on this host then
the user name will still be used, however
the user id and group id will be set to
MAXUID
, the id generally assigned to the
user nobody
. Also, the full name of the
user will be empty.
OUX_User(passwd const* thePwent);
thePwent
. If
thePwent
is 0
the user id, group id,
and user name will be set to MAXUID
, the
id generally assigned to the user
nobody
. Also, the full name of the user
will be empty.
OUX_User(OUX_User const& theUser);
theUser
.
OUX_User& operator=(OUX_User const& theUser);
theUser
.
OUX_User& operator=(passwd const* thePwent);
thePwent
. If
thePwent
is 0
the user id, group id,
and user name will be set to MAXUID
, the
id generally assigned to the user
nobody
. Also, the full name of the user
will be empty.
inline OTC_Boolean isValid() const;
OTCLIB_TRUE
if this class
describes a valid user on this host.
inline OTC_String const& name() const;
inline OTC_String const& fullname() const;
inline uid_t uid() const;
inline operator uid_t() const;
inline gid_t gid() const;
isValid()
function should
always be invoked to actually determine if the information
gathered is correct.
Note that successive calls to getpwent()
to get all entries in
the passwd file may not be able to be used while creating
instances of this class using any constructor besides the copy
constructor and that accepting a pointer to a passwd structure, as
instantiation of the class may have the result of reseting the
pointer used by getpwent()
back to the start. Whether this
occurs will depend on your variant of UNIX.
An OTC_BaseActions
and OTC_HashActions
are defined for
OUX_User
. For OTC_HashActions
the key on which hashing
and comparison is based is the user id.