Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JSYSTEM::JStat Struct Reference

Auxiliary class for file status. More...

#include <JStat.hh>

Inheritance diagram for JSYSTEM::JStat:
JLANG::JAbstractObjectStatus

Public Member Functions

 JStat ()
 Default constructor.
 
 JStat (const char *file_name)
 Constructor.
 
virtual bool getStatus () const override
 Get status of object.
 
const JStatget (const char *file_name)
 Get status of file.
 
const JStatoperator() (const char *file_name)
 Get status of file.
 
uid_t getUID () const
 Get UID of file.
 
uid_t getGID () const
 Get GID of file.
 
off_t getSize () const
 Get size of file.
 
JDateAndTime getTimeOfLastAccess () const
 Get time of last access.
 
JDateAndTime getTimeOfLastModification () const
 Get time of last modification.
 
JDateAndTime getTimeOfLastChange () const
 Get time of last change.
 
int getError () const
 Get error of last call.
 
 operator bool () const
 Type conversion operator.
 
bool operator! () const
 Negated status of this object.
 

Public Attributes

int error
 error code from last call
 

Detailed Description

Auxiliary class for file status.

This class encapsulates the stat data structure.

Definition at line 28 of file JStat.hh.

Constructor & Destructor Documentation

◆ JStat() [1/2]

JSYSTEM::JStat::JStat ( )
inline

Default constructor.

Definition at line 35 of file JStat.hh.

36 {}

◆ JStat() [2/2]

JSYSTEM::JStat::JStat ( const char * file_name)
inline

Constructor.

Parameters
file_namefile name

Definition at line 44 of file JStat.hh.

45 {
46 get(file_name);
47 }
const JStat & get(const char *file_name)
Get status of file.
Definition JStat.hh:67

Member Function Documentation

◆ getStatus()

virtual bool JSYSTEM::JStat::getStatus ( ) const
inlineoverridevirtual

Get status of object.

Returns
status of this object

Implements JLANG::JAbstractObjectStatus.

Definition at line 55 of file JStat.hh.

56 {
57 return this->error == 0;
58 }
int error
error code from last call
Definition JStat.hh:166

◆ get()

const JStat & JSYSTEM::JStat::get ( const char * file_name)
inline

Get status of file.

Parameters
file_namefile name
Returns
file status

Definition at line 67 of file JStat.hh.

68 {
69 if (::stat(file_name, static_cast<stat*>(this)) != 0)
70 this->error = errno;
71 else
72 this->error = 0;
73
74 return *this;
75 }

◆ operator()()

const JStat & JSYSTEM::JStat::operator() ( const char * file_name)
inline

Get status of file.

Parameters
file_namefile name
Returns
file status

Definition at line 84 of file JStat.hh.

85 {
86 return get(file_name);
87 }

◆ getUID()

uid_t JSYSTEM::JStat::getUID ( ) const
inline

Get UID of file.

Returns
UID

Definition at line 95 of file JStat.hh.

96 {
97 return this->st_uid;
98 }

◆ getGID()

uid_t JSYSTEM::JStat::getGID ( ) const
inline

Get GID of file.

Returns
GID

Definition at line 106 of file JStat.hh.

107 {
108 return this->st_gid;
109 }

◆ getSize()

off_t JSYSTEM::JStat::getSize ( ) const
inline

Get size of file.

Returns
size [B]

Definition at line 117 of file JStat.hh.

118 {
119 return this->st_size;
120 }

◆ getTimeOfLastAccess()

JDateAndTime JSYSTEM::JStat::getTimeOfLastAccess ( ) const
inline

Get time of last access.

Returns
date and time

Definition at line 128 of file JStat.hh.

129 {
130 return JDateAndTime(this->st_atime);
131 }

◆ getTimeOfLastModification()

JDateAndTime JSYSTEM::JStat::getTimeOfLastModification ( ) const
inline

Get time of last modification.

Returns
date and time

Definition at line 139 of file JStat.hh.

140 {
141 return JDateAndTime(this->st_mtime);
142 }

◆ getTimeOfLastChange()

JDateAndTime JSYSTEM::JStat::getTimeOfLastChange ( ) const
inline

Get time of last change.

Returns
date and time

Definition at line 150 of file JStat.hh.

151 {
152 return JDateAndTime(this->st_ctime);
153 }

◆ getError()

int JSYSTEM::JStat::getError ( ) const
inline

Get error of last call.

Returns
error

Definition at line 161 of file JStat.hh.

162 {
163 return this->error;
164 }

◆ operator bool()

JLANG::JAbstractObjectStatus::operator bool ( ) const
inlineinherited

Type conversion operator.

Returns
status of this object

Definition at line 33 of file JAbstractObjectStatus.hh.

34 {
35 return this->getStatus();
36 }
virtual bool getStatus() const =0
Get status of object.

◆ operator!()

bool JLANG::JAbstractObjectStatus::operator! ( ) const
inlineinherited

Negated status of this object.

Returns
negated status of this object

Definition at line 44 of file JAbstractObjectStatus.hh.

45 {
46 return !(this->getStatus());
47 }

Member Data Documentation

◆ error

int JSYSTEM::JStat::error

error code from last call

Definition at line 166 of file JStat.hh.


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