Show
Ignore:
Timestamp:
12/23/07 03:05:00 (4 years ago)
Author:
rakshasa
Message:

* Added "d.set_directory_base" command that handles single and multi
file torrent equally.

* Fixed man page entry on 'umask', it should be 0022 not 0664.

* Cleaned up File and FileList? classes.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/libtorrent/src/torrent/data/file.h

    r1019 r1021  
    4949  typedef std::pair<uint32_t, uint32_t> range_type; 
    5050 
    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); 
    5455 
    5556  File(); 
     
    6667  bool                is_previously_created() const            { return m_flags & flag_previously_created; } 
    6768 
     69  bool                has_flags(int flags)                     { return m_flags & flags; } 
     70 
    6871  void                set_flags(int flags); 
    6972  void                unset_flags(int flags); 
     
    7780 
    7881  uint32_t            completed_chunks() const                 { return m_completed; } 
     82  void                set_completed_chunks(uint32_t v); 
    7983 
    8084  const range_type&   range() const                            { return m_range; } 
     
    109113 
    110114protected: 
     115  void                set_flags_protected(int flags)           { m_flags |= flags; } 
     116  void                unset_flags_protected(int flags)         { m_flags &= ~flags; } 
     117 
    111118  void                set_frozen_path(const std::string& path) { m_frozenPath = path; } 
    112119 
     
    115122  void                set_range(uint32_t chunkSize); 
    116123 
    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); 
    119128 
    120129  void                set_match_depth_prev(uint32_t l)         { m_matchDepthPrev = l; } 
     
    154163inline void 
    155164File::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)); 
    157166} 
    158167 
    159168inline void 
    160169File::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 
     173inline void 
     174File::set_completed_chunks(uint32_t v) { 
     175  if (!has_flags(flag_active) && v <= size_chunks()) 
     176    m_completed = v; 
    162177} 
    163178