#include <file_info.h>
Inheritance diagram for file_info:


Public Member Functions | |
| file_info (const filename &to_copy=filename(), double file_size=0, int checksum=0) | |
| to get the real file size and checksum, invoke the calculate method. | |
| file_info (const file_info &to_copy) | |
| virtual | ~file_info () |
| IMPLEMENT_CLASS_NAME ("file_info") | |
| file_info & | operator= (const file_info &to_copy) |
| istring | text_form () const |
| bool | calculate (const istring &prefix, bool just_size=false, int checksum_edge=512 *KILOBYTE) |
| fills in the correct file size and checksum information for this file. | |
| const istring & | secondary () const |
| observes the alternate form of the name. | |
| void | secondary (const istring &new_sec) const |
| accesses the alternate form of the name. | |
| const byte_array & | attachment () const |
| returns the chunk of data optionally attached to the file's info. | |
| void | attachment (const byte_array &new_attachment) |
| sets the optional chunk of data hooked up to the file's info. | |
| 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". | |
Public Attributes | |
| double | _file_size |
| the size of the file. | |
| int | _checksum |
| the checksum for the file. | |
Definition at line 24 of file file_info.h.
| file_info::file_info | ( | const filename & | to_copy = filename(), |
|
| double | file_size = 0, |
|||
| int | checksum = 0 | |||
| ) |
to get the real file size and checksum, invoke the calculate method.
Definition at line 32 of file file_info.cpp.
| file_info::file_info | ( | const file_info & | to_copy | ) |
Definition at line 40 of file file_info.cpp.
| file_info::~file_info | ( | ) | [virtual] |
| file_info::IMPLEMENT_CLASS_NAME | ( | "file_info" | ) |
Definition at line 182 of file file_info.cpp.
References _attachment, _checksum, _file_size, and _secondary.
| istring file_info::text_form | ( | ) | const |
Definition at line 65 of file file_info.cpp.
References _checksum, _file_size, filename::raw(), and istring::t().
Referenced by directory_tree::compare_trees(), and filename_list::text_form().
| bool file_info::calculate | ( | const istring & | prefix, | |
| bool | just_size = false, |
|||
| int | checksum_edge = 512 *KILOBYTE | |||
| ) |
fills in the correct file size and checksum information for this file.
note that the file must exist for this to work. if "just_size" is true, then the checksum is not calculated. if the "prefix" is not empty, then it is used as a directory path that needs to be added to the filename to make it completely valid. this is common if the filename is stored relative to a path. the "checksum_edge" is used for checksum calculations; only 2 * checksum_edge bytes will be factored in, each part from the head and tail ends of the file.
Definition at line 74 of file file_info.cpp.
References _checksum, _file_size, DEBUG_FILE_INFO, filename::exists(), byte_filer::FROM_START, FUNCDEF, array< contents >::length(), LOG, minimum(), array< contents >::observe(), huge_file::OKAY, filename::raw(), utility::rolling_fletcher_checksum(), and istring::t().
| const istring & file_info::secondary | ( | ) | const |
observes the alternate form of the name.
Definition at line 60 of file file_info.cpp.
Referenced by directory_tree::compare_trees().
| void file_info::secondary | ( | const istring & | new_sec | ) | const |
| const byte_array & file_info::attachment | ( | ) | const |
returns the chunk of data optionally attached to the file's info.
this supports extending the file's record with extra data that might be needed during processing.
Definition at line 55 of file file_info.cpp.
| void file_info::attachment | ( | const byte_array & | new_attachment | ) |
sets the optional chunk of data hooked up to the file's info.
Definition at line 57 of file file_info.cpp.
| void file_info::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.
Reimplemented from filename.
Definition at line 158 of file file_info.cpp.
References _checksum, _file_size, basis::attach(), istring::pack(), and filename::pack().
| bool file_info::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.
Reimplemented from filename.
Definition at line 167 of file file_info.cpp.
References _checksum, _file_size, basis::detach(), istring::unpack(), and filename::unpack().
| double file_info::_file_size |
the size of the file.
Definition at line 27 of file file_info.h.
Referenced by calculate(), filename_list::member(), operator=(), pack(), text_form(), filename_list::total_size(), and unpack().
the checksum for the file.
Definition at line 28 of file file_info.h.
Referenced by calculate(), filename_list::member(), operator=(), pack(), text_form(), and unpack().
1.5.1