added dict_find_string to lazy_entry

This commit is contained in:
Arvid Norberg 2008-07-18 13:48:09 +00:00
parent 2ab80ddc3a
commit 3b35b2c2e3
2 changed files with 8 additions and 0 deletions

View File

@ -124,6 +124,7 @@ namespace libtorrent
size_type dict_find_int_value(char const* name, size_type default_val = 0) const; size_type dict_find_int_value(char const* name, size_type default_val = 0) const;
lazy_entry const* dict_find_dict(char const* name) const; lazy_entry const* dict_find_dict(char const* name) const;
lazy_entry const* dict_find_list(char const* name) const; lazy_entry const* dict_find_list(char const* name) const;
lazy_entry const* dict_find_string(char const* name) const;
std::pair<std::string, lazy_entry const*> dict_at(int i) const std::pair<std::string, lazy_entry const*> dict_at(int i) const
{ {

View File

@ -260,6 +260,13 @@ namespace libtorrent
return e->string_value(); return e->string_value();
} }
lazy_entry const* lazy_entry::dict_find_string(char const* name) const
{
lazy_entry const* e = dict_find(name);
if (e == 0 || e->type() != lazy_entry::string_t) return 0;
return e;
}
size_type lazy_entry::dict_find_int_value(char const* name, size_type default_val) const size_type lazy_entry::dict_find_int_value(char const* name, size_type default_val) const
{ {
lazy_entry const* e = dict_find(name); lazy_entry const* e = dict_find(name);