file.h
// Copyright (c) 1999-2018 David Muse
// See the COPYING file for more information.
#ifndef RUDIMENTS_FILE_H
#define RUDIMENTS_FILE_H
#include <rudiments/private/fileincludes.h>
class RUDIMENTS_DLLSPEC file : public filedescriptor {
public:
file();
file(const file &f);
file &operator=(const file &f);
virtual ~file();
virtual bool open(const char *name, int32_t flags);
virtual bool open(const char *name,
int32_t flags,
mode_t perms);
virtual bool create(const char *name, mode_t perms);
virtual char *getContents();
virtual ssize_t getContents(unsigned char *buffer,
size_t buffersize);
virtual bool truncate() const;
virtual bool truncate(off64_t size) const;
virtual off64_t getCurrentPosition() const;
virtual off64_t setPositionRelativeToBeginning(
off64_t offset) const;
virtual off64_t setPositionRelativeToCurrent(
off64_t offset) const;
virtual off64_t setPositionRelativeToEnd(off64_t offset) const;
virtual bool tryLockFile(int16_t type) const;
virtual bool lockFile(int16_t type) const;
virtual bool checkLockFile(int16_t type,
int16_t *conftype,
int16_t *confwhence,
off64_t *confstart,
off64_t *conflen) const;
virtual bool unlockFile() const;
virtual bool tryLockRegion(int16_t type,
off64_t start,
off64_t len) const;
virtual bool lockRegion(int16_t type,
off64_t start,
off64_t len) const;
virtual bool checkLockRegion(int16_t type,
off64_t start,
off64_t len,
int16_t *conftype,
int16_t *confwhence,
off64_t *confstart,
off64_t *conflen) const;
virtual bool unlockRegion(off64_t start,
off64_t len) const;
virtual bool tryLockFromCurrent(int16_t type,
off64_t len) const;
virtual bool tryLockFromCurrent(int16_t type,
off64_t start,
off64_t len) const;
virtual bool lockFromCurrent(int16_t type,
off64_t len) const;
virtual bool lockFromCurrent(int16_t type,
off64_t start,
off64_t len) const;
virtual bool checkLockFromCurrent(int16_t type,
off64_t len,
int16_t *conftype,
int16_t *confwhence,
off64_t *confstart,
off64_t *conflen) const;
virtual bool checkLockFromCurrent(int16_t type,
off64_t start,
off64_t len,
int16_t *conftype,
int16_t *confwhence,
off64_t *confstart,
off64_t *conflen) const;
virtual bool unlockFromCurrent(off64_t len) const;
virtual bool unlockFromCurrent(off64_t start,
off64_t len) const;
virtual bool tryLockFromEnd(int16_t type,
off64_t len) const;
virtual bool tryLockFromEnd(int16_t type,
off64_t start,
off64_t len) const;
virtual bool lockFromEnd(int16_t type, off64_t len) const;
virtual bool lockFromEnd(int16_t type,
off64_t start,
off64_t len) const;
virtual bool checkLockFromEnd(int16_t type,
off64_t len,
int16_t *conftype,
int16_t *confwhence,
off64_t *confstart,
off64_t *conflen) const;
virtual bool checkLockFromEnd(int16_t type,
off64_t start,
off64_t len,
int16_t *conftype,
int16_t *confwhence,
off64_t *confstart,
off64_t *conflen) const;
virtual bool unlockFromEnd(off64_t len) const;
virtual bool unlockFromEnd(off64_t start,
off64_t len) const;
virtual bool tryLockRemainder(int16_t type,
off64_t start) const;
virtual bool lockRemainder(int16_t type,
off64_t start) const;
virtual bool checkLockRemainder(int16_t type,
off64_t start,
int16_t *conftype,
int16_t *confwhence,
off64_t *confstart,
off64_t *conflen) const;
virtual bool unlockRemainder(off64_t start) const;
virtual bool tryLockRemainderFromCurrent(int16_t type) const;
virtual bool tryLockRemainderFromCurrent(int16_t type,
off64_t start) const;
virtual bool lockRemainderFromCurrent(int16_t type) const;
virtual bool lockRemainderFromCurrent(int16_t type,
off64_t start) const;
virtual bool checkLockRemainderFromCurrent(
int16_t type,
int16_t *conftype,
int16_t *confwhence,
off64_t *confstart,
off64_t *conflen) const;
virtual bool checkLockRemainderFromCurrent(
int16_t type,
off64_t start,
int16_t *conftype,
int16_t *confwhence,
off64_t *confstart,
off64_t *conflen) const;
virtual bool unlockRemainderFromCurrent() const;
virtual bool unlockRemainderFromCurrent(off64_t start) const;
virtual bool tryLockRemainderFromEnd(int16_t type) const;
virtual bool tryLockRemainderFromEnd(int16_t type,
off64_t start) const;
virtual bool lockRemainderFromEnd(int16_t type) const;
virtual bool lockRemainderFromEnd(int16_t type,
off64_t start) const;
virtual bool checkLockRemainderFromEnd(
int16_t type,
int16_t *conftype,
int16_t *confwhence,
off64_t *confstart,
off64_t *conflen) const;
virtual bool checkLockRemainderFromEnd(
int16_t type,
off64_t start,
int16_t *conftype,
int16_t *confwhence,
off64_t *confstart,
off64_t *conflen) const;
virtual bool unlockRemainderFromEnd() const;
virtual bool unlockRemainderFromEnd(off64_t start) const;
virtual bool sequentialAccess(off64_t start,
size_t len) const;
virtual bool randomAccess(off64_t start, size_t len) const;
virtual bool onlyOnce(off64_t start, size_t len) const;
virtual bool willNeed(off64_t start, size_t len) const;
virtual bool wontNeed(off64_t start, size_t len) const;
virtual bool normalAccess(off64_t start, size_t len) const;
virtual bool reserve(off64_t start, size_t len) const;
virtual bool sync() const;
virtual bool dataSync() const;
virtual void dontGetCurrentPropertiesOnOpen();
virtual void getCurrentPropertiesOnOpen();
virtual bool getCurrentProperties();
virtual mode_t getPermissions() const;
virtual uid_t getOwnerUserId() const;
virtual gid_t getOwnerGroupId() const;
virtual off64_t getSize() const;
virtual blksize_t getBlockSize() const;
virtual blkcnt_t getBlockCount() const;
virtual int32_t isSocket() const;
virtual int32_t isSymbolicLink() const;
virtual int32_t isRegularFile() const;
virtual int32_t isBlockDevice() const;
virtual int32_t isDirectory() const;
virtual int32_t isCharacterDevice() const;
virtual int32_t isFifo() const;
virtual time_t getLastAccessTime() const;
virtual time_t getLastModificationTime() const;
virtual time_t getLastChangeTime() const;
virtual dev_t getDevice() const;
virtual dev_t getDeviceType() const;
virtual uint64_t getInode() const;
virtual nlink_t getNumberOfHardLinks() const;
virtual bool setPermissions(mode_t perms) const;
virtual bool changeOwner(const char *newuser,
const char *newgroup) const;
virtual bool changeOwner(uid_t uid, gid_t gid) const;
virtual bool canChangeOwner() const;
virtual int64_t maxLinks() const;
virtual void *getInternalFileStatisticsStructure();
static bool createFile(const char *name, mode_t perms);
static bool createFifo(const char *filename, mode_t perms);
static int32_t createTemporaryFile(char *templatefilename);
static int32_t createTemporaryFile(char *templatefilename,
mode_t perms);
static bool createHardLink(const char *oldpath,
const char *newpath);
static bool createSymbolicLink(const char *oldpath,
const char *newpath);
static char *resolveSymbolicLink(const char *filename);
static bool rename(const char *oldpath,
const char *newpath);
static bool remove(const char *filename);
static bool truncate(const char *filename);
static bool truncate(const char *filename, off64_t size);
static char *getContents(const char *name);
static ssize_t getContents(const char *name,
unsigned char *buffer,
size_t buffersize);
static bool exists(const char *filename);
static bool readable(const char *filename);
static bool writeable(const char *filename);
static bool executable(const char *filename);
static bool accessible(const char *filename, int32_t mode);
static bool getLastChangeTime(const char *filename,
time_t *ctime);
static bool setPermissions(const char *filename,
mode_t perms);
static bool changeOwner(const char *filename,
const char *newuser,
const char *newgroup);
static bool changeOwner(const char *filename,
uid_t uid, gid_t gid);
static bool canChangeOwner(const char *filename);
static bool setLastAccessTime(const char *filename,
time_t lastaccesstime);
static bool setLastModificationTime(const char *filename,
time_t lastmodtime);
static bool setLastAccessAndModificationTimes(
const char *filename,
time_t lastaccesstime,
time_t lastmodtime);
static bool setLastAccessAndModificationTimes(
const char *filename);
static char *dirname(const char *filename);
static char *basename(const char *filename);
static char *basename(const char *filename,
const char *ext);
static char *extension(const char *filename);
static char *eightDotThree(const char *filename);
static key_t generateKey(const char *filename, int32_t id);
static int64_t maxLinks(const char *filename);
#include <rudiments/private/file.h>
};
#endif
file
Definition: file.h:19
file::unlockFromCurrent
virtual bool unlockFromCurrent(off64_t len) const
file::unlockRemainderFromEnd
virtual bool unlockRemainderFromEnd() const
file::checkLockRemainderFromCurrent
virtual bool checkLockRemainderFromCurrent(int16_t type, off64_t start, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
file::createSymbolicLink
static bool createSymbolicLink(const char *oldpath, const char *newpath)
file::canChangeOwner
static bool canChangeOwner(const char *filename)
file::remove
static bool remove(const char *filename)
file::tryLockRemainderFromEnd
virtual bool tryLockRemainderFromEnd(int16_t type) const
file::open
virtual bool open(const char *name, int32_t flags)
file::getLastChangeTime
virtual time_t getLastChangeTime() const
file::getDeviceType
virtual dev_t getDeviceType() const
file::lockRemainderFromEnd
virtual bool lockRemainderFromEnd(int16_t type) const
file::willNeed
virtual bool willNeed(off64_t start, size_t len) const
file::unlockFromEnd
virtual bool unlockFromEnd(off64_t len) const
file::onlyOnce
virtual bool onlyOnce(off64_t start, size_t len) const
file::unlockRemainderFromCurrent
virtual bool unlockRemainderFromCurrent(off64_t start) const
file::isBlockDevice
virtual int32_t isBlockDevice() const
file::getCurrentProperties
virtual bool getCurrentProperties()
file::file
file()
file::sync
virtual bool sync() const
file::createFile
static bool createFile(const char *name, mode_t perms)
file::getLastModificationTime
virtual time_t getLastModificationTime() const
file::lockFromEnd
virtual bool lockFromEnd(int16_t type, off64_t start, off64_t len) const
file::unlockFile
virtual bool unlockFile() const
file::tryLockFile
virtual bool tryLockFile(int16_t type) const
file::getBlockCount
virtual blkcnt_t getBlockCount() const
file::getContents
static char * getContents(const char *name)
file::dirname
static char * dirname(const char *filename)
file::checkLockFromEnd
virtual bool checkLockFromEnd(int16_t type, off64_t start, off64_t len, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
file::wontNeed
virtual bool wontNeed(off64_t start, size_t len) const
file::setLastAccessAndModificationTimes
static bool setLastAccessAndModificationTimes(const char *filename)
file::writeable
static bool writeable(const char *filename)
file::generateKey
static key_t generateKey(const char *filename, int32_t id)
file::checkLockFromCurrent
virtual bool checkLockFromCurrent(int16_t type, off64_t start, off64_t len, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
file::tryLockRemainder
virtual bool tryLockRemainder(int16_t type, off64_t start) const
file::randomAccess
virtual bool randomAccess(off64_t start, size_t len) const
file::isDirectory
virtual int32_t isDirectory() const
file::basename
static char * basename(const char *filename, const char *ext)
file::checkLockRemainderFromEnd
virtual bool checkLockRemainderFromEnd(int16_t type, off64_t start, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
file::getInode
virtual uint64_t getInode() const
file::checkLockFile
virtual bool checkLockFile(int16_t type, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
file::getBlockSize
virtual blksize_t getBlockSize() const
file::~file
virtual ~file()
file::getLastAccessTime
virtual time_t getLastAccessTime() const
file::setLastAccessTime
static bool setLastAccessTime(const char *filename, time_t lastaccesstime)
file::checkLockRemainder
virtual bool checkLockRemainder(int16_t type, off64_t start, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
file::tryLockRegion
virtual bool tryLockRegion(int16_t type, off64_t start, off64_t len) const
file::unlockRemainderFromEnd
virtual bool unlockRemainderFromEnd(off64_t start) const
file::setPositionRelativeToBeginning
virtual off64_t setPositionRelativeToBeginning(off64_t offset) const
file::createHardLink
static bool createHardLink(const char *oldpath, const char *newpath)
file::truncate
virtual bool truncate() const
file::executable
static bool executable(const char *filename)
file::createTemporaryFile
static int32_t createTemporaryFile(char *templatefilename)
file::checkLockRegion
virtual bool checkLockRegion(int16_t type, off64_t start, off64_t len, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
file::getNumberOfHardLinks
virtual nlink_t getNumberOfHardLinks() const
file::tryLockFromEnd
virtual bool tryLockFromEnd(int16_t type, off64_t len) const
file::lockFromEnd
virtual bool lockFromEnd(int16_t type, off64_t len) const
file::setLastModificationTime
static bool setLastModificationTime(const char *filename, time_t lastmodtime)
file::isCharacterDevice
virtual int32_t isCharacterDevice() const
file::create
virtual bool create(const char *name, mode_t perms)
file::getCurrentPosition
virtual off64_t getCurrentPosition() const
file::isSymbolicLink
virtual int32_t isSymbolicLink() const
file::accessible
static bool accessible(const char *filename, int32_t mode)
file::resolveSymbolicLink
static char * resolveSymbolicLink(const char *filename)
file::isRegularFile
virtual int32_t isRegularFile() const
file::lockFile
virtual bool lockFile(int16_t type) const
file::isSocket
virtual int32_t isSocket() const
file::truncate
static bool truncate(const char *filename)
file::tryLockFromCurrent
virtual bool tryLockFromCurrent(int16_t type, off64_t len) const
file::readable
static bool readable(const char *filename)
file::dontGetCurrentPropertiesOnOpen
virtual void dontGetCurrentPropertiesOnOpen()
file::rename
static bool rename(const char *oldpath, const char *newpath)
file::getContents
virtual char * getContents()
file::lockRemainderFromCurrent
virtual bool lockRemainderFromCurrent(int16_t type) const
file::getLastChangeTime
static bool getLastChangeTime(const char *filename, time_t *ctime)
file::unlockFromEnd
virtual bool unlockFromEnd(off64_t start, off64_t len) const
file::changeOwner
virtual bool changeOwner(const char *newuser, const char *newgroup) const
file::changeOwner
static bool changeOwner(const char *filename, uid_t uid, gid_t gid)
file::getCurrentPropertiesOnOpen
virtual void getCurrentPropertiesOnOpen()
file::basename
static char * basename(const char *filename)
file::setPositionRelativeToCurrent
virtual off64_t setPositionRelativeToCurrent(off64_t offset) const
file::setPermissions
virtual bool setPermissions(mode_t perms) const
file::isFifo
virtual int32_t isFifo() const
file::sequentialAccess
virtual bool sequentialAccess(off64_t start, size_t len) const
file::setPermissions
static bool setPermissions(const char *filename, mode_t perms)
file::getPermissions
virtual mode_t getPermissions() const
file::operator=
file & operator=(const file &f)
file::unlockFromCurrent
virtual bool unlockFromCurrent(off64_t start, off64_t len) const
file::maxLinks
static int64_t maxLinks(const char *filename)
file::checkLockFromCurrent
virtual bool checkLockFromCurrent(int16_t type, off64_t len, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
file::tryLockFromEnd
virtual bool tryLockFromEnd(int16_t type, off64_t start, off64_t len) const
file::lockFromCurrent
virtual bool lockFromCurrent(int16_t type, off64_t start, off64_t len) const
file::setPositionRelativeToEnd
virtual off64_t setPositionRelativeToEnd(off64_t offset) const
file::tryLockRemainderFromEnd
virtual bool tryLockRemainderFromEnd(int16_t type, off64_t start) const
file::open
virtual bool open(const char *name, int32_t flags, mode_t perms)
file::changeOwner
static bool changeOwner(const char *filename, const char *newuser, const char *newgroup)
file::getSize
virtual off64_t getSize() const
file::lockRemainderFromEnd
virtual bool lockRemainderFromEnd(int16_t type, off64_t start) const
file::getOwnerUserId
virtual uid_t getOwnerUserId() const
file::getContents
virtual ssize_t getContents(unsigned char *buffer, size_t buffersize)
file::lockRegion
virtual bool lockRegion(int16_t type, off64_t start, off64_t len) const
file::file
file(const file &f)
file::normalAccess
virtual bool normalAccess(off64_t start, size_t len) const
file::lockRemainderFromCurrent
virtual bool lockRemainderFromCurrent(int16_t type, off64_t start) const
file::truncate
virtual bool truncate(off64_t size) const
file::exists
static bool exists(const char *filename)
file::unlockRemainder
virtual bool unlockRemainder(off64_t start) const
file::getInternalFileStatisticsStructure
virtual void * getInternalFileStatisticsStructure()
file::maxLinks
virtual int64_t maxLinks() const
file::dataSync
virtual bool dataSync() const
file::createFifo
static bool createFifo(const char *filename, mode_t perms)
file::changeOwner
virtual bool changeOwner(uid_t uid, gid_t gid) const
file::checkLockFromEnd
virtual bool checkLockFromEnd(int16_t type, off64_t len, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
file::tryLockRemainderFromCurrent
virtual bool tryLockRemainderFromCurrent(int16_t type, off64_t start) const
file::reserve
virtual bool reserve(off64_t start, size_t len) const
file::lockFromCurrent
virtual bool lockFromCurrent(int16_t type, off64_t len) const
file::createTemporaryFile
static int32_t createTemporaryFile(char *templatefilename, mode_t perms)
file::getContents
static ssize_t getContents(const char *name, unsigned char *buffer, size_t buffersize)
file::checkLockRemainderFromCurrent
virtual bool checkLockRemainderFromCurrent(int16_t type, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
file::eightDotThree
static char * eightDotThree(const char *filename)
file::getDevice
virtual dev_t getDevice() const
file::tryLockRemainderFromCurrent
virtual bool tryLockRemainderFromCurrent(int16_t type) const
file::extension
static char * extension(const char *filename)
file::lockRemainder
virtual bool lockRemainder(int16_t type, off64_t start) const
file::checkLockRemainderFromEnd
virtual bool checkLockRemainderFromEnd(int16_t type, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) const
file::truncate
static bool truncate(const char *filename, off64_t size)
file::getOwnerGroupId
virtual gid_t getOwnerGroupId() const
file::tryLockFromCurrent
virtual bool tryLockFromCurrent(int16_t type, off64_t start, off64_t len) const
file::canChangeOwner
virtual bool canChangeOwner() const
file::setLastAccessAndModificationTimes
static bool setLastAccessAndModificationTimes(const char *filename, time_t lastaccesstime, time_t lastmodtime)
file::unlockRemainderFromCurrent
virtual bool unlockRemainderFromCurrent() const
file::unlockRegion
virtual bool unlockRegion(off64_t start, off64_t len) const
filedescriptor
Definition: filedescriptor.h:13