feisty meow concerns codebase
2.140
|
#include <filename_list.h>
Public Member Functions | |
filename_list () | |
filename_list & | operator= (const filename_list &to_copy) |
int | total_files () const |
returns the number of files currently held in the list. More... | |
double | total_size () const |
returns the full size of all files listed. More... | |
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. More... | |
filename_list & | operator= (const structures::string_array &to_copy) |
void | fill (structures::string_array &to_fill) |
stuffs the array "to_fill" with the filesnames from our list. More... | |
const file_info * | find (const filename &to_check) const |
locates the record of information for the filename "to_check". More... | |
int | locate (const filename &to_find) const |
bool | member (const filename &to_check) const |
finds the index for "to_find" or returns a negative number. More... | |
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. More... | |
basis::astring | text_form (int max_lines=MAXINT32) const |
max_lines is the maximum number of lines to print into the string. More... | |
virtual int | packed_size () const |
Estimates the space needed for the packed structure. More... | |
virtual void | pack (basis::byte_array &packed_form) const |
Creates a packed form of the packable object in "packed_form". More... | |
virtual bool | unpack (basis::byte_array &packed_form) |
Restores the packable from the "packed_form". More... | |
Public Member Functions inherited from structures::amorph< file_info > | |
amorph (int elements=0) | |
constructs an amorph capable of holding "elements" pointers. More... | |
~amorph () | |
int | elements () const |
the maximum number of elements currently allowed in this amorph. More... | |
int | valid_fields () const |
Returns the number of fields that have non-null contents. More... | |
void | adjust (int new_max) |
Changes the maximum number of elements for this amorph. More... | |
void | resize (int new_maximum=0) |
like adjust but doesn't keep existing contents. More... | |
void | reset () |
cleans out all of the contents. More... | |
basis::outcome | put (int field, const file_info *data) |
Enters an object into the field at index "field" in the amorph. More... | |
basis::outcome | append (const file_info *data) |
puts "data" on the end of this amorph. More... | |
basis::outcome | operator+= (const file_info *data) |
a synonym for append. More... | |
const file_info * | get (int field) const |
Returns a constant pointer to the information at the index "field". More... | |
file_info * | borrow (int field) |
Returns a pointer to the information at the index "field". More... | |
const file_info * | operator[] (int field) const |
synonym for get. More... | |
file_info * | operator[] (int field) |
synonym for borrow. More... | |
file_info * | acquire (int field) |
Retrieves a "field" from the amorph, taking responsibility for it back. More... | |
basis::outcome | clear (int field) |
Clears the contents of the field specified. More... | |
void | clear_all () |
Clears every field in the amorph. More... | |
basis::outcome | zap (int start, int end) |
Removes a range of indices from the amorph. More... | |
basis::outcome | insert (int position, int lines_to_add) |
Adds "lines_to_add" indices to the amorph at the index "position". More... | |
int | find_empty (basis::outcome &o) const |
Returns the index of a free field if there are any. More... | |
const file_info * | next_valid (int &field) const |
Returns the contents of the next valid element at or after "field". More... | |
int | find (const file_info *to_locate, basis::outcome &o) |
Searches the amorph for the contents specified. More... | |
void | swap_contents (amorph< file_info > &other) |
Exchanges the contents of "this" and "other". More... | |
Additional Inherited Members | |
Protected Types inherited from basis::array< contents > | |
enum | specialc_flags { NO_SPECIAL_MODES = 0x0 , SIMPLE_COPY = 0x1 , EXPONENTIAL_GROWTH = 0x2 , EXPONE = EXPONENTIAL_GROWTH , FLUSH_INVISIBLE = 0x4 } |
the flags specify how the array treats its contents and its length. More... | |
enum | how_to_copy { NEW_AT_END , NEW_AT_BEGINNING , DONT_COPY } |
enum | shift_directions { TO_LEFT , TO_RIGHT } |
Protected Member Functions inherited from basis::array< contents > | |
DEFINE_CLASS_NAME ("array") | |
array (int number=0, const contents *init=NULL_POINTER, int flags=EXPONENTIAL_GROWTH|FLUSH_INVISIBLE) | |
Constructs an array with room for "number" objects. More... | |
array (const array< contents > ©_from) | |
copies the contents & sizing information from "copy_from". More... | |
virtual | ~array () |
destroys the memory allocated for the objects. More... | |
void | reset (int number=0, const contents *initial_contents=NULL_POINTER) |
Resizes this array and sets the contents from an array of contents. More... | |
array & | operator= (const array< contents > ©_from) |
Copies the array in "copy_from" into this. More... | |
int | length () const |
Returns the current reported length of the allocated C array. More... | |
int | last () const |
Returns the last valid element in the array. More... | |
int | flags () const |
Provides the raw flags value, without interpreting what it means. More... | |
bool | exponential () const |
Returns true if this allocator will grow exponentially on resize. More... | |
bool | simple () const |
Reports whether the templated object is a simple type or not. More... | |
const contents & | get (int index) const |
Accesses individual objects stored in "this" at the "index" position. More... | |
contents & | use (int index) |
A non-constant version of get(); the returned object can be modified. More... | |
const contents & | operator[] (int index) const |
Synonym for get that provides the expected array indexing syntax. More... | |
contents & | operator[] (int index) |
Synonym for use that provides the expected array indexing syntax. More... | |
outcome | put (int index, const contents &to_put) |
Stores an object at the index "index" in the array. More... | |
array | concatenation (const array &to_concatenate) const |
Returns the concatenation of "this" and the array "to_concatenate". More... | |
array | concatenation (const contents &to_concatenate) const |
Returns the concatenation of "this" and the object "to_concatenate". More... | |
array & | concatenate (const array &to_concatenate) |
Appends the array "to_concatenate" onto "this" and returns "this". More... | |
array & | concatenate (const contents &to_concatenate) |
Appends the object "to_concatenate" onto "this" and returns "this". More... | |
array & | concatenate (const contents *to_concatenate, int length) |
Concatenates a C-array "to_concatenate" onto "this" and returns "this". More... | |
array | operator+ (const array &to_cat) const |
Synonym for concatenation. More... | |
array | operator+ (const contents &to_concatenate) const |
Synonym for concatenation. More... | |
array & | operator+= (const array &to_concatenate) |
Synonym for concatenate that modifies "this". More... | |
array & | operator+= (const contents &to_concatenate) |
Synonym for concatenate that modifies "this". More... | |
const contents * | observe () const |
Returns a pointer to the underlying C array of data. More... | |
contents * | access () |
A non-constant access of the underlying C-array. BE REALLY CAREFUL. More... | |
void | swap_contents (array< contents > &other) |
Exchanges the contents of "this" and "other". More... | |
void | snarf (array &new_contents) |
Drops "this" array's contents into the dustbin and uses "new_contents". More... | |
array | subarray (int start, int end) const |
Returns the array segment between the indices "start" and "end". More... | |
outcome | insert (int index, int new_indices) |
Adds "new_indices" new positions for objects into the array at "index". More... | |
outcome | overwrite (int index, const array &write_with, int count=-1) |
Stores the array "write_with" into the current array at the "index". More... | |
outcome | stuff (int length, contents *to_stuff) const |
Copies at most "length" elements from this into the array "to_stuff". More... | |
outcome | resize (int new_size, how_to_copy way=NEW_AT_END) |
Changes the size of the C array to "new_size". More... | |
outcome | zap (int start, int end) |
Deletes from "this" the objects inclusively between "start" and "end". More... | |
outcome | shrink () |
Cuts loose any allocated space that is beyond the real length. More... | |
outcome | retrain (int new_size, const contents *to_copy) |
Resizes the C array and stuffs it with the contents in "to_copy". More... | |
void | shift_data (shift_directions where) |
The valid portion of the array is moved to the left or right. More... | |
int | internal_real_length () const |
Gritty Internal: the real allocated length. More... | |
int | internal_offset () const |
Gritty Internal: the offset from real start to stored data. More... | |
const contents * | internal_block_start () const |
Gritty Internal: constant peek at the real allocated pointer. More... | |
contents * | internal_block_start () |
Gritty Internal: the real allocated pointer made accessible. More... | |
contents *const * | internal_offset_mem () const |
Gritty Internal: the start of the actual stored data. More... | |
Definition at line 34 of file filename_list.h.
filesystem::filename_list::filename_list | ( | ) |
Definition at line 26 of file filename_list.cpp.
bool filesystem::filename_list::calculate_progress | ( | const filename & | file, |
double | current_offset, | ||
int & | current_file, | ||
double & | current_size | ||
) |
given the last "file" and position, this returns current positioning.
the "current_file" is set to the index of the "file" in the list (using 1-based numbering for a 1,2,3,... series), and the "current_size" is set to the total amount of bytes processed so far.
Definition at line 57 of file filename_list.cpp.
References structures::amorph< file_info >::get(), locate(), basis::negative(), filesystem::filename::raw(), and basis::astring::t().
void filesystem::filename_list::fill | ( | structures::string_array & | to_fill | ) |
stuffs the array "to_fill" with the filesnames from our list.
Definition at line 88 of file filename_list.cpp.
References structures::amorph< file_info >::elements(), structures::amorph< file_info >::get(), and basis::array< contents >::reset().
Referenced by filesystem::directory_tree::current().
locates the record of information for the filename "to_check".
do not modify the returned object. it contains the current state of the file in question. if the file wasn't in the list, then NULL_POINTER is returned.
Definition at line 96 of file filename_list.cpp.
References structures::amorph< file_info >::elements(), structures::amorph< file_info >::get(), basis::astring::iequals(), NULL_POINTER, and filesystem::filename::raw().
Referenced by filesystem::directory_tree::add_path(), and filesystem::heavy_file_operations::buffer_files().
int filesystem::filename_list::locate | ( | const filename & | to_find | ) | const |
Definition at line 108 of file filename_list.cpp.
References structures::amorph< file_info >::elements(), structures::amorph< file_info >::get(), basis::astring::iequals(), and filesystem::filename::raw().
Referenced by calculate_progress(), and filesystem::directory_tree::remove_path().
bool filesystem::filename_list::member | ( | const filename & | to_check | ) | const |
finds the index for "to_find" or returns a negative number.
returns true if "to_check" is listed here.
Definition at line 120 of file filename_list.cpp.
References structures::amorph< file_info >::elements(), structures::amorph< file_info >::get(), basis::astring::iequals(), and filesystem::filename::raw().
Referenced by filesystem::directory_tree::remove_path().
bool filesystem::filename_list::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.
this will fail if the file name isn't present at all. and then it will also not return true if the size is different (when EQUAL_FILESIZE is true), when the timestamp is different (when EQUAL_TIMESTAMP is true), and when the checksum is different (you get the idea).
Definition at line 132 of file filename_list.cpp.
References filesystem::file_info::_checksum, filesystem::file_info::_file_size, filesystem::file_info::_time, structures::amorph< file_info >::elements(), filesystem::file_info::EQUAL_CHECKSUM, filesystem::file_info::EQUAL_FILESIZE, filesystem::file_info::EQUAL_TIMESTAMP, structures::amorph< file_info >::get(), basis::astring::iequals(), and filesystem::filename::raw().
Referenced by filesystem::directory_tree::compare_trees().
filename_list & filesystem::filename_list::operator= | ( | const filename_list & | to_copy | ) |
Definition at line 28 of file filename_list.cpp.
References structures::amorph< file_info >::append(), structures::amorph< contents >::elements(), structures::amorph< contents >::get(), and structures::amorph< file_info >::reset().
filename_list & filesystem::filename_list::operator= | ( | const structures::string_array & | to_copy | ) |
Definition at line 79 of file filename_list.cpp.
References structures::amorph< file_info >::append(), basis::array< contents >::length(), and structures::amorph< file_info >::reset().
|
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 basis::packable.
Definition at line 43 of file filename_list.cpp.
References structures::amorph_pack().
Referenced by filesystem::filename_tree::pack().
|
virtual |
Estimates the space needed for the packed structure.
Implements basis::packable.
Definition at line 40 of file filename_list.cpp.
References structures::amorph_packed_size().
Referenced by filesystem::filename_tree::packed_size().
max_lines is the maximum number of lines to print into the string.
Definition at line 155 of file filename_list.cpp.
References structures::amorph< file_info >::elements(), and structures::amorph< file_info >::get().
int filesystem::filename_list::total_files | ( | ) | const |
returns the number of files currently held in the list.
Definition at line 38 of file filename_list.cpp.
References structures::amorph< file_info >::elements().
double filesystem::filename_list::total_size | ( | ) | const |
returns the full size of all files listed.
Definition at line 49 of file filename_list.cpp.
References structures::amorph< file_info >::elements(), and structures::amorph< file_info >::get().
|
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 basis::packable.
Definition at line 46 of file filename_list.cpp.
References structures::amorph_unpack().
Referenced by octopi::recursive_file_copy::copy_hierarchy(), and filesystem::filename_tree::unpack().