GRPC C++  1.6.0
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
slice.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef GRPCXX_IMPL_CODEGEN_SLICE_H
20 #define GRPCXX_IMPL_CODEGEN_SLICE_H
21 
24 
25 namespace grpc {
26 
28  return grpc::string_ref(
29  reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(*slice)),
30  GRPC_SLICE_LENGTH(*slice));
31 }
32 
34  return grpc::string(reinterpret_cast<char*>(GRPC_SLICE_START_PTR(slice)),
35  GRPC_SLICE_LENGTH(slice));
36 }
37 
40  str.length());
41 }
42 
45  str.length());
46 }
47 
48 } // namespace grpc
49 
50 #endif // GRPCXX_IMPL_CODEGEN_SLICE_H
grpc::string StringFromCopiedSlice(grpc_slice slice)
Definition: slice.h:33
std::string string
Definition: config.h:35
grpc::string_ref StringRefFromSlice(const grpc_slice *slice)
Definition: slice.h:27
virtual grpc_slice grpc_slice_from_copied_buffer(const void *buffer, size_t length)=0
A grpc_slice s, if initialized, represents the byte range s.bytes[0..s.length-1]. ...
Definition: slice.h:76
grpc_slice SliceReferencingString(const grpc::string &str)
Definition: slice.h:38
#define GRPC_SLICE_START_PTR(slice)
Definition: slice.h:112
grpc_slice SliceFromCopiedString(const grpc::string &str)
Definition: slice.h:43
virtual grpc_slice grpc_slice_from_static_buffer(const void *buffer, size_t length)=0
CoreCodegenInterface * g_core_codegen_interface
Definition: call.h:49
This class is a non owning reference to a string.
Definition: string_ref.h:41
#define GRPC_SLICE_LENGTH(slice)
Definition: slice.h:115