~ubuntu-branches/ubuntu/maverick/libtorrent-rasterbar/maverick

« back to all changes in this revision

Viewing changes to include/libtorrent/file_storage.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Sauthier
  • Date: 2010-08-10 12:59:37 UTC
  • mfrom: (1.3.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20100810125937-jbcmmf17y8yo9hgz
Tags: 0.15.0-0ubuntu1
* New upstream version.
* debian/patches/100_fix_html_docs.patch: refreshed.
* debian/control: bump up standards-version to 3.9.1 (no changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
36
36
#include <string>
37
37
#include <vector>
 
38
#include <ctime>
38
39
 
39
40
#ifdef _MSC_VER
40
41
#pragma warning(push, 1)
56
57
 
57
58
        struct TORRENT_EXPORT file_entry
58
59
        {
59
 
                file_entry(): offset(0), size(0), file_base(0) {}
 
60
                file_entry(): offset(0), size(0), file_base(0)
 
61
                        , mtime(0), pad_file(false), hidden_attribute(false)
 
62
                        , executable_attribute(false)
 
63
                        , symlink_attribute(false)
 
64
                {}
60
65
 
61
66
                fs::path path;
62
67
                size_type offset; // the offset of this file inside the torrent
65
70
                // This is always 0 unless parts of the torrent is
66
71
                // compressed into a single file, such as a so-called part file.
67
72
                size_type file_base;
 
73
                std::time_t mtime;
 
74
                bool pad_file:1;
 
75
                bool hidden_attribute:1;
 
76
                bool executable_attribute:1;
 
77
                bool symlink_attribute:1;
 
78
                fs::path symlink_path;
68
79
        };
69
80
 
70
81
        struct TORRENT_EXPORT file_slice
83
94
 
84
95
                bool is_valid() const { return m_piece_length > 0; }
85
96
 
 
97
                enum flags_t
 
98
                {
 
99
                        pad_file = 1,
 
100
                        attribute_hidden = 2,
 
101
                        attribute_executable = 4,
 
102
                        attribute_symlink = 8
 
103
                };
 
104
 
86
105
                void add_file(file_entry const& e);
87
 
                void add_file(fs::path const& p, size_type size);
 
106
                void add_file(fs::path const& p, size_type size, int flags = 0, std::time_t mtime = 0, fs::path const& s_p = "");
88
107
                void rename_file(int index, std::string const& new_filename);
89
108
 
 
109
#ifndef BOOST_FILESYSTEM_NARROW_ONLY
 
110
                void add_file(fs::wpath const& p, size_type size, int flags = 0, std::time_t mtime = 0, fs::path const& s_p = "");
 
111
                void rename_file(int index, std::wstring const& new_filename);
 
112
                void set_name(std::wstring const& n);
 
113
#endif
 
114
 
90
115
                std::vector<file_slice> map_block(int piece, size_type offset
91
116
                        , int size) const;
92
117
                peer_request map_file(int file, size_type offset, int size) const;
128
153
                        swap(ti.m_name, m_name);
129
154
                }
130
155
 
 
156
                // if pad_file_limit >= 0, files larger than
 
157
                // that limit will be padded, default is to
 
158
                // not add any padding
 
159
                void optimize(int pad_file_limit = -1);
 
160
 
131
161
        private:
132
162
                int m_piece_length;
133
163