diff options
author | Jeff Davidson <jpd@google.com> | 2015-01-15 22:48:58 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-01-15 22:48:58 +0000 |
commit | 77a6b2f4cdd580d57630f079db1d908d7fd90a54 (patch) | |
tree | 586f7d5e9a7e05af45d0e821188097c0faa96219 /src/google/protobuf/io/zero_copy_stream.h | |
parent | c7c25812eb19d080087b71e08bfe35aff9f21433 (diff) | |
parent | a3b2a6da25a76f17c73d31def3952feb0fd2296e (diff) | |
download | external_protobuf-77a6b2f4cdd580d57630f079db1d908d7fd90a54.zip external_protobuf-77a6b2f4cdd580d57630f079db1d908d7fd90a54.tar.gz external_protobuf-77a6b2f4cdd580d57630f079db1d908d7fd90a54.tar.bz2 |
Merge "Update protobuf library from 2.3 to 2.6."
Diffstat (limited to 'src/google/protobuf/io/zero_copy_stream.h')
-rw-r--r-- | src/google/protobuf/io/zero_copy_stream.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/google/protobuf/io/zero_copy_stream.h b/src/google/protobuf/io/zero_copy_stream.h index db5326f..f892122 100644 --- a/src/google/protobuf/io/zero_copy_stream.h +++ b/src/google/protobuf/io/zero_copy_stream.h @@ -226,6 +226,16 @@ class LIBPROTOBUF_EXPORT ZeroCopyOutputStream { // Returns the total number of bytes written since this object was created. virtual int64 ByteCount() const = 0; + // Write a given chunk of data to the output. Some output streams may + // implement this in a way that avoids copying. Check AllowsAliasing() before + // calling WriteAliasedRaw(). It will GOOGLE_CHECK fail if WriteAliasedRaw() is + // called on a stream that does not allow aliasing. + // + // NOTE: It is caller's responsibility to ensure that the chunk of memory + // remains live until all of the data has been consumed from the stream. + virtual bool WriteAliasedRaw(const void* data, int size); + virtual bool AllowsAliasing() const { return false; } + private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ZeroCopyOutputStream); |