1 #ifndef SIMDJSON_IMPLEMENTATION_H
2 #define SIMDJSON_IMPLEMENTATION_H
4 #include "simdjson/internal/atomic_ptr.h"
5 #include "simdjson/internal/dom_parser_implementation.h"
18 simdjson_warn_unused
bool validate_utf8(
const char * buf,
size_t len) noexcept;
25 simdjson_inline simdjson_warn_unused
bool validate_utf8(
const std::string_view sv) noexcept {
35 simdjson_inline simdjson_warn_unused
bool validate_utf8(
const std::string& s) noexcept {
56 virtual const std::string &
name()
const {
return _name; }
66 virtual const std::string &
description()
const {
return _description; }
84 virtual uint32_t required_instruction_sets()
const {
return _required_instruction_sets; }
97 virtual error_code create_dom_parser_implementation(
100 std::unique_ptr<internal::dom_parser_implementation> &dst
101 )
const noexcept = 0;
116 simdjson_warn_unused
virtual error_code minify(
const uint8_t *buf,
size_t len, uint8_t *dst,
size_t &dst_len)
const noexcept = 0;
128 simdjson_warn_unused
virtual bool validate_utf8(
const char *buf,
size_t len)
const noexcept = 0;
133 std::string_view
name,
135 uint32_t required_instruction_sets
139 _required_instruction_sets(required_instruction_sets)
148 const std::string _name;
153 const std::string _description;
158 const uint32_t _required_instruction_sets;
167 class available_implementation_list {
170 simdjson_inline available_implementation_list() {}
172 size_t size() const noexcept;
174 const implementation * const *begin() const noexcept;
176 const implementation * const *end() const noexcept;
191 const implementation * operator[](const std::string_view &name) const noexcept {
192 for (
const implementation * impl : *
this) {
193 if (impl->name() == name) {
return impl; }
210 const implementation *detect_best_supported() const noexcept;
An implementation of simdjson for a particular CPU architecture.
virtual const std::string & name() const
The name of this implementation.
virtual const std::string & description() const
The description of this implementation.
virtual simdjson_warn_unused bool validate_utf8(const char *buf, size_t len) const noexcept=0
Validate the UTF-8 string.
bool supported_by_runtime_system() const
The instruction sets this implementation is compiled against and the current CPU match.
The top level simdjson namespace, containing everything the library provides.
simdjson_warn_unused bool validate_utf8(const char *buf, size_t len) noexcept
Validate the UTF-8 string.
error_code
All possible errors returned by simdjson.
SIMDJSON_DLLIMPORTEXPORT const internal::available_implementation_list & get_available_implementations()
The list of available implementations compiled into simdjson.
SIMDJSON_DLLIMPORTEXPORT internal::atomic_ptr< const implementation > & get_active_implementation()
The active implementation.