add Cursor::peekBytes()
authorAdam Simpkins <simpkins@fb.com>
Wed, 25 May 2016 19:07:07 +0000 (12:07 -0700)
committerFacebook Github Bot 0 <facebook-github-bot-0-bot@fb.com>
Wed, 25 May 2016 19:08:31 +0000 (12:08 -0700)
commit6a6efad5faf702f61820268cca8726a83bc6a9d2
treefcf3f546c2a208a098669e1f014edff2c0a9e925
parent1f4f1754c167b85071454438537425752a5dc2bf
add Cursor::peekBytes()

Summary:
The existing Cursor::peek() method pre-dates the existence of folly::ByteRange,
and so it returns a std::pair containing a pointer and length.  This is usually
more awkward to use than ByteRange.

This adds a peekBytes() method that returns a ByteRange object, and updates all
users of peek() in folly to use peekBytes() instead.  Eventually I think we
should add a FOLLY_DEPRECATED attribute to peek().  I will wait to add this tag
until after converting a few other projects to use peekBytes(), though.

Reviewed By: alandau

Differential Revision: D3337302

fbshipit-source-id: 14220a059d915bf5adc66b8b283f7228b796a4dc
folly/Subprocess.cpp
folly/experimental/bser/Load.cpp
folly/io/Compression.cpp
folly/io/Cursor.h
folly/io/IOBuf.cpp
folly/io/test/IOBufCursorBenchmark.cpp
folly/io/test/IOBufCursorTest.cpp