moddef-cpp
Idiomatic C++ runtime for ModDef
Loading...
Searching...
No Matches
str.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: Apache-2.0
2
11
#ifndef MODDEF_STR_HPP
12
#define MODDEF_STR_HPP
13
14
#include <cstdint>
15
#include <string_view>
16
17
extern
"C"
{
18
#include "moddef/str.h"
19
}
20
21
namespace
moddef
{
22
23
inline
md_str_t
to_c
(std::string_view s)
noexcept
{
24
return
md_str_t{s.data(),
static_cast<
uint16_t
>
(s.size())};
25
}
26
27
inline
std::string_view
from_c
(md_str_t s)
noexcept
{
28
return
std::string_view{s.p, s.len};
29
}
30
31
}
// namespace moddef
32
33
#endif
// MODDEF_STR_HPP
moddef
Definition
device.hpp:28
moddef::to_c
md_err_t to_c(Error e) noexcept
Definition
error.hpp:47
moddef::from_c
Error from_c(md_err_t e) noexcept
Definition
error.hpp:46
include
moddef
str.hpp
Generated by
1.9.8