Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
LUPI::FileInfo::FileStat Class Reference

#include <LUPI.hpp>

Public Member Functions

 FileStat (std::string const &a_path)
std::string const & path () const
struct stat const & statRef () const
bool exists ()
bool isDirectory () const
bool isRegularFile () const

Detailed Description

Definition at line 408 of file LUPI.hpp.

Constructor & Destructor Documentation

◆ FileStat()

LUPI::FileInfo::FileStat::FileStat ( std::string const & a_path)

Calls the C stat function and stores its information.

Parameters
a_path[in] The path (e.g., file, directory) whose stat is determined.

Definition at line 195 of file LUPI_file.cc.

195 :
196 m_path( a_path ) {
197
198 int error = stat( a_path.c_str( ), &m_stat );
199
200 if( error != 0 ) {
201 switch( error ) {
202 case EACCES :
203 throw Exception( "FileStat::FileStat: Permission denied for file '" + a_path + "'.." );
204 case EIO :
205 throw Exception( "FileStat::FileStat: An error occurred while stat-ing file '" + a_path + "'.." );
206 case ELOOP :
207 throw Exception( "FileStat::FileStat: A loop exists in symbolic links for file '" + a_path + "'.." );
208 case ENAMETOOLONG :
209 throw Exception( "FileStat::FileStat: Path name too long '" + a_path + "'." );
210 case ENOENT :
211 throw Exception( "FileStat::FileStat: No such path '" + a_path + "'." );
212 case ENOTDIR :
213 throw Exception( "FileStat::FileStat: A component of the path prefix is not a directory '" + a_path + "'." );
214 case EOVERFLOW :
215 throw Exception( "FileStat::FileStat: File too big: '" + a_path + "'." );
216 default :
217 throw Exception( "FileStat::FileStat: Unknown error from C function 'stat' for file '" + a_path + "'." );
218 }
219 }
220}

Member Function Documentation

◆ exists()

bool LUPI::FileInfo::FileStat::exists ( )

◆ isDirectory()

bool LUPI::FileInfo::FileStat::isDirectory ( ) const
inline

Returns true if the path is a directory and false otherwise.

Definition at line 421 of file LUPI.hpp.

Referenced by LUPI::FileInfo::isDirectory().

◆ isRegularFile()

bool LUPI::FileInfo::FileStat::isRegularFile ( ) const
inline

Returns true if the path is a regular file and false otherwise.

Definition at line 422 of file LUPI.hpp.

◆ path()

std::string const & LUPI::FileInfo::FileStat::path ( ) const
inline

Returns a reference to the m_path member.

Definition at line 417 of file LUPI.hpp.

◆ statRef()

struct stat const & LUPI::FileInfo::FileStat::statRef ( ) const
inline

Returns a reference to the m_stat member.

Definition at line 418 of file LUPI.hpp.


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