AWS IoT Device SDK C++ v2
1.45.2
AWS IoT Device SDK C++ v2
Toggle main menu visibility
Loading...
Searching...
No Matches
crt
aws-crt-cpp
include
aws
crt
ByteBufUtils.h
Go to the documentation of this file.
1
#pragma once
2
7
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
Types.h
Aws::Crt::ManagedByteBuffer::operator=
ManagedByteBuffer & operator=(const ManagedByteBuffer &rhs) noexcept
Definition
ByteBufUtils.cpp:115
Aws::Crt::ManagedByteBuffer::cursor
struct aws_byte_cursor cursor() const noexcept
Definition
ByteBufUtils.h:41
Aws::Crt::ManagedByteBuffer::ManagedByteBuffer
ManagedByteBuffer() noexcept
Definition
ByteBufUtils.cpp:19
Exports.h
AWS_CRT_CPP_API
#define AWS_CRT_CPP_API
Definition
Exports.h:36
Aws::Crt
Definition
Allocator.h:13
Aws::Crt::String
std::basic_string< char, std::char_traits< char >, StlAllocator< char > > String
Definition
Types.h:45
Aws::Crt::ApiAllocator
AWS_CRT_CPP_API Allocator * ApiAllocator() noexcept
Definition
Allocator.cpp:24
Aws::Crt::Allocator
aws_allocator Allocator
Definition
Allocator.h:14
Aws
Definition
Allocator.h:11
Generated by
1.17.0