17#include "../microfmt.hpp"
43RELOCO_BEGIN_UNSAFE_CODE
47 return raw_ptr_view{
reinterpret_cast<uintptr_t
>(ptr), ptr ==
nullptr, mode};
78 const T *begin_ptr{
nullptr};
79 const T *end_ptr{
nullptr};
80 microfmt::string_view separator{
", "};
82 char close_delim{
']'};
86 [[nodiscard]]
constexpr size_t size() const noexcept {
87 if (begin_ptr ==
nullptr || end_ptr ==
nullptr || end_ptr < begin_ptr) {
90 return static_cast<size_t>(end_ptr - begin_ptr);
103 RELOCO_BEGIN_UNSAFE_BUFFER_USAGE;
107 RELOCO_END_UNSAFE_BUFFER_USAGE;
118 static constexpr size_t native_hex_width =
sizeof(uintptr_t) * 2;
120 bool uppercase_hex{
false};
121 bool show_prefix{
true};
123 size_t custom_width{0};
124 microfmt::string_view null_representation{
"(nil)"};
131#if MICROFMT_SHARED_PROVIDE_DEFINITIONS
132#include "pointer.ipp"
143 microfmt::string_view forwarded_spec{
""};
146 auto spec = ctx.spec();
151 if (spec[0] ==
'b' || spec[0] ==
'B') {
155 }
else if (spec[0] ==
'c' || spec[0] ==
'C') {
159 }
else if (spec[0] ==
'n' || spec[0] ==
'N') {
165 forwarded_spec = spec.substr(i);
169 if (open_c !=
'\0') {
175 elem_fmt.parse(elem_ctx);
177 const size_t count = range.size();
178 for (
size_t idx = 0; idx < count; ++idx) {
180 out.write(range.separator);
182 RELOCO_BEGIN_UNSAFE_BUFFER_USAGE;
183 RELOCO_DEBUG_ASSERT(range.begin_ptr + idx < range.end_ptr,
"Index out of range");
184 elem_fmt.format(range.begin_ptr[idx], out);
185 RELOCO_END_UNSAFE_BUFFER_USAGE;
188 if (close_c !=
'\0') {
Definition microfmt.hpp:881
#define MICROFMT_API_CLASS
Definition compat.hpp:181
#define MICROFMT_API
Definition compat.hpp:135
#define MICROFMT_API_CONSTEXPR
Definition compat.hpp:163
ptr_width_mode
Definition pointer.hpp:27
reloco::sink sink
Type-erased, zero-allocation output sink.
Definition microfmt.hpp:46
constexpr raw_ptr_view raw_ptr32(const T *ptr) noexcept
Definition pointer.hpp:62
RELOCO_BEGIN_UNSAFE_CODE constexpr raw_ptr_view raw_ptr(const T *ptr, ptr_width_mode mode=ptr_width_mode::native) noexcept
Definition pointer.hpp:46
constexpr raw_range_view< T > raw_range(const T *first, const T *last) noexcept
Definition pointer.hpp:96
RELOCO_END_UNSAFE_CODE
Definition remote_object.hpp:132
Definition pointer.hpp:35
Definition pointer.hpp:77
constexpr size_t size() const noexcept
Definition pointer.hpp:86