1#ifndef SIMDJSON_PADDED_STRING_VIEW_INL_H
2#define SIMDJSON_PADDED_STRING_VIEW_INL_H
3
4#include "simdjson/portability.h"
5#include "simdjson/common_defs.h" // for SIMDJSON_PADDING
6
7#include <climits>
8#include <cstring>
9#include <memory>
10#include <string>
11
12namespace simdjson {
13
14inline padded_string_view::padded_string_view(const char* s, size_t len, size_t capacity) noexcept
15 : std::string_view(s, len), _capacity(capacity)
16{
17}
18
19inline padded_string_view::padded_string_view(const uint8_t* s, size_t len, size_t capacity) noexcept
20 : padded_string_view(reinterpret_cast<const char*>(s), len, capacity)
21{
22}
23
24inline padded_string_view::padded_string_view(const std::string &s) noexcept
25 : std::string_view(s), _capacity(s.capacity())
26{
27}
28
29inline padded_string_view::padded_string_view(std::string_view s, size_t capacity) noexcept
30 : std::string_view(s), _capacity(capacity)
31{
32}
33
34inline size_t padded_string_view::capacity() const noexcept { return _capacity; }
35
36inline size_t padded_string_view::padding() const noexcept { return capacity() - length(); }
37
38} // namespace simdjson
39
40#endif // SIMDJSON_PADDED_STRING_VIEW_INL_H
41