NAME
OUX_Group -
Class to encapsulate UNIX group information.
SYNOPSIS
#include <OUX/system/group.hh>
class OUX_Group
{
public:
static os_typespec* get_os_typespec();
OUX_Group();
OUX_Group(gid_t theGID);
OUX_Group(OTC_String const& theName);
OUX_Group(group const* theGrent);
OUX_Group(OUX_Group const& theGroup);
OUX_Group& operator=(OUX_Group const& theGroup);
OUX_Group& operator=(group const* theGrent);
inline OTC_Boolean isValid() const;
inline OTC_String const& name() const;
inline gid_t gid() const;
inline operator gid_t() const;
inline OTC_Boolean isMember(OTC_String const& theName) const;
inline OTC_Iterator<OTC_String> members() const;
};
CLASS TYPE
Concrete
DESCRIPTION
The OUX_Group class is a wrapper around the group entry
structure.
INITIALISATION
OUX_Group();
Create a class for the group corresponding
to the current group id. If the current
group id doesn't describe a valid group on
this host then the group id will still be
used, and group name will be set to
the group id. The set of members for the
group will be empty.
OUX_Group(gid_t theGID);
Creates a class for the group with group
id theGID. If theGID doesn't describe
a valid group on this host then the group
id will still be used, and group name will
be set to the group id. The set of
members for the group will be empty.
OUX_Group(OTC_String const& theName);
Creates a class for the group with group
name theName. If theName doesn't
describe a valid group on this host then
the group name will still be used, however
the group id will be set to MAXUID,
the id generally associated with the user
nobody. The set of members for the group
will be empty.
OUX_Group(group const* theGrent);
Create a class for the group corresponding
to that described by the group structure
theGrent. If theGrent is 0 then the
group id and group name are set to
MAXUID, the id generally associated with
the user nobody. The set of members for
the group will be empty.
OUX_Group(OUX_Group const& theGroup);
Creates a copy of theGroup.
OUX_Group& operator=(OUX_Group const& theGroup);
Initialises this class to theGroup.
OUX_Group& operator=(group const* theGrent);
Initialises this class to that group
described by the group structure
theGrent. If theGrent is 0 then the
group id and group name are set to
MAXUID, the id generally associated with
the user nobody. The set of members for
the group will be empty.
ENQUIRY
inline OTC_Boolean isValid() const;
Return OTCLIB_TRUE if this class
describes a valid group on this host.
inline OTC_String const& name() const;
Returns the name of the group.
inline gid_t gid() const;
Returns the group id of the group.
inline operator gid_t() const;
Returns the group id of the group.
inline OTC_Boolean isMember(OTC_String const& theName) const;
Returns OTCLIB_TRUE if theName is a
member of this group.
inline OTC_Iterator<OTC_String> members() const;
Returns an iterator over the list of
members in the group.
NOTES
If the data used to get information about the group, doesn't
identify a valid group on the host then the information will be
filled out with default values. The isValid() function should
always be invoked to actually determine if the information
gathered is correct.
Note that successive calls to getgrent() to get all entries in
the group file may not be able to be used while creating instances
of this class using any constructor other than that taking a
pointer to the group structure, or the copy constructor, as
instantiation of this class may have the result of reseting the
pointer used by getgrent() back to the start. Whether this
occurs will depend on your variant of UNIX.
An OTC_BaseActions and OTC_HashActions are defined for
OUX_Group. For OTC_HashActions the key on which hashing
and comparison is performed is the group id.
LIBRARY
OUX
AUTHOR(S)
Graham Dumpleton
COPYRIGHT
Copyright 1991 1992 OTC LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED