30 if (
this == &to_copy)
return *
this;
32 for (
int i = 0; i < to_copy.
elements(); i++) {
53 to_return +=
get(i)->_file_size;
58 double current_offset,
int ¤t_file,
double ¤t_size)
64 if (file.
raw().
t())
return false;
69 current_file = posn + 1;
70 double size_finished = 0;
72 for (
int i = 0; i < posn; i++) {
73 size_finished +=
get(i)->_file_size;
75 current_size = size_finished + current_offset;
82 for (
int i = 0; i < to_copy.
length(); i++) {
91 for (
int i = 0; i <
elements(); i++) {
92 to_fill +=
get(i)->raw();
98 for (
int i = 0; i <
elements(); i++) {
99#if defined(__WIN32__) || defined(__VMS__)
102 if (to_check.
raw() ==
get(i)->raw())
return get(i);
110 for (
int i = 0; i <
elements(); i++) {
111#if defined(__WIN32__) || defined(__VMS__)
114 if (to_find.
raw() ==
get(i)->raw())
return i;
117 return common::NOT_FOUND;
122 for (
int i = 0; i <
elements(); i++) {
123#if defined(__WIN32__) || defined(__VMS__)
126 if (to_check.
raw() ==
get(i)->raw())
return true;
134 for (
int i = 0; i <
elements(); i++) {
135#if defined(__WIN32__) || defined(__VMS__)
138 if (to_check.
raw() ==
get(i)->raw()) {
158 for (
int i = 0; i <
elements(); i++) {
a_sprintf is a specialization of astring that provides printf style support.
void reset(int number=0, const contents *initial_contents=NULL_POINTER)
Resizes this array and sets the contents from an array of contents.
int length() const
Returns the current reported length of the allocated C array.
Provides a dynamically resizable ASCII character string.
bool t() const
t() is a shortcut for the string being "true", as in non-empty.
virtual void text_form(base_string &state_fill) const
Provides a text view of all the important info owned by this object.
bool iequals(const astring &that) const
returns true if this is case-insensitively equal to "that".
A very common template for a dynamic array of bytes.
Encapsulates some measures and calculations based on a file's contents.
double _file_size
the size of the file.
int _checksum
the checksum for the file.
file_time _time
the file's access time.
file_similarity
this enum encapsulates how files may be compared.
bool member(const filename &to_check) const
finds the index for "to_find" or returns a negative number.
bool member_with_state(const file_info &to_check, file_info::file_similarity comparison_method)
returns true if the file "to_check" exists in the list with appropriate equivalence.
virtual void pack(basis::byte_array &packed_form) const
Creates a packed form of the packable object in "packed_form".
basis::astring text_form(int max_lines=MAXINT32) const
max_lines is the maximum number of lines to print into the string.
virtual bool unpack(basis::byte_array &packed_form)
Restores the packable from the "packed_form".
int total_files() const
returns the number of files currently held in the list.
const file_info * find(const filename &to_check) const
locates the record of information for the filename "to_check".
double total_size() const
returns the full size of all files listed.
filename_list & operator=(const filename_list &to_copy)
int locate(const filename &to_find) const
bool calculate_progress(const filename &file, double current_offset, int ¤t_file, double ¤t_size)
given the last "file" and position, this returns current positioning.
void fill(structures::string_array &to_fill)
stuffs the array "to_fill" with the filesnames from our list.
virtual int packed_size() const
Estimates the space needed for the packed structure.
Provides operations commonly needed on file names.
const basis::astring & raw() const
returns the astring that we're holding onto for the path.
int elements() const
the maximum number of elements currently allowed in this amorph.
void reset()
cleans out all of the contents.
const contents * get(int field) const
Returns a constant pointer to the information at the index "field".
An array of strings with some additional helpful methods.
static const char * platform_eol_to_chars()
provides the characters that make up this platform's line ending.
#define NULL_POINTER
The value representing a pointer to nothing.
The guards collection helps in testing preconditions and reporting errors.
bool negative(const type &a)
negative returns true if "a" is less than zero.
A platform independent way to obtain the timestamp of a file.
A dynamic container class that holds any kind of object via pointers.
void amorph_pack(basis::byte_array &packed_form, const amorph< contents > &to_pack)
support for packing an amorph into an array of bytes.
int amorph_packed_size(const amorph< contents > &to_pack)
reports how large the packed form will be.
bool amorph_unpack(basis::byte_array &packed_form, amorph< contents > &to_unpack)
unpacks the amorph from an array of bytes.