2020-03-12 15:23:25 +00:00
|
|
|
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
|
2021-01-02 15:48:47 +00:00
|
|
|
//# Copyright (c) Mark Gillard <mark.gillard@outlook.com.au>
|
2020-03-12 15:23:25 +00:00
|
|
|
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
|
2020-04-10 16:46:00 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2020-03-12 15:23:25 +00:00
|
|
|
|
2020-03-01 14:56:40 +00:00
|
|
|
#pragma once
|
2020-04-09 08:13:12 +00:00
|
|
|
//# {{
|
2020-06-23 10:04:05 +00:00
|
|
|
#include "toml_preprocessor.h"
|
|
|
|
#if !TOML_IMPLEMENTATION
|
2020-04-01 12:53:10 +00:00
|
|
|
#error This is an implementation-only header.
|
|
|
|
#endif
|
2020-04-09 08:13:12 +00:00
|
|
|
//# }}
|
2020-03-01 14:56:40 +00:00
|
|
|
|
2020-06-23 10:04:05 +00:00
|
|
|
#include "toml_node.h"
|
|
|
|
|
2020-07-25 17:37:30 +00:00
|
|
|
TOML_NAMESPACE_START
|
2020-03-01 14:56:40 +00:00
|
|
|
{
|
2020-07-30 20:31:08 +00:00
|
|
|
TOML_EXTERNAL_LINKAGE
|
|
|
|
node::node(const node& /*other*/) noexcept
|
|
|
|
{
|
2020-09-13 11:02:29 +00:00
|
|
|
// does not copy source information - this is not an error
|
|
|
|
//
|
|
|
|
// see https://github.com/marzer/tomlplusplus/issues/49#issuecomment-665089577
|
2020-07-30 20:31:08 +00:00
|
|
|
}
|
|
|
|
|
2020-04-09 08:13:12 +00:00
|
|
|
TOML_EXTERNAL_LINKAGE
|
2020-03-01 14:56:40 +00:00
|
|
|
node::node(node && other) noexcept
|
|
|
|
: source_{ std::move(other.source_) }
|
|
|
|
{
|
|
|
|
other.source_.begin = {};
|
|
|
|
other.source_.end = {};
|
|
|
|
}
|
|
|
|
|
2020-04-09 08:13:12 +00:00
|
|
|
TOML_EXTERNAL_LINKAGE
|
2020-07-30 20:31:08 +00:00
|
|
|
node& node::operator= (const node& /*rhs*/) noexcept
|
|
|
|
{
|
2020-09-13 11:02:29 +00:00
|
|
|
// does not copy source information - this is not an error
|
|
|
|
//
|
|
|
|
// see https://github.com/marzer/tomlplusplus/issues/49#issuecomment-665089577
|
2020-07-30 20:31:08 +00:00
|
|
|
|
|
|
|
source_ = {};
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
TOML_EXTERNAL_LINKAGE
|
|
|
|
node& node::operator= (node && rhs) noexcept
|
2020-03-01 14:56:40 +00:00
|
|
|
{
|
|
|
|
source_ = std::move(rhs.source_);
|
|
|
|
rhs.source_.begin = {};
|
|
|
|
rhs.source_.end = {};
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2020-07-05 15:08:28 +00:00
|
|
|
#define TOML_MEMBER_ATTR(attr) TOML_EXTERNAL_LINKAGE TOML_ATTR(attr)
|
2020-04-09 08:13:12 +00:00
|
|
|
|
2020-07-05 15:08:28 +00:00
|
|
|
TOML_MEMBER_ATTR(const) bool node::is_string() const noexcept { return false; }
|
|
|
|
TOML_MEMBER_ATTR(const) bool node::is_integer() const noexcept { return false; }
|
|
|
|
TOML_MEMBER_ATTR(const) bool node::is_floating_point() const noexcept { return false; }
|
|
|
|
TOML_MEMBER_ATTR(const) bool node::is_number() const noexcept { return false; }
|
|
|
|
TOML_MEMBER_ATTR(const) bool node::is_boolean() const noexcept { return false; }
|
|
|
|
TOML_MEMBER_ATTR(const) bool node::is_date() const noexcept { return false; }
|
|
|
|
TOML_MEMBER_ATTR(const) bool node::is_time() const noexcept { return false; }
|
|
|
|
TOML_MEMBER_ATTR(const) bool node::is_date_time() const noexcept { return false; }
|
|
|
|
TOML_MEMBER_ATTR(const) bool node::is_array_of_tables() const noexcept { return false; }
|
|
|
|
|
|
|
|
TOML_MEMBER_ATTR(const) table* node::as_table() noexcept { return nullptr; }
|
|
|
|
TOML_MEMBER_ATTR(const) array* node::as_array() noexcept { return nullptr; }
|
2020-07-18 12:10:19 +00:00
|
|
|
TOML_MEMBER_ATTR(const) value<std::string>* node::as_string() noexcept { return nullptr; }
|
2020-07-05 15:08:28 +00:00
|
|
|
TOML_MEMBER_ATTR(const) value<int64_t>* node::as_integer() noexcept { return nullptr; }
|
|
|
|
TOML_MEMBER_ATTR(const) value<double>* node::as_floating_point() noexcept { return nullptr; }
|
|
|
|
TOML_MEMBER_ATTR(const) value<bool>* node::as_boolean() noexcept { return nullptr; }
|
|
|
|
TOML_MEMBER_ATTR(const) value<date>* node::as_date() noexcept { return nullptr; }
|
|
|
|
TOML_MEMBER_ATTR(const) value<time>* node::as_time() noexcept { return nullptr; }
|
|
|
|
TOML_MEMBER_ATTR(const) value<date_time>* node::as_date_time() noexcept { return nullptr; }
|
|
|
|
|
|
|
|
TOML_MEMBER_ATTR(const) const table* node::as_table() const noexcept { return nullptr; }
|
|
|
|
TOML_MEMBER_ATTR(const) const array* node::as_array() const noexcept { return nullptr; }
|
2020-07-18 12:10:19 +00:00
|
|
|
TOML_MEMBER_ATTR(const) const value<std::string>* node::as_string() const noexcept { return nullptr; }
|
2020-07-05 15:08:28 +00:00
|
|
|
TOML_MEMBER_ATTR(const) const value<int64_t>* node::as_integer() const noexcept { return nullptr; }
|
|
|
|
TOML_MEMBER_ATTR(const) const value<double>* node::as_floating_point() const noexcept { return nullptr; }
|
|
|
|
TOML_MEMBER_ATTR(const) const value<bool>* node::as_boolean() const noexcept { return nullptr; }
|
|
|
|
TOML_MEMBER_ATTR(const) const value<date>* node::as_date() const noexcept { return nullptr; }
|
|
|
|
TOML_MEMBER_ATTR(const) const value<time>* node::as_time() const noexcept { return nullptr; }
|
|
|
|
TOML_MEMBER_ATTR(const) const value<date_time>* node::as_date_time() const noexcept { return nullptr; }
|
2020-04-09 08:13:12 +00:00
|
|
|
|
2020-07-05 15:08:28 +00:00
|
|
|
TOML_MEMBER_ATTR(const) const source_region& node::source() const noexcept { return source_; }
|
2020-04-09 08:13:12 +00:00
|
|
|
|
2020-07-05 15:08:28 +00:00
|
|
|
#undef TOML_MEMBER_ATTR
|
2020-08-08 23:12:17 +00:00
|
|
|
|
|
|
|
TOML_EXTERNAL_LINKAGE
|
|
|
|
node::operator node_view<node>() noexcept
|
|
|
|
{
|
|
|
|
return node_view<node>(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
TOML_EXTERNAL_LINKAGE
|
|
|
|
node::operator node_view<const node>() const noexcept
|
|
|
|
{
|
|
|
|
return node_view<const node>(this);
|
|
|
|
}
|
2020-03-01 14:56:40 +00:00
|
|
|
}
|
2021-04-18 12:04:46 +00:00
|
|
|
TOML_NAMESPACE_END;
|