Changeset 1021 for trunk/libtorrent/src/torrent/data/file.h
- Timestamp:
- 12/23/07 03:05:00 (4 years ago)
- Files:
-
- 1 modified
-
trunk/libtorrent/src/torrent/data/file.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtorrent/src/torrent/data/file.h
r1019 r1021 49 49 typedef std::pair<uint32_t, uint32_t> range_type; 50 50 51 static const int flag_create_queued = (1 << 0); 52 static const int flag_resize_queued = (1 << 1); 53 static const int flag_previously_created = (1 << 2); 51 static const int flag_active = (1 << 0); 52 static const int flag_create_queued = (1 << 1); 53 static const int flag_resize_queued = (1 << 2); 54 static const int flag_previously_created = (1 << 3); 54 55 55 56 File(); … … 66 67 bool is_previously_created() const { return m_flags & flag_previously_created; } 67 68 69 bool has_flags(int flags) { return m_flags & flags; } 70 68 71 void set_flags(int flags); 69 72 void unset_flags(int flags); … … 77 80 78 81 uint32_t completed_chunks() const { return m_completed; } 82 void set_completed_chunks(uint32_t v); 79 83 80 84 const range_type& range() const { return m_range; } … … 109 113 110 114 protected: 115 void set_flags_protected(int flags) { m_flags |= flags; } 116 void unset_flags_protected(int flags) { m_flags &= ~flags; } 117 111 118 void set_frozen_path(const std::string& path) { m_frozenPath = path; } 112 119 … … 115 122 void set_range(uint32_t chunkSize); 116 123 117 void set_completed(uint32_t v) { m_completed = v; } 118 void inc_completed() { m_completed++; } 124 void set_completed_protected(uint32_t v) { m_completed = v; } 125 void inc_completed_protected() { m_completed++; } 126 127 static void set_match_depth(File* left, File* right); 119 128 120 129 void set_match_depth_prev(uint32_t l) { m_matchDepthPrev = l; } … … 154 163 inline void 155 164 File::set_flags(int flags) { 156 m_flags |= flags & (flag_create_queued | flag_resize_queued);165 set_flags_protected(flags & (flag_create_queued | flag_resize_queued)); 157 166 } 158 167 159 168 inline void 160 169 File::unset_flags(int flags) { 161 m_flags |= flags & (flag_create_queued | flag_resize_queued); 170 unset_flags_protected(flags & (flag_create_queued | flag_resize_queued)); 171 } 172 173 inline void 174 File::set_completed_chunks(uint32_t v) { 175 if (!has_flags(flag_active) && v <= size_chunks()) 176 m_completed = v; 162 177 } 163 178
