consider macro TORRENT_USE_IOSTREAM for sha1_hash iostream operators (#790)
This commit is contained in:
parent
cbeb7adbde
commit
3d5e0144c7
|
@ -42,7 +42,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/assert.hpp"
|
||||
#include "libtorrent/aux_/byteswap.hpp"
|
||||
|
||||
#if TORRENT_USE_IOSTREAM
|
||||
#include <iosfwd>
|
||||
#endif // TORRENT_USE_IOSTREAM
|
||||
|
||||
#ifdef max
|
||||
#undef max
|
||||
|
@ -255,11 +257,15 @@ namespace libtorrent
|
|||
return ret;
|
||||
}
|
||||
|
||||
#if TORRENT_USE_IOSTREAM
|
||||
|
||||
// print a sha1_hash object to an ostream as 40 hexadecimal digits
|
||||
TORRENT_EXPORT std::ostream& operator<<(std::ostream& os, sha1_hash const& peer);
|
||||
|
||||
// read 40 hexadecimal digits from an istream into a sha1_hash
|
||||
TORRENT_EXPORT std::istream& operator>>(std::istream& is, sha1_hash& peer);
|
||||
|
||||
#endif // TORRENT_USE_IOSTREAM
|
||||
}
|
||||
|
||||
namespace std {
|
||||
|
|
|
@ -34,11 +34,15 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/cpuid.hpp"
|
||||
#include "libtorrent/hex.hpp" // to_hex, from_hex
|
||||
|
||||
#if TORRENT_USE_IOSTREAM
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#endif // TORRENT_USE_IOSTREAM
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
#if TORRENT_USE_IOSTREAM
|
||||
|
||||
// print a sha1_hash object to an ostream as 40 hexadecimal digits
|
||||
std::ostream& operator<<(std::ostream& os, sha1_hash const& peer)
|
||||
{
|
||||
|
@ -57,6 +61,8 @@ namespace libtorrent
|
|||
return is;
|
||||
}
|
||||
|
||||
#endif // TORRENT_USE_IOSTREAM
|
||||
|
||||
int sha1_hash::count_leading_zeroes() const
|
||||
{
|
||||
int ret = 0;
|
||||
|
|
Loading…
Reference in New Issue