file_time Class Reference

A platform independent way to obtain the timestamp of a file. More...

#include <filetime.h>

Inheritance diagram for file_time:

Inheritance graph
[legend]
Collaboration diagram for file_time:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 file_time (FILE *the_file=NIL)
 sets up the file_time information given a the file stream of interest.
 file_time (const istring &filename)
 this constructor operates on a file's name rather than a FILE stream.
 file_time (const time_t &init)
 starts the file_time with a particular "init" time.
virtual ~file_time ()
 IMPLEMENT_CLASS_NAME ("file_time")
void reset (FILE *the_file)
 reacquires the time from a different FILE than constructed with.
void reset (const istring &filename)
 parallel version of reset() takes a file name instead of a stream.
void reset (const time_t &init)
 parallel version of reset() takes a time_t instead of a stream.
bool operator< (const file_time &ft2) const
bool operator<= (const file_time &ft2) const
bool operator== (const file_time &ft2) const
bool operator!= (const file_time &ft2) const
bool operator> (const file_time &ft2) const
bool operator>= (const file_time &ft2) const
time_t raw () const
 provides the OS version of the file's timestamp.
virtual void pack (byte_array &packed_form) const
 Creates a packed form of the packable object in "packed_form".
virtual bool unpack (byte_array &packed_form)
 Restores the packable from the "packed_form".

Detailed Description

A platform independent way to obtain the timestamp of a file.

Definition at line 29 of file filetime.h.


Constructor & Destructor Documentation

file_time::file_time ( FILE *  the_file = NIL  ) 

sets up the file_time information given a the file stream of interest.

If the stream is NIL, then the file_time is set up with an invalid time.

Definition at line 29 of file filetime.cpp.

References reset().

file_time::file_time ( const istring filename  ) 

this constructor operates on a file's name rather than a FILE stream.

Definition at line 37 of file filetime.cpp.

References reset(), and istring::s().

file_time::file_time ( const time_t &  init  ) 

starts the file_time with a particular "init" time.

Definition at line 33 of file filetime.cpp.

file_time::~file_time (  )  [virtual]

Definition at line 47 of file filetime.cpp.


Member Function Documentation

file_time::IMPLEMENT_CLASS_NAME ( "file_time"   ) 

void file_time::reset ( FILE *  the_file  ) 

reacquires the time from a different FILE than constructed with.

this also can connect a FILE to the file_time object after using the empty constructor. further, it can also be used to refresh a file's time to account for changes in its timestamp.

Definition at line 60 of file filetime.cpp.

References fileno, fstat, FUNCDEF, LOG, and stat.

Referenced by file_time(), and reset().

void file_time::reset ( const istring filename  ) 

parallel version of reset() takes a file name instead of a stream.

Definition at line 51 of file filetime.cpp.

References reset(), and istring::s().

void file_time::reset ( const time_t &  init  ) 

parallel version of reset() takes a time_t instead of a stream.

Definition at line 49 of file filetime.cpp.

bool file_time::operator< ( const file_time ft2  )  const

Definition at line 81 of file filetime.cpp.

References compare().

bool file_time::operator<= ( const file_time ft2  )  const

Definition at line 87 of file filetime.cpp.

References compare().

bool file_time::operator== ( const file_time ft2  )  const

Definition at line 96 of file filetime.cpp.

References compare().

bool file_time::operator!= ( const file_time ft2  )  const

Definition at line 93 of file filetime.cpp.

References compare().

bool file_time::operator> ( const file_time ft2  )  const

Definition at line 84 of file filetime.cpp.

References compare().

bool file_time::operator>= ( const file_time ft2  )  const

Definition at line 90 of file filetime.cpp.

References compare().

time_t file_time::raw (  )  const [inline]

provides the OS version of the file's timestamp.

Definition at line 68 of file filetime.h.

void file_time::pack ( byte_array packed_form  )  const [virtual]

Creates a packed form of the packable object in "packed_form".

This must append to the data in "packed_form" rather than clearing prior contents.

Implements packable.

Definition at line 102 of file filetime.cpp.

References array< contents >::insert().

bool file_time::unpack ( byte_array packed_form  )  [virtual]

Restores the packable from the "packed_form".

This object becomes the unpacked form, and therefore must lose any of its prior contents that depend on the data in "packed_form". This is up to the derived unpack function to figure out. The "packed_form" is modified by extracting all of the pieces that are used for this object; the remainder stays in "packed_form". true is returned if the unpacking was successful.

Implements packable.

Definition at line 130 of file filetime.cpp.

References array< contents >::length(), and array< contents >::zap().


The documentation for this class was generated from the following files:
Generated on Fri Nov 28 04:30:46 2008 for HOOPLE Libraries by  doxygen 1.5.1