Uni/Group#

Interface to the group struct from <grp.h>.

Info

To use declarations from this page, include the <essence/uni/grp.hpp> header.

They are found within the essence::uni namespace.

class group#

Wrapper for the Unix group C struct.

group::group()#

Constructor which queries the process invoker’s group id.

group::group(gid_t i)#

Constructor accepting a group id.

group::group(const std::string &gname)#

Constructor accepting a group name.

gid_t id() const noexcept#

Get the group id.

std::string name() const#

Get the group name.

std::string password() const#

Get the group password, typically x, as the real password is often handled by shadow.

const std::vector<std::string> &members() const#

Get the members of the group as a vector of strings.

std::string str() const#

Get a string representation of the group, in the format returned by getent

Example

uni::group g;

// Comparable output to that of the `getent group` command
io::printn("{}", g.str());