add remove_subfile(string)

This commit is contained in:
David Rose 2009-08-06 21:16:03 +00:00
parent 3cc301259a
commit ddaf3f172f
2 changed files with 26 additions and 0 deletions

View File

@ -328,6 +328,31 @@ get_encryption_iteration_count() const {
return _encryption_iteration_count;
}
////////////////////////////////////////////////////////////////////
// Function: Multifile::remove_subfile
// Access: Published
// Description: Removes the named subfile from the Multifile, if it
// exists; returns true if successfully removed, or
// false if it did not exist in the first place. The
// file will not actually be removed from the disk until
// the next call to flush().
//
// Note that this does not actually remove the data from
// the indicated subfile; it simply removes it from the
// index. The Multifile will not be reduced in size
// after this operation, until the next call to
// repack().
////////////////////////////////////////////////////////////////////
INLINE bool Multifile::
remove_subfile(const string &subfile_name) {
int index = find_subfile(subfile_name);
if (index >= 0) {
remove_subfile(index);
return true;
}
return false;
}
////////////////////////////////////////////////////////////////////
// Function: Multifile::read_subfile
// Access: Published

View File

@ -90,6 +90,7 @@ PUBLISHED:
bool scan_directory(vector_string &contents,
const string &subfile_name) const;
void remove_subfile(int index);
INLINE bool remove_subfile(const string &subfile_name);
const string &get_subfile_name(int index) const;
MAKE_SEQ(get_subfile_names, get_num_subfiles, get_subfile_name);
size_t get_subfile_length(int index) const;