Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

Dv::Util::User Class Reference

A class representing a Unix user. More...

#include <user.h>

List of all members.

Public Member Functions

 User ()
 Initialize to current user, equivalent with User(getuid()).
 User (uid_t uid) throw (UserError)
 Initialize to user with given uid, throw UserError if not found.
 User (const std::string &name) throw (UserError)
 Initialize to user with given user name, throw UserError if not found.
uid_t uid () const
 Retrieve uid of this user.
gid_t gid () const
 Retrieve current group id of this user.
const std::string & home () const
 Retrieve pathname of home directory of this user.
const std::string & shell () const
 Retrieve pathname of shell program of this user.
const std::string & name () const
 Retrieve user name of this user.
const std::string & full_name () const
 Retrieve full name (gecos field) of this user.
bool password (const std::string &pass) const
 Return true iff called by root and password matches user's password.
bool operator== (const User &u) const
 Users are equal if they have the same uid.
bool operator< (const User &u) const
 Based on the comparison of the uid's.
bool operator> (const User &u) const
bool operator!= (const User &u) const
bool operator>= (const User &u) const
bool operator<= (const User &u) const

Private Member Functions

void * getpwinfo (void *)

Private Attributes

std::string name_
std::string full_name_
uid_t uid_
gid_t gid_
std::string home_
std::string shell_


Detailed Description

A class representing a Unix user.

This class provides a convenient wrapper around information that is usually obtained using getpwnam().

Definition at line 29 of file user.h.


Constructor & Destructor Documentation

Dv::Util::User::User  ) 
 

Initialize to current user, equivalent with User(getuid()).

Dv::Util::User::User uid_t  uid  )  throw (UserError)
 

Initialize to user with given uid, throw UserError if not found.

Dv::Util::User::User const std::string &  name  )  throw (UserError)
 

Initialize to user with given user name, throw UserError if not found.


Member Function Documentation

uid_t Dv::Util::User::uid  )  const [inline]
 

Retrieve uid of this user.

Definition at line 39 of file user.h.

References uid_.

Referenced by operator<(), and operator==().

gid_t Dv::Util::User::gid  )  const [inline]
 

Retrieve current group id of this user.

Definition at line 41 of file user.h.

References gid_.

const std::string& Dv::Util::User::home  )  const [inline]
 

Retrieve pathname of home directory of this user.

Definition at line 43 of file user.h.

References home_.

const std::string& Dv::Util::User::shell  )  const [inline]
 

Retrieve pathname of shell program of this user.

Definition at line 45 of file user.h.

References shell_.

const std::string& Dv::Util::User::name  )  const [inline]
 

Retrieve user name of this user.

Definition at line 47 of file user.h.

References name_.

const std::string& Dv::Util::User::full_name  )  const [inline]
 

Retrieve full name (gecos field) of this user.

Definition at line 49 of file user.h.

References full_name_.

bool Dv::Util::User::password const std::string &  pass  )  const
 

Return true iff called by root and password matches user's password.

bool Dv::Util::User::operator== const User u  )  const [inline]
 

Users are equal if they have the same uid.

Definition at line 54 of file user.h.

References uid().

bool Dv::Util::User::operator< const User u  )  const [inline]
 

Based on the comparison of the uid's.

Definition at line 56 of file user.h.

References uid().

bool Dv::Util::User::operator> const User u  )  const [inline]
 

Definition at line 58 of file user.h.

bool Dv::Util::User::operator!= const User u  )  const [inline]
 

Definition at line 59 of file user.h.

bool Dv::Util::User::operator>= const User u  )  const [inline]
 

Definition at line 60 of file user.h.

bool Dv::Util::User::operator<= const User u  )  const [inline]
 

Definition at line 61 of file user.h.

void* Dv::Util::User::getpwinfo void *   )  [private]
 


Member Data Documentation

std::string Dv::Util::User::name_ [private]
 

Definition at line 66 of file user.h.

Referenced by name().

std::string Dv::Util::User::full_name_ [private]
 

Definition at line 67 of file user.h.

Referenced by full_name().

uid_t Dv::Util::User::uid_ [private]
 

Definition at line 68 of file user.h.

Referenced by uid().

gid_t Dv::Util::User::gid_ [private]
 

Definition at line 69 of file user.h.

Referenced by gid().

std::string Dv::Util::User::home_ [private]
 

Definition at line 70 of file user.h.

Referenced by home().

std::string Dv::Util::User::shell_ [private]
 

Definition at line 71 of file user.h.

Referenced by shell().


The documentation for this class was generated from the following file:
dvutil-0.13.15 [30 December, 2004]