Base Framework
Public Types | Public Member Functions | List of all members
FileInfo Class Reference

File information. More...

#include <base/filesystem/FileInfo.h>

Inherits Object.

Public Types

enum  Sticky { SET_UID = 0x4000, SET_GID = 0x2000, RESTRICT = 0x1000, STICKY_MASK = SET_UID|SET_GID|RESTRICT }
 
enum  Permissions {
  RUSR = 0x400, WUSR = 0x200, XUSR = 0x100, RWXU = RUSR|WUSR|XUSR,
  RGRP = 0x40, WGRP = 0x20, XGRP = 0x10, RWXG = RGRP|WGRP|XGRP,
  ROTH = 0x4, WOTH = 0x2, XOTH = 0x1, RWXO = ROTH|WOTH|XOTH,
  PERMISSION_MASK = RWXU|RWXG|RWXO
}
 

Public Member Functions

 FileInfo (const String &path)
 
long long getSize () const noexcept
 
const UsergetOwner () const noexcept
 
const GroupgetGroup () const noexcept
 
unsigned int getMode () const noexcept
 
unsigned int getLinks () const noexcept
 
const DategetLastModification () const noexcept
 
const DategetLastAccess () const noexcept
 
const DategetLastChange () const noexcept
 
const StringgetPath () const noexcept
 

Detailed Description

File information.

File information wrapper class.

Version
1.2
Examples
testsuite/ls.cpp.

Member Enumeration Documentation

◆ Permissions

Permissions.

Enumerator
RUSR 

Read permission for the owner of the file.

WUSR 

Write permission for the owner of the file.

XUSR 

Execute permission for the owner of the file.

RWXU 

Read, write, and execute permissions for the owner of the file.

RGRP 

Read permission for the group associated with the file.

WGRP 

Write permission for the group associated with the file.

XGRP 

Execute permission for the group associated with the file.

RWXG 

Read, write, and execute permissions for the group associated with the file.

ROTH 

Read permission for other users.

WOTH 

Write permission for other users.

XOTH 

Execute permission for other users.

RWXO 

Read, write, and execute permissions for other users.

PERMISSION_MASK 

Any access.

◆ Sticky

Sticky bit.

Enumerator
SET_UID 

Set user id on execution.

SET_GID 

Set group id on execution.

RESTRICT 

Restrict flag.

STICKY_MASK 

All sticky bits.

Constructor & Destructor Documentation

◆ FileInfo()

FileInfo::FileInfo ( const String path)

Initializes a file.

Parameters
paththe path of the file.

Member Function Documentation

◆ getGroup()

const Group& FileInfo::getGroup ( ) const
inlinenoexcept

Returns the group of the file.

Examples
testsuite/ls.cpp.

◆ getLastAccess()

const Date& FileInfo::getLastAccess ( ) const
inlinenoexcept

Returns the last access time of the file.

◆ getLastChange()

const Date& FileInfo::getLastChange ( ) const
inlinenoexcept

Returns the last chnage time of the file.

◆ getLastModification()

const Date& FileInfo::getLastModification ( ) const
inlinenoexcept

Returns the last modification time of the file.

Examples
testsuite/ls.cpp.

◆ getLinks()

unsigned int FileInfo::getLinks ( ) const
inlinenoexcept

Returns the number of links to the file.

Returns
0 is not supported.
Examples
testsuite/ls.cpp.

◆ getMode()

unsigned int FileInfo::getMode ( ) const
inlinenoexcept

Returns the mode of the file.

Returns
The maximum possible value if mode isn't supported.
Examples
testsuite/ls.cpp.

◆ getOwner()

const User& FileInfo::getOwner ( ) const
inlinenoexcept

Returns the owner of the file.

Examples
testsuite/ls.cpp.

◆ getPath()

const String& FileInfo::getPath ( ) const
inlinenoexcept

Returns the path of the file.

◆ getSize()

long long FileInfo::getSize ( ) const
inlinenoexcept

Returns the size of the file in bytes.

Examples
testsuite/ls.cpp.