reverted part of the file_storage API to match the previous one more closly

This commit is contained in:
Arvid Norberg
2010-11-29 05:44:29 +00:00
parent f82321c1dd
commit 2e69366b02
13 changed files with 232 additions and 195 deletions

View File

@@ -173,12 +173,12 @@ file structure. Its synopsis::
int piece_length() const;
int piece_size(int index) const;
sha1_hash const& hash(file_entry const& fe) const;
std::string const& symlink(file_entry const& fe) const;
time_t mtime(file_entry const& fe) const;
int file_index(file_entry const& fe) const;
size_type file_base(file_entry const& fe) const;
void set_file_base(file_entry const& fe, size_type off);
sha1_hash const& hash(internal_file_entry const& fe) const;
std::string const& symlink(internal_file_entry const& fe) const;
time_t mtime(internal_file_entry const& fe) const;
int file_index(internal_file_entry const& fe) const;
size_type file_base(internal_file_entry const& fe) const;
void set_file_base(internal_file_entry const& fe, size_type off);
void set_name(std::string const& n);
void set_name(std::wstring const& n);
@@ -193,8 +193,8 @@ add_file()
::
void add_file(file_entry const& e);
void add_file(fs::path const& p, size_type size, int flags = 0);
void add_file(fs::wpath const& p, size_type size, int flags = 0);
void add_file(std::string const& p, size_type size, int flags = 0);
void add_file(std::wstring const& p, size_type size, int flags = 0);
Adds a file to the file storage. The ``flags`` argument sets attributes on the file.
The file attributes is an extension and may not work in all bittorrent clients.
@@ -204,17 +204,8 @@ The possible arreibutes are::
attribute_hidden
attribute_executable
add_file
--------
::
void add_file(file_entry const& e);
void add_file(fs::path const& p, size_type size);
Adds a file to the file storage. If more files than one are added,
certain restrictions to their paths apply. In a multi-file file
storage (torrent), all files must share the same root directory.
If more files than one are added, certain restrictions to their paths apply.
In a multi-file file storage (torrent), all files must share the same root directory.
That is, the first path element of all files must be the same.
This shared path element is also set to the name of the torrent. It
@@ -228,13 +219,14 @@ hash() symlink() mtime() file_index()
::
sha1_hash hash(file_entry const& fe) const;
std::string const& symlink(file_entry const& fe) const;
time_t mtime(file_entry const& fe) const;
int file_index(file_entry const& fe) const;
sha1_hash hash(internal_file_entry const& fe) const;
std::string const& symlink(internal_file_entry const& fe) const;
time_t mtime(internal_file_entry const& fe) const;
int file_index(internal_file_entry const& fe) const;
These functions are used to query the symlink, file hash,
modification time and the file-index from a ``file_entry``.
modification time and the file-index from a ``internal_file_entry``,
which typically would be acquired from an iterator.
For these functions to function, the file entry must be an
actual object from this same ``file_storage`` object. It may
@@ -255,8 +247,8 @@ file_base() set_file_base()
::
size_type file_base(file_entry const& fe) const;
void set_file_base(file_entry const& fe, size_type off);
size_type file_base(internal_file_entry const& fe) const;
void set_file_base(internal_file_entry const& fe, size_type off);
The file base of a file is the offset within the file on the filsystem
where it starts to write. For the most part, this is always 0. It's