summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-06-26 02:24:26 -0700
committerFuwn <[email protected]>2022-06-26 02:24:26 -0700
commit0a1e6185d1a1e5a923e483d6bc36888ca49e16b8 (patch)
tree899d9a449838def9d02c3d46999cc4e1dc5036ac /src
parentrefactor(node): no explicit copy constructor (diff)
downloadcait-0a1e6185d1a1e5a923e483d6bc36888ca49e16b8.tar.xz
cait-0a1e6185d1a1e5a923e483d6bc36888ca49e16b8.zip
refactor(node): hide stringable
Diffstat (limited to 'src')
-rw-r--r--src/node.cc6
-rw-r--r--src/node.hh28
2 files changed, 18 insertions, 16 deletions
diff --git a/src/node.cc b/src/node.cc
index 0079dcb..9b76c27 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -22,12 +22,6 @@
namespace cait::node {
-stringable::stringable() = default;
-
-stringable::stringable(const stringable &) = default;
-
-stringable::~stringable() = default;
-
variable::variable(const token &variable_name,
std::vector<token> variable_value_list)
: _name(variable_name), _value_list(std::move(variable_value_list)) {}
diff --git a/src/node.hh b/src/node.hh
index 0778962..cc2362c 100644
--- a/src/node.hh
+++ b/src/node.hh
@@ -28,7 +28,21 @@
#include "token.hh"
-namespace cait::node {
+namespace cait {
+
+namespace {
+
+class stringable {
+public:
+ [[maybe_unused]] stringable() = default;
+ stringable(const stringable &) = default;
+ virtual ~stringable() = default;
+ [[nodiscard]] virtual auto string() const -> std::string = 0;
+};
+
+} // namespace
+
+namespace node {
class variable;
class rule;
@@ -42,14 +56,6 @@ using item_map_type = std::map<std::string, std::vector<token>>;
using node_set =
std::variant<rule, build, default_, variable, pool, include, subninja>;
-class stringable {
-public:
- stringable();
- stringable(const stringable &);
- virtual ~stringable();
- [[nodiscard]] virtual auto string() const -> std::string = 0;
-};
-
class variable : stringable {
private:
const token &_name;
@@ -134,6 +140,8 @@ public:
[[maybe_unused]] [[nodiscard]] auto path() const noexcept -> const token &;
};
-} // namespace cait::node
+} // namespace node
+
+} // namespace cait
#endif // NODE_HH