aws-crt-cpp
C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++.
Loading...
Searching...
No Matches
include
aws
crt
ByteBufUtils.h
Go to the documentation of this file.
1
#pragma once
2
8
#include <
aws/crt/Exports.h
>
9
#include <
aws/crt/Types.h
>
10
11
namespace
Aws
12
{
13
namespace
Crt
14
{
15
/*
16
* We're stuck with Aws::Crt::ByteBuf being a C-struct typedef. So this type wraps a C aws_byte_buf object
17
* and adds C++ move and copy semantics on top to allow us to safely and easily work with raw bytes destined
18
* to go to aws-c-* APIs. Primarily exists in service of configuration structures that contain binary data
19
* fields that we'll pass to C. If we embedded raw byte_bufs in these classes then we'd have to carefully
20
* write out every move and copy API (or forbid them which isn't great for usability). If we use this instead,
21
* we can just "= default" and get correct behavior.
22
*/
23
class
AWS_CRT_CPP_API
ManagedByteBuffer
24
{
25
public
:
26
ManagedByteBuffer
()
noexcept
;
27
28
explicit
ManagedByteBuffer
(
const
struct
aws_byte_buf &buf)
noexcept
;
29
explicit
ManagedByteBuffer
(
struct
aws_byte_cursor cursor,
Allocator
*allocator =
ApiAllocator
())
noexcept
;
30
explicit
ManagedByteBuffer
(
const
char
*cstring,
Allocator
*allocator =
ApiAllocator
())
noexcept
;
31
explicit
ManagedByteBuffer
(
const
Aws::Crt::String
&value)
noexcept
;
32
ManagedByteBuffer
(uint8_t *data,
size_t
len,
Allocator
*allocator =
ApiAllocator
())
noexcept
;
33
34
ManagedByteBuffer
(
const
ManagedByteBuffer
&rhs)
noexcept
;
35
ManagedByteBuffer
(
ManagedByteBuffer
&&rhs)
noexcept
;
36
ManagedByteBuffer
&operator=(
const
ManagedByteBuffer
&rhs)
noexcept
;
37
ManagedByteBuffer
&operator=(
ManagedByteBuffer
&&rhs)
noexcept
;
38
39
~ManagedByteBuffer
();
40
41
struct
aws_byte_cursor cursor() const noexcept {
return
aws_byte_cursor_from_buf(&m_buffer); }
42
43
private
:
44
struct
aws_byte_buf m_buffer;
45
};
46
}
// namespace Crt
47
}
// namespace Aws
Exports.h
AWS_CRT_CPP_API
#define AWS_CRT_CPP_API
Definition
Exports.h:36
Types.h
Aws::Crt::ManagedByteBuffer
Definition
ByteBufUtils.h:24
Aws::Crt::Allocator
aws_allocator Allocator
Definition
Allocator.h:14
Aws::Crt::ApiAllocator
AWS_CRT_CPP_API Allocator * ApiAllocator() noexcept
Definition
Allocator.cpp:24
Aws::Crt::String
std::basic_string< char, std::char_traits< char >, StlAllocator< char > > String
Definition
Types.h:45
Aws
Definition
Allocator.h:11
Generated by
1.9.8