40 key()
noexcept =
default;
46 source_{ std::move(src) }
58 explicit key(std::string&& k,
source_region&& src = {})
noexcept
59 : key_{ std::move(k) },
60 source_{ std::move(src) }
65 explicit key(std::string&& k,
const source_region& src)
noexcept
66 : key_{ std::move(k) },
74 source_{ std::move(src) }
84#if TOML_ENABLE_WINDOWS_COMPAT
91 : key_{ impl::narrow(k) },
92 source_{ std::move(src) }
100 : key_{ impl::narrow(k) },
111 std::string_view str()
const noexcept
113 return std::string_view{ key_ };
118 operator std::string_view()
const noexcept
125 bool empty()
const noexcept
132 const char* data()
const noexcept
139 size_t length()
const noexcept
141 return key_.length();
164 friend bool operator==(
const key& lhs,
const key& rhs)
noexcept
166 return lhs.key_ == rhs.key_;
171 friend bool operator!=(
const key& lhs,
const key& rhs)
noexcept
173 return lhs.key_ != rhs.key_;
178 friend bool operator<(
const key& lhs,
const key& rhs)
noexcept
180 return lhs.key_ < rhs.key_;
185 friend bool operator<=(
const key& lhs,
const key& rhs)
noexcept
187 return lhs.key_ <= rhs.key_;
192 friend bool operator>(
const key& lhs,
const key& rhs)
noexcept
194 return lhs.key_ > rhs.key_;
199 friend bool operator>=(
const key& lhs,
const key& rhs)
noexcept
201 return lhs.key_ >= rhs.key_;
206 friend bool operator==(
const key& lhs, std::string_view rhs)
noexcept
208 return lhs.key_ == rhs;
213 friend bool operator!=(
const key& lhs, std::string_view rhs)
noexcept
215 return lhs.key_ != rhs;
220 friend bool operator<(
const key& lhs, std::string_view rhs)
noexcept
222 return lhs.key_ < rhs;
227 friend bool operator<=(
const key& lhs, std::string_view rhs)
noexcept
229 return lhs.key_ <= rhs;
234 friend bool operator>(
const key& lhs, std::string_view rhs)
noexcept
236 return lhs.key_ > rhs;
241 friend bool operator>=(
const key& lhs, std::string_view rhs)
noexcept
243 return lhs.key_ >= rhs;
248 friend bool operator==(std::string_view lhs,
const key& rhs)
noexcept
250 return lhs == rhs.key_;
255 friend bool operator!=(std::string_view lhs,
const key& rhs)
noexcept
257 return lhs != rhs.key_;
262 friend bool operator<(std::string_view lhs,
const key& rhs)
noexcept
264 return lhs < rhs.key_;
269 friend bool operator<=(std::string_view lhs,
const key& rhs)
noexcept
271 return lhs <= rhs.key_;
276 friend bool operator>(std::string_view lhs,
const key& rhs)
noexcept
278 return lhs > rhs.key_;
283 friend bool operator>=(std::string_view lhs,
const key& rhs)
noexcept
285 return lhs >= rhs.key_;
294 using const_iterator =
const char*;
297 using iterator = const_iterator;
301 const_iterator begin()
const noexcept
308 const_iterator end()
const noexcept
310 return key_.data() + key_.length();
316 friend std::ostream&
operator<<(std::ostream& lhs,
const key& rhs)
318 impl::print_to_stream(lhs, rhs.key_);
std::basic_ostream< Char > & operator<<(std::basic_ostream< Char > &lhs, node_type rhs)
Pretty-prints the value of a node_type to a stream.
Definition forward_declarations.hpp:256
constexpr bool is_key_or_convertible
Metafunction for determining if a type is, or is a reference to, a toml::key, or is implicitly or exp...
Definition key.hpp:330