PCL
pcl::FileInfo Class Reference

Platform-independent information on file and directory items. More...

#include <FileInfo.h>

Public Member Functions

 FileInfo ()
 
 FileInfo (const FileInfo &)=default
 
 FileInfo (const String &path)
 
virtual ~FileInfo ()
 
const FileAttributesAttributes () const
 
void Clear ()
 
String CompleteSuffix () const
 
String Directory () const
 
String Drive () const
 
bool Exists () const
 
String Extension () const
 
int GroupId () const
 
bool IsDirectory () const
 
bool IsExecutable () const
 
bool IsFile () const
 
bool IsHidden () const
 
bool IsReadable () const
 
bool IsSymbolicLink () const
 
bool IsWritable () const
 
const FileTimeLastAccessed () const
 
const FileTimeLastModified () const
 
String Name () const
 
String NameAndExtension () const
 
String NameAndSuffix () const
 
int NumberOfHardLinks () const
 
FileInfooperator= (const FileInfo &)=default
 
const StringPath () const
 
void Refresh ()
 
void Refresh (const String &path)
 
fsize_type Size () const
 
String Suffix () const
 
String SymbolicLinkTarget () const
 
const FileTimeTimeCreated () const
 
int UserId () const
 

Detailed Description

TODO: Write a detailed description for FileInfo.

Definition at line 250 of file FileInfo.h.

Constructor & Destructor Documentation

◆ FileInfo() [1/3]

pcl::FileInfo::FileInfo ( )
inline

Default constructor. Constructs an empty FileInfo object without any information on existing file or directory items.

Definition at line 258 of file FileInfo.h.

◆ FileInfo() [2/3]

pcl::FileInfo::FileInfo ( const String path)
inline

Constructs a FileInfo object with information retrieved for the specified file or directory path.

Definition at line 267 of file FileInfo.h.

◆ FileInfo() [3/3]

pcl::FileInfo::FileInfo ( const FileInfo )
default

Copy constructor.

◆ ~FileInfo()

virtual pcl::FileInfo::~FileInfo ( )
inlinevirtual

Virtual destructor.

Definition at line 280 of file FileInfo.h.

Member Function Documentation

◆ Attributes()

const FileAttributes& pcl::FileInfo::Attributes ( ) const
inline

Returns a constant reference to the FileAttributes flags for this file or directory.

Definition at line 393 of file FileInfo.h.

◆ Clear()

void pcl::FileInfo::Clear ( )

Clears all the information in this object, leaving it in an invalid state corresponding to a nonexistent item.

◆ CompleteSuffix()

String pcl::FileInfo::CompleteSuffix ( ) const

Returns the complete suffix of the path in this object, or an empty string if the path does not include a suffix.

The returned string includes the initial dot separator.

The complete suffix is the rightmost substring of the path, starting with the first occurrence of a dot character. For example, in 'foo.tar.gz' the complete suffix is '.tar.gz'.

◆ Directory()

String pcl::FileInfo::Directory ( ) const

Returns the parent directory component of the path in this object, or an empty string if the path does not include a parent directory.

On Windows, the drive component of the path is not included.

Examples:

  • In '/foo.tar.gz' the directory is '/'.
  • In '/foo/bar.tar.gz' the directory is '/foo'.
  • In 'foo/bar.tar.gz' the directory is 'foo'.
  • In 'C:/Foo/Bar.txt' the directory is '/Foo'.

◆ Drive()

String pcl::FileInfo::Drive ( ) const

Returns the Windows drive component of the path in this object, or an empty string if the path does not include a Windows drive specification.

This function only makes sense on Windows. On UNIX and Linux operating systems, this function always returns an empty string.

◆ Exists()

bool pcl::FileInfo::Exists ( ) const
inline

Returns true iff this object represents an existing file or directory.

Definition at line 384 of file FileInfo.h.

◆ Extension()

String pcl::FileInfo::Extension ( ) const

Returns the file extension component of the path in this object, or an empty string if the path does not include an extension.

The returned extension includes the initial dot separator.

Examples:

  • In '/foo/bar.tar.gz' the extension is '.gz'.
  • In 'C:/Foo/Bar.txt' the extension is '.txt'.

◆ GroupId()

int pcl::FileInfo::GroupId ( ) const
inline

Returns the group id of the owner of the file or directory item represented by this object.

This member function only makes sense on UNIX/Linux platforms. On Windows it always returns zero.

Definition at line 526 of file FileInfo.h.

◆ IsDirectory()

bool pcl::FileInfo::IsDirectory ( ) const
inline

Returns true iff this object represents an existing directory.

Definition at line 401 of file FileInfo.h.

◆ IsExecutable()

bool pcl::FileInfo::IsExecutable ( ) const
inline

Returns true iff the user id and group id of the caller process have execution access permission for the item represented by this object.

This member function only makes sense on UNIX/Linux platforms. On Windows it always returns false.

On POSIX systems, this function returns true only if the item represented has the S_IXUSR file mode bit set. This means that this function will normally return true for directories, since S_IXUSR/S_IXGRP/S_IXOTH represent standard search permissions for a directory.

Definition at line 477 of file FileInfo.h.

◆ IsFile()

bool pcl::FileInfo::IsFile ( ) const
inline

Returns true iff this object represents an existing file.

Definition at line 409 of file FileInfo.h.

◆ IsHidden()

bool pcl::FileInfo::IsHidden ( ) const
inline

Returns true iff this object represents a hidden file or directory.

On Windows, this member function returns true if the file or directory represented by this object has the hidden attribute set. On UNIX and Linux operating systems, this function returns true when the file or directory name begins with a dot character.

Definition at line 442 of file FileInfo.h.

◆ IsReadable()

bool pcl::FileInfo::IsReadable ( ) const
inline

Returns true iff the user id and group id of the caller process have read access permission for the item represented by this object.

Definition at line 451 of file FileInfo.h.

◆ IsSymbolicLink()

bool pcl::FileInfo::IsSymbolicLink ( ) const
inline

Returns true iff this object represents a symbolic link.

This member function only makes sense on UNIX/Linux platforms. On Windows it always returns false.

Definition at line 420 of file FileInfo.h.

◆ IsWritable()

bool pcl::FileInfo::IsWritable ( ) const
inline

Returns true iff the user id and group id of the caller process have write access permission for the item represented by this object.

Definition at line 460 of file FileInfo.h.

◆ LastAccessed()

const FileTime& pcl::FileInfo::LastAccessed ( ) const
inline

Returns a constant reference to a FileTime structure corresponding to the last access time of this file or directory.

Definition at line 544 of file FileInfo.h.

◆ LastModified()

const FileTime& pcl::FileInfo::LastModified ( ) const
inline

Returns a constant reference to a FileTime structure corresponding to the last modification time of this file or directory.

Definition at line 553 of file FileInfo.h.

◆ Name()

String pcl::FileInfo::Name ( ) const

Returns the file name component of the path in this object, or an empty string if the path does not include a name.

The file extension or suffix is not included.

Examples:

  • In '/foo/bar.tar.gz' the name is 'bar'.
  • In 'C:/Foo/Bar.txt' the name is 'Bar'.

◆ NameAndExtension()

String pcl::FileInfo::NameAndExtension ( ) const

Returns the name and extension of the path in this object. Calling this member function is functionally equivalent to: Name() + Extension().

◆ NameAndSuffix()

String pcl::FileInfo::NameAndSuffix ( ) const
inline

A synonym for NameAndExtension().

Definition at line 376 of file FileInfo.h.

◆ NumberOfHardLinks()

int pcl::FileInfo::NumberOfHardLinks ( ) const
inline

Returns the number of existing hard links to the file or directory item represented by this object.

This member function only makes sense on UNIX/Linux platforms. On Windows it always returns zero.

Definition at line 502 of file FileInfo.h.

◆ operator=()

FileInfo& pcl::FileInfo::operator= ( const FileInfo )
default

Assignment operator. Returns a reference to this object.

◆ Path()

const String& pcl::FileInfo::Path ( ) const
inline

Returns the absolute path of this file or directory.

Definition at line 292 of file FileInfo.h.

◆ Refresh() [1/2]

void pcl::FileInfo::Refresh ( )

Retrieves up-to-date information for the item represented by this object.

◆ Refresh() [2/2]

void pcl::FileInfo::Refresh ( const String path)

Retrieves information for the specified path.

◆ Size()

fsize_type pcl::FileInfo::Size ( ) const
inline

Returns the size in bytes of the file or directory item represented by this object.

If this object represents a directory, a fixed size (usually 4096 bytes) is always returned on UNIX and Linux systems. On Windows, zero is always returned for directories.

Definition at line 490 of file FileInfo.h.

◆ Suffix()

String pcl::FileInfo::Suffix ( ) const
inline

A synonym for Extension().

Definition at line 350 of file FileInfo.h.

◆ SymbolicLinkTarget()

String pcl::FileInfo::SymbolicLinkTarget ( ) const

Returns the target path of this symbolic link, or an empty string if this object does not represent a symbolic link.

This member function only makes sense on UNIX/Linux platforms. On Windows it always returns an empty string.

◆ TimeCreated()

const FileTime& pcl::FileInfo::TimeCreated ( ) const
inline

Returns a constant reference to a FileTime structure corresponding to the creation time of this file or directory.

Definition at line 535 of file FileInfo.h.

◆ UserId()

int pcl::FileInfo::UserId ( ) const
inline

Returns the user id of the owner of the file or directory item represented by this object.

This member function only makes sense on UNIX/Linux platforms. On Windows it always returns zero.

Definition at line 514 of file FileInfo.h.


The documentation for this class was generated from the following file: