1#ifndef SOURCEMETA_CORE_JSONLD_ERROR_H_
2#define SOURCEMETA_CORE_JSONLD_ERROR_H_
4#ifndef SOURCEMETA_CORE_JSONLD_EXPORT
5#include <sourcemeta/core/jsonld_export.h>
8#include <sourcemeta/core/error.h>
9#include <sourcemeta/core/json.h>
10#include <sourcemeta/core/jsonpointer.h>
12#include <initializer_list>
15namespace sourcemeta::core {
17SOURCEMETA_CORE_ERROR_WARNINGS_PUSH
27 :
Error{code}, pointer_{std::move(pointer)} {}
36 const std::initializer_list<JSON::StringView> children)
38 for (
const auto child : children) {
45 [[nodiscard]]
auto pointer() const noexcept -> const
Pointer & {
46 return this->pointer_;
67 [[nodiscard]]
auto key() const noexcept -> const
JSON::String & {
75SOURCEMETA_CORE_ERROR_WARNINGS_POP
Error(const StaticString message) noexcept
Construct the error given its message.
Definition error_base.h:84
std::basic_string< Char, CharTraits, Allocator< Char > > String
The string type used by the JSON document.
Definition json_value.h:52
JSONLDError(const StaticString code, const WeakPointer &pointer, const std::initializer_list< JSON::StringView > children)
Definition jsonld_error.h:35
JSONLDError(const StaticString code, Pointer pointer)
Locate the error at an owned pointer.
Definition jsonld_error.h:26
JSONLDFragmentError(const StaticString code, Pointer pointer, JSON::String key)
Locate the error at a fragment entry.
Definition jsonld_error.h:61
JSONLDError(const StaticString code, const WeakPointer &pointer)
Locate the error at a weak pointer, materialising an owned pointer.
Definition jsonld_error.h:30
auto key() const noexcept -> const JSON::String &
Definition jsonld_error.h:67
GenericPointer< JSON::String, PropertyHashJSON< JSON::String > > Pointer
Definition jsonpointer.h:41
SOURCEMETA_CORE_JSONPOINTER_EXPORT auto to_pointer(const JSON &document) -> Pointer
GenericPointer< std::reference_wrapper< const std::string >, PropertyHashJSON< JSON::String > > WeakPointer
Definition jsonpointer.h:46
Definition text_static_string.h:20