iceoryx2
C++ Language Bindings
Loading...
Searching...
No Matches
string_internal.hpp
Go to the documentation of this file.
1
// Copyright (c) 2025 Contributors to the Eclipse Foundation
2
//
3
// See the NOTICE file(s) distributed with this work for additional
4
// information regarding copyright ownership.
5
//
6
// This program and the accompanying materials are made available under the
7
// terms of the Apache Software License 2.0 which is available at
8
// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
9
// which is available at https://opensource.org/licenses/MIT.
10
//
11
// SPDX-License-Identifier: Apache-2.0 OR MIT
12
13
#ifndef IOX2_INCLUDE_GUARD_BB_DETAIL_STRING_INTERNAL_HPP
14
#define IOX2_INCLUDE_GUARD_BB_DETAIL_STRING_INTERNAL_HPP
15
16
#include <cstdint>
17
#include <cstring>
18
19
namespace
iox2
{
20
namespace
bb {
21
template
<u
int
64_t>
22
class
StaticString;
23
24
namespace
detail {
25
template
<u
int
64_t N>
26
// C array not used here, it is a type alias for easier access
27
// NOLINTNEXTLINE(hicpp-avoid-c-arrays, cppcoreguidelines-avoid-c-arrays, modernize-avoid-c-arrays)
28
using
CharArray
=
char
[N];
29
30
template
<u
int
64_t N>
31
auto
get_size
(
const
StaticString<N>
& data) -> uint64_t {
32
return
data.size();
33
}
34
35
template
<u
int
64_t N>
36
auto
get_size
(
const
CharArray<N>
& data) -> uint64_t {
37
return
strnlen(&data[0], N);
38
}
39
40
template
<u
int
64_t N>
41
auto
get_data
(
const
StaticString<N>
& data) ->
const
char
* {
42
return
data.unchecked_access().c_str();
43
}
44
45
template
<u
int
64_t N>
46
auto
get_data
(
const
CharArray<N>
& data) ->
const
char
* {
47
return
&data[0];
48
}
49
}
// namespace detail
50
}
// namespace bb
51
}
// namespace iox2
52
53
#endif
// IOX2_INCLUDE_GUARD_BB_DETAIL_STRING_INTERNAL_HPP
iox2::bb::StaticString
Definition
static_string.hpp:80
iox2::bb::detail::CharArray
char[N] CharArray
Definition
string_internal.hpp:28
iox2::bb::detail::get_size
auto get_size(const StaticString< N > &data) -> uint64_t
Definition
string_internal.hpp:31
iox2::bb::detail::get_data
auto get_data(const StaticString< N > &data) -> const char *
Definition
string_internal.hpp:41
iox2
Definition
active_request.hpp:26
iox2
bb
detail
string_internal.hpp
Generated by
1.9.8