1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
|
includefile(include/header)
COMMENT( see also getgroups )
COMMENT(manpage, section, releasedate, archive, short name)
manpage(FBB::Stat)(3bobcat)(_CurYrs_)(libbobcat-dev__CurVers_)
(Characteristics of object in the filesystem)
manpagename(FBB::Stat)(Determines File Characteristics)
manpagesynopsis()
bf(#include <bobcat/stat>)nl()
Linking option: tt(-lbobcat)
manpagedescription()
bf(Stat) is a wrapper around the bf(stat)(2) and bf(lstat)(2) system
functions. In particular, it offers features to test directly for object
characteristics offered by these two functions. To determine whether an object
could properly be constructed use the tt(Stat bool) conversion operator. If
this operator returns tt(false) then no other member except for tt(error)
should be used.
includefile(include/namespace)
manpagesection(INHERITS FROM)
-
manpagesection(ENUMERATIONS)
bf(Stat::Combine): nl()
This enumeration defines the following values:
itemization(
it() bf(ALL): require all of the specified bf(Mode) or
bf(SpecialMode) values to match;
it() bf(ANY): require any match of the specified bf(Mode) or
bf(SpecialMode) values (one match suffices);
)
bf(Stat::Mode): nl()
This enumeration defines the following values:
itemization(
it() bf(UR): the owner of the object has read permissions
it() bf(UW): the owner of the object has write permissions
it() bf(UX): the owner of the object has execute permissions
it() bf(GR): the group to which the object belongs has read permissions
it() bf(GW): the group to which the object belongs has write
permissions
it() bf(GX): the group to which the object belongs has execute
permissions
it() bf(OR): others have read permissions
it() bf(OW): others have write permissions
it() bf(OX): others have execute permissions
it() bf(READ): equal to tt(UR | GR | OR)
it() bf(WRITE): equal to tt(UW | GW | OW)
it() bf(EXEC): equal to tt(UX | GX | OX)
it() bf(RWX): all of the above.
)
bf(Stat::SpecialMode): nl()
This enumeration defines the following values:
itemization(
it() bf(SUID): set UID bit is up
it() bf(SGID): set GID bit is up
it() bf(SB): sticky bit is up
)
bf(Stat::Type): nl()
This enumeration, which is identical to the bf(glob)(3bobcat) tt(Type)
enumeration, defines the following values:
includefile(gs.inc)
bf(Stat::Lstat): nl()
This enumeration has one value: tt(LStat), which can be specified by
construtors and some members when the tt(Stat) object should
distinguish regular files and symbolic links (calling bf(lstat)(2))
instead of considering symbolic links as regular files (using
bf(stat)(2)).
Constructors and members that define tt(Stat::Lstat) parameters call
bf(lstat)(2), thus distinguishing symbolic links from regular files,
while constructors and members that do not define tt(Stat::Lstat)
parameters use bf(stat)(2).
The return values of the members tt(statStruct) and tt(type) and
tt(typeStr) (see below) only distinguish symbolic links from regular
files when the tt(Stat::LStat) argument has been used.
The constructors and member functions listed below for which
tt([Stat::Lstat,]) is specified as first parameter may optionally
specify the tt(Stat::LStat) argument.
manpagesection(CONSTRUCTORS)
itemization(
itb(Stat())
The default constructor, creating an empty bf(Stat) object. It's
mainly used as default object when defining, e.g., vectors of tt(Stat)
objects. As it doesn't refer to an existing file system entry its
tt(operator bool) returns false;
itb(Stat([Stat::Lstat,] std::string const &fname))
Initializes a bf(Stat) with a given object name;
itb(Stat([Stat::Lstat,] std::string const &fname, std::string const
&searchPath))
Initializes a bf(Stat) with a given object name, where the object is
searched in the tt(searchPath) directories, which is a colon-separated
string of directory names. The filenames are constructed by appending
tt(fname) to each of the elements of tt(searchPath) until an existing
object is found. This object is then used. If tt(fname) is an absolute
path, tt(searchPath) is ignored.
)
Copy and move constructors (and assignment operators) are available.
manpagesection(OVERLOADED OPERATORS)
itemization(
itb(operator bool() const)
This operator returns tt(true) if the tt(Stat) object holds information
about an existing object. Otherwise tt(false) is returned. When
tt(false) is returned other members, except for the assignment
operators, the tt(error) member, and the tt(set) members should not
be used.
)
manpagesection(MEMBER FUNCTIONS)
itemization(
itb(bool access(FBB::User const &user, size_t spec, bool useEffective =
true) const)
Returns tt(true) if tt(user) has the permissions as specified at
tt(spec) (of which only the defined tt(Mode) bits are interpreted). If
a combination of read, write and/or execute permissions are specified,
then at least one of the read permissions, one of the write
permissions and one of the execute permissions must be granted or the
function returns tt(false). E.g, when specifying tt(access(user, UW |
UR | GR)) then the user em(must) have write permissions, but either
the user or the user's group must have read permissions. If multiple
read, multiple write or multiple execute permissions are specified
(like tt(UR | GR)) then this member returns tt(true) if at least one
of the requested read, write, or execute permissions are granted for
tt(user).
itb(size_t blockSize() const)
Returns the blocksize (tt(st_blksize)) for filesystem I/O
itb(size_t device() const)
Returns the device id (tt(st_dev)).
itb(size_t deviceType() const)
Returns the device type number, but only if the object type is
bf(DEVICE) (tt(st_rdev)).
itb(size_t error() const)
Returns the error number associated with an error, in cases where
bf(operator bool()) returns bf(false). A returned value of 0 indicates
`no errors'. To obtain a verbal transcription of returned error
numbers the tt(Exception::errnodescr) manipulator (cf.
bf(exception)(3bobcat)) can be used.
itb(bool isType(Stat::Type probe))
Returns tt(true) if the object has the probed type otherwise tt(false)
is returned.
itb(size_t inode() const)
Returns the inode number (tt(st_ino)).
itb(size_t gid() const)
Returns the group ID of the object's owner (tt(st_gid)).
itb(FBB::DateTime lastAccess() const)
Returns an bf(FBB::DateTime) object holding information about the
object's time of last access (tt(st_atime)) (using UTC).
itb(FBB::DateTime lastChange() const)
Returns an bf(FBB::DateTime) object holding information about the
object's time of last status change (tt(st_ctime)) (using UTC).
itb(FBB::DateTime lastModification() const)
Returns an bf(FBB::DateTime) object holding information about the
object's last modification time (tt(st_mtime)) (using UTC).
itb(size_t mode() const)
Returns the object's raw, uninterpreted mode (tt(st_mode & RWX)). Note
that this value is usually displayed (and is processed most easily) as
an octal value.
itb(bool mode(size_t mode, Combine combine = ALL))
Returns true if the object has the indicated mode. Multiple modes may
be set, which can be combined by the logical bf(bitor) operator. By
default, if multiple modes are specified, the resulting pattern must
exactly represent the object's mode for the member function to return
bf(true). An optional argument tt(ANY) may be specified if the
function should return true if at least one specified mode matches the
object's actual mode. An tt(Exception) exception is thrown if the
specified tt(mode) contains other values than the defined bf(Mode)
or bf(SpecialMode) values.
itb(std::string modeStr() const)
Returns the standard string-representation of the object's mode (e.g.,
tt(rw-r--r--)). Special modes (e.g., suid) are indicated by tt(s)
instead of tt(x) when the object is user and/or group executable and
by tt(S) if the object has the special mode bit(s) set, but is not
executable. For the `other' executable mode flag tt(t) is used
(`sticky' bit) and tt(T) if the object is not `other' executable.
itb(std::string const &name() const)
Returns the object's name as specified in the constructor or bf(set())
member function.
itb(size_t nBlocks() const)
Returns the object's number of allocated blocks (tt(st_blocks)).
itb(size_t nLinks() const)
Returns the object's number of hard links (tt(st_nlink)).
itb(std::string path() const)
Returns the object's full pathname. If the full pathname could not be
determined, an empty string is returned.
itb(bool set([Stat::Lstat,] std::string const &name))
Redefine the bf(Stat) object to represent the information about
the indicated object name.
itb(bool set([Stat::Lstat,] std::string const &name, std::string const
&pathlist))
Redefine the bf(Stat) object to represent the information about the
indicated object name, where the object is searched in the
tt(pathlist) directories, which is a colon-separated string of
directory names. The object names are constructed by appending
tt(fname) to each of the elements of tt(searchPath) until an existing
object is found. This object is then used. If tt(fname) is an absolute
path, tt(searchPath) is ignored.
itb(off_t size() const)
Returns the object's size in number of bytes (tt(st_size)).
itb(bool specialMode(size_t special, Combine combine = ALL))
Returns true if the object has the indicated special modes. Multiple
special modes may be specified, which can be combined by the logical
bf(bitor) operator. By default, if multiple modes are specified, the
resulting pattern must exactly represent the object's mode for the
member function to return bf(true). An optional argument tt(ANY) may
be specified if the function should return true if at least one
specified mode matches the object's actual mode. The non-special modes
are ignored but a tt(Exception) exception is thrown if tt(special)
contains other values than those defined by the bf(SpecialMode) enum.
itb(Stat::stat const &statStruct() const)
Returns a reference to the object's bf(stat struct).
itb(Stat::Type type() const)
Returns the tt(Stat::Type) value of the object.
itb(std::string typeStr() const)
Returns a textual representation of the object's type as returned by
the tt(Stat::type()) member function.
itb(size_t uid() const)
Returns the user ID of the object's owner (tt(st_uid)).
)
manpagesection(EXAMPLE)
verbinclude(../../stat/driver/driver.cc)
manpagefiles()
em(bobcat/stat) - defines the class interface
manpageseealso()
bf(bobcat)(7), bf(glob)(3bobcat), bf(stat)(2), bf(lstat)(2)
manpagebugs()
None Reported.
includefile(include/trailer)
|