StormByte C++ Library: Config module 0.0.9999
StormByte-Config is a StormByte library module for parsing configuration files
Loading...
Searching...
No Matches
comment.hxx
1#pragma once
2
3#include <StormByte/config/item/value.hxx>
4
5#include <string>
6
11namespace StormByte::Config::Item {
17 template<CommentType T>
18 class STORMBYTE_CONFIG_PUBLIC Comment final: public Value<std::string> {
19 public:
24 Comment(const std::string& comment):Value<std::string>(comment) {}
25
30 Comment(std::string&& comment):Value<std::string>(std::move(comment)) {}
31
36 Comment(const Comment& base) = default;
37
42 Comment(Comment&& base) = default;
43
48 Comment& operator=(const Comment& base) = default;
49
54 Comment& operator=(Comment&& base) = default;
55
59 ~Comment() noexcept override = default;
60
66 std::string Serialize(const int& indent_level) const noexcept override;
67
72 constexpr Item::Type Type() const noexcept override {
73 return Type::Comment;
74 }
75
80 constexpr CommentType CommentType() const noexcept {
81 return T;
82 }
83
88 constexpr std::string CommentTypeToString() const noexcept {
89 return Item::TypeToString(T);
90 }
91
96 PointerType Clone() const override {
97 return MakePointer<Comment<T>>(*this);
98 }
99
104 PointerType Move() override {
105 return MakePointer<Comment<T>>(std::move(*this));
106 }
107 };
108}
Represents a comment item in a configuration file.
Definition comment.hxx:18
Comment(const std::string &comment)
Constructs a Comment with the given string.
Definition comment.hxx:24
Comment(Comment &&base)=default
Comment & operator=(const Comment &base)=default
Comment(const Comment &base)=default
~Comment() noexcept override=default
constexpr std::string CommentTypeToString() const noexcept
Definition comment.hxx:88
constexpr CommentType CommentType() const noexcept
Definition comment.hxx:80
Comment(std::string &&comment)
Definition comment.hxx:30
PointerType Move() override
Definition comment.hxx:104
Comment & operator=(Comment &&base)=default
PointerType Clone() const override
Definition comment.hxx:96
Represents a configuration item with a value.
Definition value.hxx:16
All the configuration item classes namespace.