diff options
author | Vijay Pai <vpai@google.com> | 2017-07-18 10:42:33 -0700 |
---|---|---|
committer | Vijay Pai <vpai@google.com> | 2017-07-18 11:07:43 -0700 |
commit | 0f95fa4909ba6f65364cb0b5c8c37a27c09b67b4 (patch) | |
tree | a98b582aa9e26d6aca4a3e23e8a4ab9dfe883ec3 /include/grpc++/support | |
parent | c39d4c16a02d49a1e4b090309786643045287639 (diff) |
Add idiomatic C++ API for grpc::Slice construction that doesn't
require using grpc_slice
Diffstat (limited to 'include/grpc++/support')
-rw-r--r-- | include/grpc++/support/slice.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/grpc++/support/slice.h b/include/grpc++/support/slice.h index db5cf942a0..0b4ba7cecb 100644 --- a/include/grpc++/support/slice.h +++ b/include/grpc++/support/slice.h @@ -44,6 +44,20 @@ class Slice final { /// Construct a slice from \a slice, stealing a reference. Slice(grpc_slice slice, StealRef); + /// Allocate a slice of specified size + Slice(size_t len); + + /// Construct a slice from a copied buffer + Slice(const void* buf, size_t len); + + /// Construct a slice from a copied string + Slice(const grpc::string& str); + + enum StaticSlice { STATIC_SLICE }; + + /// Construct a slice from a static buffer + Slice(const void* buf, size_t len, StaticSlice); + /// Copy constructor, adds a reference. Slice(const Slice& other); |