UTILLib 2.0
Common C++ library with utilities.
Loading...
Searching...
No Matches
util::log::IFile Class Reference

Class that wraps a file object in a directory. More...

#include <ifile.h>

Public Member Functions

 IFile ()=default
 Default constructor.
 IFile (const std::string &filename)
 Constructor with a filename as input.
 IFile (const IFile &source)=default
 Default copy constructor.
virtual ~IFile ()
 Destructor.
std::string Name () const
 Name (stem) without path and extension.
void Filename (const std::string &filename)
 Sets the filename.
const std::string & Filename () const
 Returns the filename including the path.
void Checksum (const std::string &checksum)
 Sets a file checksum.
const std::string & Checksum () const
 Returns the file checksum.
void Modified (uint64_t ns1970)
 Sets the last change time for the file.
uint64_t Modified () const
 Returns the last change time.
void FileSize (uint64_t size)
 Sets the file size.
uint64_t FileSize () const
 Return the file size in bytes.

Detailed Description

The IFile class is a simple wrapper around a file in an IDirectory object. The IFile objects are normally created when calling the IDirectory::ScanDirectory() function.

Constructor & Destructor Documentation

◆ IFile()

util::log::IFile::IFile ( const std::string & filename)
explicit

Constructor with a filename as input.

Parameters
filenameFilename with ful path.

Member Function Documentation

◆ Checksum() [1/2]

const std::string & util::log::IFile::Checksum ( ) const
inlinenodiscard

Returns the file checksum string. Note that the file checksum is not populated by this class as it take some time to do the calculation. The NDF library have this functionality.

Returns
File checksum string.

◆ Checksum() [2/2]

void util::log::IFile::Checksum ( const std::string & checksum)
inline

Sets a file checksum for example MD%. File checksum is a fast way of detecting if the file has changed.

Parameters
checksumChecksum hexadecimal string

◆ Filename() [1/2]

const std::string & util::log::IFile::Filename ( ) const
inlinenodiscard

Returns the filename including the path.

Returns

◆ Filename() [2/2]

void util::log::IFile::Filename ( const std::string & filename)

Sets the filename.

Parameters
filenameFile name with full path.

◆ FileSize() [1/2]

uint64_t util::log::IFile::FileSize ( ) const
inlinenodiscard

Returns the file size in bytes.

Returns
File size in bytes.

◆ FileSize() [2/2]

void util::log::IFile::FileSize ( uint64_t size)
inline

Setas the file size in bytes.This class sets this property when the class is created or when the file name is set.

Parameters
sizeFile size in bytes.

◆ Modified() [1/2]

uint64_t util::log::IFile::Modified ( ) const
inlinenodiscard

Returns the last change time. This class sets this time when the class is created or the file name is set.

Returns
Name-second since 1970.

◆ Modified() [2/2]

void util::log::IFile::Modified ( uint64_t ns1970)
inline

Sets the last change time for the file. This class actual set this property when the file is scanned by the IDirectory::ScanDirectory().

Parameters
ns1970Nano-second since 1970.

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