Show
Ignore:
Timestamp:
03/15/10 14:31:50 (2 years ago)
Author:
rakshasa
Message:

* Cleaned up torrent/download.h.

* Removed raw_value as it is redundant.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/libtorrent/src/torrent/object.h

    r1138 r1145  
    8282    TYPE_NONE, 
    8383    TYPE_RAW_BENCODE, 
    84     TYPE_RAW_VALUE, 
    8584    TYPE_RAW_STRING, 
    8685    TYPE_RAW_LIST, 
     
    9796  Object(const string_type& s) : m_flags(TYPE_STRING) { new (&_string()) string_type(s); } 
    9897  Object(const raw_bencode& r) : m_flags(TYPE_RAW_BENCODE) { new (&_raw_bencode()) raw_bencode(r); } 
    99   Object(const raw_value& r)   : m_flags(TYPE_RAW_VALUE) { new (&_raw_value()) raw_value(r); } 
    10098  Object(const raw_string& r)  : m_flags(TYPE_RAW_STRING) { new (&_raw_string()) raw_string(r); } 
    10199  Object(const raw_list& r)    : m_flags(TYPE_RAW_LIST) { new (&_raw_list()) raw_list(r); } 
     
    115113  static Object       create_raw_bencode(raw_bencode obj = raw_bencode()) { 
    116114    Object tmp; tmp.m_flags = TYPE_RAW_BENCODE; new (&tmp._raw_bencode()) raw_bencode(); return tmp; 
    117   } 
    118   static Object       create_raw_value(raw_value obj = raw_value()) { 
    119     Object tmp; tmp.m_flags = TYPE_RAW_VALUE; new (&tmp._raw_value()) raw_value(); return tmp; 
    120115  } 
    121116  static Object       create_raw_string(raw_string obj = raw_string()) { 
     
    165160  raw_bencode&       as_raw_bencode()                    { check_throw(TYPE_RAW_BENCODE); return _raw_bencode(); } 
    166161  const raw_bencode& as_raw_bencode() const              { check_throw(TYPE_RAW_BENCODE); return _raw_bencode(); } 
    167   raw_value&         as_raw_value()                      { check_throw(TYPE_RAW_VALUE); return _raw_value(); } 
    168   const raw_value&   as_raw_value() const                { check_throw(TYPE_RAW_VALUE); return _raw_value(); } 
    169162  raw_string&        as_raw_string()                     { check_throw(TYPE_RAW_STRING); return _raw_string(); } 
    170163  const raw_string&  as_raw_string() const               { check_throw(TYPE_RAW_STRING); return _raw_string(); } 
     
    180173  bool                has_key_map(const key_type& k) const    { check_throw(TYPE_MAP); return check(_map().find(k), TYPE_MAP); } 
    181174  bool                has_key_raw_bencode(const key_type& k) const { check_throw(TYPE_MAP); return check(_map().find(k), TYPE_RAW_BENCODE); } 
    182   bool                has_key_raw_value(const key_type& k) const { check_throw(TYPE_MAP); return check(_map().find(k), TYPE_RAW_VALUE); } 
    183175  bool                has_key_raw_string(const key_type& k) const { check_throw(TYPE_MAP); return check(_map().find(k), TYPE_RAW_STRING); } 
    184176  bool                has_key_raw_list(const key_type& k) const { check_throw(TYPE_MAP); return check(_map().find(k), TYPE_RAW_LIST); } 
     
    258250  raw_bencode&        _raw_bencode()       { return reinterpret_cast<raw_bencode&>(t_pod); } 
    259251  const raw_bencode&  _raw_bencode() const { return reinterpret_cast<const raw_bencode&>(t_pod); } 
    260   raw_value&          _raw_value()         { return reinterpret_cast<raw_value&>(t_pod); } 
    261   const raw_value&    _raw_value() const   { return reinterpret_cast<const raw_value&>(t_pod); } 
    262252  raw_string&         _raw_string()        { return reinterpret_cast<raw_string&>(t_pod); } 
    263253  const raw_string&   _raw_string() const  { return reinterpret_cast<const raw_string&>(t_pod); } 
     
    287277  case TYPE_NONE: 
    288278  case TYPE_RAW_BENCODE: 
    289   case TYPE_RAW_VALUE:  
    290279  case TYPE_RAW_STRING:  
    291280  case TYPE_RAW_LIST:  
     
    302291  switch (t) { 
    303292  case TYPE_RAW_BENCODE: return create_raw_bencode(); 
    304   case TYPE_RAW_VALUE:   return create_raw_value(); 
    305293  case TYPE_RAW_STRING:  return create_raw_string(); 
    306294  case TYPE_RAW_LIST:    return create_raw_list();