Changeset 1145 for trunk/libtorrent/src/torrent/object.h
- Timestamp:
- 03/15/10 14:31:50 (2 years ago)
- Files:
-
- 1 modified
-
trunk/libtorrent/src/torrent/object.h (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtorrent/src/torrent/object.h
r1138 r1145 82 82 TYPE_NONE, 83 83 TYPE_RAW_BENCODE, 84 TYPE_RAW_VALUE,85 84 TYPE_RAW_STRING, 86 85 TYPE_RAW_LIST, … … 97 96 Object(const string_type& s) : m_flags(TYPE_STRING) { new (&_string()) string_type(s); } 98 97 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); }100 98 Object(const raw_string& r) : m_flags(TYPE_RAW_STRING) { new (&_raw_string()) raw_string(r); } 101 99 Object(const raw_list& r) : m_flags(TYPE_RAW_LIST) { new (&_raw_list()) raw_list(r); } … … 115 113 static Object create_raw_bencode(raw_bencode obj = raw_bencode()) { 116 114 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;120 115 } 121 116 static Object create_raw_string(raw_string obj = raw_string()) { … … 165 160 raw_bencode& as_raw_bencode() { check_throw(TYPE_RAW_BENCODE); return _raw_bencode(); } 166 161 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(); }169 162 raw_string& as_raw_string() { check_throw(TYPE_RAW_STRING); return _raw_string(); } 170 163 const raw_string& as_raw_string() const { check_throw(TYPE_RAW_STRING); return _raw_string(); } … … 180 173 bool has_key_map(const key_type& k) const { check_throw(TYPE_MAP); return check(_map().find(k), TYPE_MAP); } 181 174 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); }183 175 bool has_key_raw_string(const key_type& k) const { check_throw(TYPE_MAP); return check(_map().find(k), TYPE_RAW_STRING); } 184 176 bool has_key_raw_list(const key_type& k) const { check_throw(TYPE_MAP); return check(_map().find(k), TYPE_RAW_LIST); } … … 258 250 raw_bencode& _raw_bencode() { return reinterpret_cast<raw_bencode&>(t_pod); } 259 251 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); }262 252 raw_string& _raw_string() { return reinterpret_cast<raw_string&>(t_pod); } 263 253 const raw_string& _raw_string() const { return reinterpret_cast<const raw_string&>(t_pod); } … … 287 277 case TYPE_NONE: 288 278 case TYPE_RAW_BENCODE: 289 case TYPE_RAW_VALUE:290 279 case TYPE_RAW_STRING: 291 280 case TYPE_RAW_LIST: … … 302 291 switch (t) { 303 292 case TYPE_RAW_BENCODE: return create_raw_bencode(); 304 case TYPE_RAW_VALUE: return create_raw_value();305 293 case TYPE_RAW_STRING: return create_raw_string(); 306 294 case TYPE_RAW_LIST: return create_raw_list();
