added out stream operator to lazy_entry
This commit is contained in:
@@ -37,6 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <vector>
|
||||
#include "libtorrent/assert.hpp"
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <iosfwd>
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
@@ -103,6 +104,12 @@ namespace libtorrent
|
||||
lazy_entry* dict_find(char const* name);
|
||||
lazy_entry const* dict_find(char const* name) const
|
||||
{ return const_cast<lazy_entry*>(this)->dict_find(name); }
|
||||
std::pair<char const*, lazy_entry const*> dict_at(int i) const
|
||||
{
|
||||
TORRENT_ASSERT(m_type == dict_t);
|
||||
TORRENT_ASSERT(i < m_size);
|
||||
return std::make_pair(m_data.dict[i].first, &m_data.dict[i].second);
|
||||
}
|
||||
|
||||
int dict_size() const
|
||||
{
|
||||
@@ -128,6 +135,8 @@ namespace libtorrent
|
||||
TORRENT_ASSERT(i < m_size);
|
||||
return &m_data.list[i];
|
||||
}
|
||||
lazy_entry const* list_at(int i) const
|
||||
{ return const_cast<lazy_entry*>(this)->list_at(i); }
|
||||
|
||||
int list_size() const
|
||||
{
|
||||
@@ -153,6 +162,8 @@ namespace libtorrent
|
||||
int m_capacity; // if list or dictionary, allocated number of items
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, lazy_entry const& e);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@@ -48,8 +48,6 @@ namespace libtorrent
|
||||
|
||||
class TORRENT_EXPORT big_number
|
||||
{
|
||||
// private type
|
||||
struct private_pointer {};
|
||||
// the number of bytes of the number
|
||||
enum { number_size = 20 };
|
||||
public:
|
||||
@@ -57,16 +55,19 @@ namespace libtorrent
|
||||
|
||||
big_number() {}
|
||||
|
||||
big_number(std::string const& s)
|
||||
explicit big_number(char const* s)
|
||||
{
|
||||
if (s == 0) clear();
|
||||
else std::memcpy(m_number, s, size);
|
||||
}
|
||||
|
||||
explicit big_number(std::string const& s)
|
||||
{
|
||||
TORRENT_ASSERT(s.size() >= 20);
|
||||
int sl = int(s.size()) < size ? int(s.size()) : size;
|
||||
std::memcpy(m_number, &s[0], sl);
|
||||
}
|
||||
|
||||
// when initialized with 0
|
||||
big_number(private_pointer*) { clear(); }
|
||||
|
||||
void clear()
|
||||
{
|
||||
std::fill(m_number,m_number+number_size,0);
|
||||
|
Reference in New Issue
Block a user