From 5043a2f87015d4bea85841067f45b7a9abb423b0 Mon Sep 17 00:00:00 2001 From: lucaspalomodevelop Date: Mon, 15 May 2023 18:33:34 +0200 Subject: [PATCH 1/8] std::string consistency --- src/command.cpp | 4 ++-- src/command.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/command.cpp b/src/command.cpp index dd45437..3bce3d0 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -30,7 +30,7 @@ void Command::addDefaultCommand(void (*func)(int argc, char *argv[])) } // run a command -void Command::runCommand(char *name, int argc, char *argv[]) +void Command::runCommand(std::string name, int argc, char *argv[]) { // std::cout << "Running command: " << name << std::endl; if (this->isInCommands(name)) @@ -50,7 +50,7 @@ void Command::runCommand(char *name, int argc, char *argv[]) } // check if a command is in the command map -bool Command::isInCommands(char *name) +bool Command::isInCommands(std::string name) { for (auto const &command : commands) { diff --git a/src/command.h b/src/command.h index 80234be..a6bff41 100644 --- a/src/command.h +++ b/src/command.h @@ -25,9 +25,9 @@ public: // add a default command to the command map void addDefaultCommand(void (*func)(int argc, char *argv[])); // run a command - void runCommand(char *name, int argc, char *argv[]); + void runCommand(std::string name, int argc, char *argv[]); // check if a command is in the command map - bool isInCommands(char *name); + bool isInCommands(std::string name); std::string listCommands(); From 294ecfcd6e1bff9ddeee3b6b654b5324b7bdc6fe Mon Sep 17 00:00:00 2001 From: lucaspalomodevelop Date: Mon, 15 May 2023 18:39:47 +0200 Subject: [PATCH 2/8] add remove script --- src/main.cpp | 16 ++++++++++++++++ src/main.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 6b91095..4ac4882 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,7 +23,9 @@ void input(int argc, char *argv[]) command.addCommand("help", "- Shows this help message", help); command.addCommand("ls", "- Lists all scripts ", listScripts); command.addCommand("add", "[script] - Adds a script", addScript); + command.addCommand("new", "[script] - Adds a script", addScript); command.addCommand("edit", "[script] - Edits a script", editScript); + command.addCommand("remove", "[script] - Remove a script", removeScript); command.addDefaultCommand(runScript); command.runCommand(argv[1], argc, argv); } @@ -93,6 +95,20 @@ void editScript(std::string name) #endif } +void removeScript(int argc, char *argv[]) +{ + std::string script = dir + "/" + argv[1]; + if (std::filesystem::exists(script)) + { + std::cout << "Removing script: " << argv[1] << std::endl; + std::filesystem::remove(script); + } + else + { + std::cout << "Script " << argv[1] << " does not exist" << std::endl; + } +} + // help function for showing help message void help(int argc, char *argv[]) { diff --git a/src/main.h b/src/main.h index 232abb5..9c6f034 100644 --- a/src/main.h +++ b/src/main.h @@ -31,6 +31,8 @@ void addScript(int argc, char *argv[]); // edit a script in the autom directory void editScript(int argc, char *argv[]); void editScript(std::string name); +// remove a script in the autom directory +void removeScript(int argc, char *argv[]); // help function for showing help message void help(int argc, char *argv[]); // void create(int argc,char *argv[]); From 21986aae0d72ffaa46fe8695aba13d5a50d3683d Mon Sep 17 00:00:00 2001 From: lucaspalomodevelop Date: Mon, 15 May 2023 20:27:24 +0200 Subject: [PATCH 3/8] fix help display bug --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 4ac4882..548a5a2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -114,6 +114,6 @@ void help(int argc, char *argv[]) { std::cout << "Usage: autom [command] [options]" << std::endl; std::cout << "Commands:" << std::endl; - std::cout << " [script] - Runs a script if autom has not command with that name" << std::endl; + std::cout << "\t[script] - Runs a script if autom has not command with that name" << std::endl; std::cout << command.listCommands() << std::endl; } \ No newline at end of file From 8a1d70479dfd7c503b5168f6b8e0ff1a18502693 Mon Sep 17 00:00:00 2001 From: lucaspalomodevelop Date: Thu, 8 Jun 2023 21:05:30 +0200 Subject: [PATCH 4/8] add show command --- src/main.cpp | 22 ++++++++++++++++++++++ src/main.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 548a5a2..df693e2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,6 +26,7 @@ void input(int argc, char *argv[]) command.addCommand("new", "[script] - Adds a script", addScript); command.addCommand("edit", "[script] - Edits a script", editScript); command.addCommand("remove", "[script] - Remove a script", removeScript); + command.addCommand("show", "[script] - Shows a script", showScript); command.addDefaultCommand(runScript); command.runCommand(argv[1], argc, argv); } @@ -41,6 +42,27 @@ void runScript(int argc, char *argv[]) system(script.c_str()); } +void showScript(int argc, char *argv[]) +{ + std::string script = dir + "/" + argv[1]; + if (std::filesystem::exists(script)) + { + std::cout << "Showing script: " << argv[1] << std::endl; + std::ifstream file(script); + std::string line; + int line_number = 0; + while (getline(file, line)) + { + line_number++; + std::cout << line_number << " "<< line << std::endl; + } + } + else + { + std::cout << "Script " << argv[1] << " does not exist" << std::endl; + } +} + // list all scripts in the autom directory void listScripts(int argc, char *argv[]) { diff --git a/src/main.h b/src/main.h index 9c6f034..18cbf38 100644 --- a/src/main.h +++ b/src/main.h @@ -33,6 +33,8 @@ void editScript(int argc, char *argv[]); void editScript(std::string name); // remove a script in the autom directory void removeScript(int argc, char *argv[]); +// show a script in the autom directory +void showScript(int argc, char *argv[]); // help function for showing help message void help(int argc, char *argv[]); // void create(int argc,char *argv[]); From 3b2f277b184a70f9585133c6e8c41b4d7c0b6bec Mon Sep 17 00:00:00 2001 From: lucaspalomodevelop Date: Wed, 28 Jun 2023 12:11:51 +0200 Subject: [PATCH 5/8] add toml configure file | and setup-routine --- lib/toml++/impl/array.h | 1727 ++++++++++ lib/toml++/impl/array.inl | 382 +++ lib/toml++/impl/at_path.h | 97 + lib/toml++/impl/at_path.inl | 290 ++ lib/toml++/impl/date_time.h | 468 +++ lib/toml++/impl/formatter.h | 191 ++ lib/toml++/impl/formatter.inl | 513 +++ lib/toml++/impl/forward_declarations.h | 1058 ++++++ lib/toml++/impl/header_end.h | 13 + lib/toml++/impl/header_start.h | 15 + lib/toml++/impl/json_formatter.h | 142 + lib/toml++/impl/json_formatter.inl | 121 + lib/toml++/impl/key.h | 335 ++ lib/toml++/impl/make_node.h | 182 ++ lib/toml++/impl/node.h | 1115 +++++++ lib/toml++/impl/node.inl | 141 + lib/toml++/impl/node_view.h | 839 +++++ lib/toml++/impl/parse_error.h | 139 + lib/toml++/impl/parse_result.h | 499 +++ lib/toml++/impl/parser.h | 390 +++ lib/toml++/impl/parser.inl | 3917 +++++++++++++++++++++++ lib/toml++/impl/path.h | 851 +++++ lib/toml++/impl/path.inl | 523 +++ lib/toml++/impl/preprocessor.h | 1256 ++++++++ lib/toml++/impl/print_to_stream.h | 129 + lib/toml++/impl/print_to_stream.inl | 490 +++ lib/toml++/impl/simd.h | 35 + lib/toml++/impl/source_region.h | 223 ++ lib/toml++/impl/std_except.h | 12 + lib/toml++/impl/std_initializer_list.h | 10 + lib/toml++/impl/std_map.h | 11 + lib/toml++/impl/std_new.h | 18 + lib/toml++/impl/std_optional.h | 32 + lib/toml++/impl/std_string.h | 53 + lib/toml++/impl/std_string.inl | 99 + lib/toml++/impl/std_utility.h | 10 + lib/toml++/impl/std_variant.h | 10 + lib/toml++/impl/std_vector.h | 11 + lib/toml++/impl/table.h | 1961 ++++++++++++ lib/toml++/impl/table.inl | 318 ++ lib/toml++/impl/toml_formatter.h | 153 + lib/toml++/impl/toml_formatter.inl | 405 +++ lib/toml++/impl/unicode.h | 197 ++ lib/toml++/impl/unicode.inl | 60 + lib/toml++/impl/unicode_autogenerated.h | 182 ++ lib/toml++/impl/value.h | 1270 ++++++++ lib/toml++/impl/version.h | 13 + lib/toml++/impl/yaml_formatter.h | 139 + lib/toml++/impl/yaml_formatter.inl | 165 + lib/toml++/toml.h | 220 ++ makefile | 2 +- src/main.cpp | 16 +- src/main.h | 19 +- src/settings.cpp | 33 + src/settings.h | 29 + src/setup.h | 63 + 56 files changed, 21570 insertions(+), 22 deletions(-) create mode 100644 lib/toml++/impl/array.h create mode 100644 lib/toml++/impl/array.inl create mode 100644 lib/toml++/impl/at_path.h create mode 100644 lib/toml++/impl/at_path.inl create mode 100644 lib/toml++/impl/date_time.h create mode 100644 lib/toml++/impl/formatter.h create mode 100644 lib/toml++/impl/formatter.inl create mode 100644 lib/toml++/impl/forward_declarations.h create mode 100644 lib/toml++/impl/header_end.h create mode 100644 lib/toml++/impl/header_start.h create mode 100644 lib/toml++/impl/json_formatter.h create mode 100644 lib/toml++/impl/json_formatter.inl create mode 100644 lib/toml++/impl/key.h create mode 100644 lib/toml++/impl/make_node.h create mode 100644 lib/toml++/impl/node.h create mode 100644 lib/toml++/impl/node.inl create mode 100644 lib/toml++/impl/node_view.h create mode 100644 lib/toml++/impl/parse_error.h create mode 100644 lib/toml++/impl/parse_result.h create mode 100644 lib/toml++/impl/parser.h create mode 100644 lib/toml++/impl/parser.inl create mode 100644 lib/toml++/impl/path.h create mode 100644 lib/toml++/impl/path.inl create mode 100644 lib/toml++/impl/preprocessor.h create mode 100644 lib/toml++/impl/print_to_stream.h create mode 100644 lib/toml++/impl/print_to_stream.inl create mode 100644 lib/toml++/impl/simd.h create mode 100644 lib/toml++/impl/source_region.h create mode 100644 lib/toml++/impl/std_except.h create mode 100644 lib/toml++/impl/std_initializer_list.h create mode 100644 lib/toml++/impl/std_map.h create mode 100644 lib/toml++/impl/std_new.h create mode 100644 lib/toml++/impl/std_optional.h create mode 100644 lib/toml++/impl/std_string.h create mode 100644 lib/toml++/impl/std_string.inl create mode 100644 lib/toml++/impl/std_utility.h create mode 100644 lib/toml++/impl/std_variant.h create mode 100644 lib/toml++/impl/std_vector.h create mode 100644 lib/toml++/impl/table.h create mode 100644 lib/toml++/impl/table.inl create mode 100644 lib/toml++/impl/toml_formatter.h create mode 100644 lib/toml++/impl/toml_formatter.inl create mode 100644 lib/toml++/impl/unicode.h create mode 100644 lib/toml++/impl/unicode.inl create mode 100644 lib/toml++/impl/unicode_autogenerated.h create mode 100644 lib/toml++/impl/value.h create mode 100644 lib/toml++/impl/version.h create mode 100644 lib/toml++/impl/yaml_formatter.h create mode 100644 lib/toml++/impl/yaml_formatter.inl create mode 100644 lib/toml++/toml.h create mode 100644 src/settings.cpp create mode 100644 src/settings.h create mode 100644 src/setup.h diff --git a/lib/toml++/impl/array.h b/lib/toml++/impl/array.h new file mode 100644 index 0000000..dd217c7 --- /dev/null +++ b/lib/toml++/impl/array.h @@ -0,0 +1,1727 @@ +//# This file is a part of toml++ and is subject to the the terms of the MIT license. +//# Copyright (c) Mark Gillard +//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. +// SPDX-License-Identifier: MIT +#pragma once + +#include "std_utility.h" +#include "std_vector.h" +#include "std_initializer_list.h" +#include "value.h" +#include "make_node.h" +#include "header_start.h" + +/// \cond +TOML_IMPL_NAMESPACE_START +{ + template + class TOML_TRIVIAL_ABI array_iterator + { + private: + template + friend class array_iterator; + + using mutable_vector_iterator = std::vector::iterator; + using const_vector_iterator = std::vector::const_iterator; + using vector_iterator = std::conditional_t; + + mutable vector_iterator iter_; + + public: + using value_type = std::conditional_t; + using reference = value_type&; + using pointer = value_type*; + using difference_type = ptrdiff_t; + using iterator_category = typename std::iterator_traits::iterator_category; + + TOML_NODISCARD_CTOR + array_iterator() noexcept = default; + + TOML_NODISCARD_CTOR + explicit array_iterator(mutable_vector_iterator iter) noexcept // + : iter_{ iter } + {} + + TOML_CONSTRAINED_TEMPLATE(C, bool C = IsConst) + TOML_NODISCARD_CTOR + explicit array_iterator(const_vector_iterator iter) noexcept // + : iter_{ iter } + {} + + TOML_CONSTRAINED_TEMPLATE(C, bool C = IsConst) + TOML_NODISCARD_CTOR + array_iterator(const array_iterator& other) noexcept // + : iter_{ other.iter_ } + {} + + TOML_NODISCARD_CTOR + array_iterator(const array_iterator&) noexcept = default; + + array_iterator& operator=(const array_iterator&) noexcept = default; + + array_iterator& operator++() noexcept // ++pre + { + ++iter_; + return *this; + } + + array_iterator operator++(int) noexcept // post++ + { + array_iterator out{ iter_ }; + ++iter_; + return out; + } + + array_iterator& operator--() noexcept // --pre + { + --iter_; + return *this; + } + + array_iterator operator--(int) noexcept // post-- + { + array_iterator out{ iter_ }; + --iter_; + return out; + } + + TOML_PURE_INLINE_GETTER + reference operator*() const noexcept + { + return *iter_->get(); + } + + TOML_PURE_INLINE_GETTER + pointer operator->() const noexcept + { + return iter_->get(); + } + + TOML_PURE_INLINE_GETTER + explicit operator const vector_iterator&() const noexcept + { + return iter_; + } + + TOML_CONSTRAINED_TEMPLATE(!C, bool C = IsConst) + TOML_PURE_INLINE_GETTER + explicit operator const const_vector_iterator() const noexcept + { + return iter_; + } + + array_iterator& operator+=(ptrdiff_t rhs) noexcept + { + iter_ += rhs; + return *this; + } + + array_iterator& operator-=(ptrdiff_t rhs) noexcept + { + iter_ -= rhs; + return *this; + } + + TOML_NODISCARD + friend array_iterator operator+(const array_iterator& lhs, ptrdiff_t rhs) noexcept + { + return array_iterator{ lhs.iter_ + rhs }; + } + + TOML_NODISCARD + friend array_iterator operator+(ptrdiff_t lhs, const array_iterator& rhs) noexcept + { + return array_iterator{ rhs.iter_ + lhs }; + } + + TOML_NODISCARD + friend array_iterator operator-(const array_iterator& lhs, ptrdiff_t rhs) noexcept + { + return array_iterator{ lhs.iter_ - rhs }; + } + + TOML_PURE_INLINE_GETTER + friend ptrdiff_t operator-(const array_iterator& lhs, const array_iterator& rhs) noexcept + { + return lhs.iter_ - rhs.iter_; + } + + TOML_PURE_INLINE_GETTER + friend bool operator==(const array_iterator& lhs, const array_iterator& rhs) noexcept + { + return lhs.iter_ == rhs.iter_; + } + + TOML_PURE_INLINE_GETTER + friend bool operator!=(const array_iterator& lhs, const array_iterator& rhs) noexcept + { + return lhs.iter_ != rhs.iter_; + } + + TOML_PURE_INLINE_GETTER + friend bool operator<(const array_iterator& lhs, const array_iterator& rhs) noexcept + { + return lhs.iter_ < rhs.iter_; + } + + TOML_PURE_INLINE_GETTER + friend bool operator<=(const array_iterator& lhs, const array_iterator& rhs) noexcept + { + return lhs.iter_ <= rhs.iter_; + } + + TOML_PURE_INLINE_GETTER + friend bool operator>(const array_iterator& lhs, const array_iterator& rhs) noexcept + { + return lhs.iter_ > rhs.iter_; + } + + TOML_PURE_INLINE_GETTER + friend bool operator>=(const array_iterator& lhs, const array_iterator& rhs) noexcept + { + return lhs.iter_ >= rhs.iter_; + } + + TOML_PURE_INLINE_GETTER + reference operator[](ptrdiff_t idx) const noexcept + { + return *(iter_ + idx)->get(); + } + }; + + struct array_init_elem + { + mutable node_ptr value; + + template + TOML_NODISCARD_CTOR + array_init_elem(T&& val, value_flags flags = preserve_source_value_flags) // + : value{ make_node(static_cast(val), flags) } + {} + }; +} +TOML_IMPL_NAMESPACE_END; +/// \endcond + +TOML_NAMESPACE_START +{ + /// \brief A RandomAccessIterator for iterating over elements in a toml::array. + using array_iterator = POXY_IMPLEMENTATION_DETAIL(impl::array_iterator); + + /// \brief A RandomAccessIterator for iterating over const elements in a toml::array. + using const_array_iterator = POXY_IMPLEMENTATION_DETAIL(impl::array_iterator); + + /// \brief A TOML array. + /// + /// \detail The interface of this type is modeled after std::vector, with some + /// additional considerations made for the heterogeneous nature of a + /// TOML array. + /// + /// \godbolt{sjK4da} + /// + /// \cpp + /// + /// toml::table tbl = toml::parse(R"( + /// arr = [1, 2, 3, 4, 'five'] + /// )"sv); + /// + /// // get the element as an array + /// toml::array& arr = *tbl.get_as("arr"); + /// std::cout << arr << "\n"; + /// + /// // increment each element with visit() + /// for (auto&& elem : arr) + /// { + /// elem.visit([](auto&& el) noexcept + /// { + /// if constexpr (toml::is_number) + /// (*el)++; + /// else if constexpr (toml::is_string) + /// el = "six"sv; + /// }); + /// } + /// std::cout << arr << "\n"; + /// + /// // add and remove elements + /// arr.push_back(7); + /// arr.push_back(8.0f); + /// arr.push_back("nine"sv); + /// arr.erase(arr.cbegin()); + /// std::cout << arr << "\n"; + /// + /// // emplace elements + /// arr.emplace_back("ten"); + /// arr.emplace_back(11, 12.0); + /// std::cout << arr << "\n"; + /// \ecpp + /// + /// \out + /// [ 1, 2, 3, 4, 'five' ] + /// [ 2, 3, 4, 5, 'six' ] + /// [ 3, 4, 5, 'six', 7, 8.0, 'nine' ] + /// [ 3, 4, 5, 'six', 7, 8.0, 'nine', 'ten', [ 11, 12.0 ] ] + /// \eout + class TOML_EXPORTED_CLASS array : public node + { + private: + /// \cond + + using vector_type = std::vector; + using vector_iterator = typename vector_type::iterator; + using const_vector_iterator = typename vector_type::const_iterator; + vector_type elems_; + + TOML_NODISCARD_CTOR + TOML_EXPORTED_MEMBER_FUNCTION + array(const impl::array_init_elem*, const impl::array_init_elem*); + + TOML_NODISCARD_CTOR + array(std::false_type, std::initializer_list elems) // + : array{ elems.begin(), elems.end() } + {} + + TOML_EXPORTED_MEMBER_FUNCTION + void preinsertion_resize(size_t idx, size_t count); + + TOML_EXPORTED_MEMBER_FUNCTION + void insert_at_back(impl::node_ptr&&); + + TOML_EXPORTED_MEMBER_FUNCTION + vector_iterator insert_at(const_vector_iterator, impl::node_ptr&&); + + template + void emplace_back_if_not_empty_view(T&& val, value_flags flags) + { + if constexpr (is_node_view) + { + if (!val) + return; + } + insert_at_back(impl::make_node(static_cast(val), flags)); + } + + TOML_NODISCARD + TOML_EXPORTED_MEMBER_FUNCTION + size_t total_leaf_count() const noexcept; + + TOML_EXPORTED_MEMBER_FUNCTION + void flatten_child(array&& child, size_t& dest_index) noexcept; + + /// \endcond + + public: + using value_type = node; + using size_type = size_t; + using difference_type = ptrdiff_t; + using reference = node&; + using const_reference = const node&; + + /// \brief Default constructor. + TOML_NODISCARD_CTOR + TOML_EXPORTED_MEMBER_FUNCTION + array() noexcept; + + TOML_EXPORTED_MEMBER_FUNCTION + ~array() noexcept; + + /// \brief Copy constructor. + TOML_NODISCARD_CTOR + TOML_EXPORTED_MEMBER_FUNCTION + array(const array&); + + /// \brief Move constructor. + TOML_NODISCARD_CTOR + TOML_EXPORTED_MEMBER_FUNCTION + array(array&& other) noexcept; + + /// \brief Constructs an array with one or more initial elements. + /// + /// \detail \cpp + /// auto arr = toml::array{ 1, 2.0, "three"sv, toml::array{ 4, 5 } }; + /// std::cout << arr << "\n"; + /// \ecpp + /// + /// \out + /// [ 1, 2.0, 'three', [ 4, 5 ] ] + /// \eout + /// + /// \remark \parblock If you need to construct an array with one child array element, the array's move constructor + /// will take precedence and perform a move-construction instead. You can use toml::inserter to + /// suppress this behaviour: \cpp + /// // desired result: [ [ 42 ] ] + /// auto bad = toml::array{ toml::array{ 42 } } + /// auto good = toml::array{ toml::inserter{ toml::array{ 42 } } } + /// std::cout << "bad: " << bad << "\n"; + /// std::cout << "good:" << good << "\n"; + /// \ecpp + /// + /// \out + /// bad: [ 42 ] + /// good: [ [ 42 ] ] + /// \eout + /// + /// \endparblock + /// + /// \tparam ElemType One of the TOML node or value types (or a type promotable to one). + /// \tparam ElemTypes One of the TOML node or value types (or a type promotable to one). + /// \param val The node or value used to initialize element 0. + /// \param vals The nodes or values used to initialize elements 1...N. + TOML_CONSTRAINED_TEMPLATE((sizeof...(ElemTypes) > 0 || !std::is_same_v, array>), + typename ElemType, + typename... ElemTypes) + TOML_NODISCARD_CTOR + explicit array(ElemType&& val, ElemTypes&&... vals) + : array{ std::false_type{}, + std::initializer_list{ static_cast(val), + static_cast(vals)... } } + {} + + /// \brief Copy-assignment operator. + TOML_EXPORTED_MEMBER_FUNCTION + array& operator=(const array&); + + /// \brief Move-assignment operator. + TOML_EXPORTED_MEMBER_FUNCTION + array& operator=(array&& rhs) noexcept; + + /// \name Type checks + /// @{ + + /// \brief Returns #toml::node_type::array. + TOML_CONST_INLINE_GETTER + node_type type() const noexcept final + { + return node_type::array; + } + + TOML_PURE_GETTER + TOML_EXPORTED_MEMBER_FUNCTION + bool is_homogeneous(node_type ntype) const noexcept final; + + TOML_PURE_GETTER + TOML_EXPORTED_MEMBER_FUNCTION + bool is_homogeneous(node_type ntype, node*& first_nonmatch) noexcept final; + + TOML_PURE_GETTER + TOML_EXPORTED_MEMBER_FUNCTION + bool is_homogeneous(node_type ntype, const node*& first_nonmatch) const noexcept final; + + /// \cond + template + TOML_PURE_GETTER + bool is_homogeneous() const noexcept + { + using type = impl::remove_cvref>; + static_assert(std::is_void_v || toml::is_value || toml::is_container, + "The template type argument of array::is_homogeneous() must be void or one " + "of:" TOML_SA_UNWRAPPED_NODE_TYPE_LIST); + + return is_homogeneous(impl::node_type_of); + } + /// \endcond + + /// \brief Returns `false`. + TOML_CONST_INLINE_GETTER + bool is_table() const noexcept final + { + return false; + } + + /// \brief Returns `true`. + TOML_CONST_INLINE_GETTER + bool is_array() const noexcept final + { + return true; + } + + /// \brief Returns `true` if the array contains only tables. + TOML_PURE_GETTER + bool is_array_of_tables() const noexcept final + { + return is_homogeneous(node_type::table); + } + + /// \brief Returns `false`. + TOML_CONST_INLINE_GETTER + bool is_value() const noexcept final + { + return false; + } + + /// \brief Returns `false`. + TOML_CONST_INLINE_GETTER + bool is_string() const noexcept final + { + return false; + } + + /// \brief Returns `false`. + TOML_CONST_INLINE_GETTER + bool is_integer() const noexcept final + { + return false; + } + + /// \brief Returns `false`. + TOML_CONST_INLINE_GETTER + bool is_floating_point() const noexcept final + { + return false; + } + + /// \brief Returns `false`. + TOML_CONST_INLINE_GETTER + bool is_number() const noexcept final + { + return false; + } + + /// \brief Returns `false`. + TOML_CONST_INLINE_GETTER + bool is_boolean() const noexcept final + { + return false; + } + + /// \brief Returns `false`. + TOML_CONST_INLINE_GETTER + bool is_date() const noexcept final + { + return false; + } + + /// \brief Returns `false`. + TOML_CONST_INLINE_GETTER + bool is_time() const noexcept final + { + return false; + } + + /// \brief Returns `false`. + TOML_CONST_INLINE_GETTER + bool is_date_time() const noexcept final + { + return false; + } + + /// @} + + /// \name Type casts + /// @{ + + /// \brief Returns `nullptr`. + TOML_CONST_INLINE_GETTER + table* as_table() noexcept final + { + return nullptr; + } + + /// \brief Returns a pointer to the array. + TOML_CONST_INLINE_GETTER + array* as_array() noexcept final + { + return this; + } + + /// \brief Returns `nullptr`. + TOML_CONST_INLINE_GETTER + toml::value* as_string() noexcept final + { + return nullptr; + } + + /// \brief Returns `nullptr`. + TOML_CONST_INLINE_GETTER + toml::value* as_integer() noexcept final + { + return nullptr; + } + + /// \brief Returns `nullptr`. + TOML_CONST_INLINE_GETTER + toml::value* as_floating_point() noexcept final + { + return nullptr; + } + + /// \brief Returns `nullptr`. + TOML_CONST_INLINE_GETTER + toml::value* as_boolean() noexcept final + { + return nullptr; + } + + /// \brief Returns `nullptr`. + TOML_CONST_INLINE_GETTER + toml::value* as_date() noexcept final + { + return nullptr; + } + + /// \brief Returns `nullptr`. + TOML_CONST_INLINE_GETTER + toml::value