diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-11-05 12:01:57 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-11-05 12:01:57 +0900 |
| commit | d1d49036651012433595357ca31e6f65dbec3a6b (patch) | |
| tree | a962461fc219fa02458d154eef4e3a354bb99e40 /src/bencode2.h | |
| parent | d305432ec0015cfc9479331531a78f29c398bd8c (diff) | |
Rewritten bencode2::decode functions
Diffstat (limited to 'src/bencode2.h')
| -rw-r--r-- | src/bencode2.h | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/bencode2.h b/src/bencode2.h index 7f4e226f..bfc95de6 100644 --- a/src/bencode2.h +++ b/src/bencode2.h @@ -48,19 +48,26 @@ namespace bencode2 { const size_t MAX_STRUCTURE_DEPTH = 100; -SharedHandle<ValueBase> decode(std::istream& in); - -// Decode the data in s. -SharedHandle<ValueBase> decode(const std::string& s); +// Decode the data in [first, last). +SharedHandle<ValueBase> decode +(std::string::const_iterator first, + std::string::const_iterator last); -// Decode the data in s. After decode is done successfully, return the -// bencoded string length in end. -SharedHandle<ValueBase> decode(const std::string& s, size_t& end); +// Decode the data in [first, last). After decode is done +// successfully, return the bencoded string length in end. +SharedHandle<ValueBase> decode +(std::string::const_iterator first, + std::string::const_iterator last, + size_t& end); -SharedHandle<ValueBase> decode(const unsigned char* data, size_t length); +SharedHandle<ValueBase> decode +(const unsigned char* first, + const unsigned char* last); SharedHandle<ValueBase> decode -(const unsigned char* data, size_t length, size_t& end); +(const unsigned char* first, + const unsigned char* last, + size_t& end); SharedHandle<ValueBase> decodeFromFile(const std::string& filename); |
