Jpp  18.2.1-ARCA-DF-PATCH
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | List of all members
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. More...
 
 JStat (const char *file_name)
 Constructor. More...
 
virtual bool getStatus () const override
 Get status of object. More...
 
const JStatget (const char *file_name)
 Get status of file. More...
 
const JStatoperator() (const char *file_name)
 Get status of file. More...
 
uid_t getUID () const
 Get UID of file. More...
 
uid_t getGID () const
 Get GID of file. More...
 
off_t getSize () const
 Get size of file. More...
 
JDateAndTime getTimeOfLastAccess () const
 Get time of last access. More...
 
JDateAndTime getTimeOfLastModification () const
 Get time of last modification. More...
 
JDateAndTime getTimeOfLastChange () const
 Get time of last change. More...
 
int getError () const
 Get error of last call. More...
 
 operator bool () const
 Type conversion operator. More...
 
bool operator! () const
 Negated status of this object. More...
 

Public Attributes

int error
 error code from last call More...
 

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

JSYSTEM::JStat::JStat ( )
inline

Default constructor.

Definition at line 35 of file JStat.hh.

36  {}
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  }

Member Function Documentation

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
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  }
int error
error code from last call
Definition: JStat.hh:166
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  }
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  }
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  }
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  }
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  }
Auxiliary class for date and time.
Definition: JDateAndTime.hh:78
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  }
Auxiliary class for date and time.
Definition: JDateAndTime.hh:78
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  }
Auxiliary class for date and time.
Definition: JDateAndTime.hh:78
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  }
int error
error code from last call
Definition: JStat.hh:166
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.
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  }
virtual bool getStatus() const =0
Get status of object.

Member Data Documentation

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: