StormByte C++ Library: Database module 0.0.9999
StormByte-Database is a StormByte library module for handling database connections
Loading...
Searching...
No Matches
named_value.hxx
1#pragma once
2
3#include <StormByte/database/value.hxx>
4
9namespace StormByte::Database {
14 class STORMBYTE_DATABASE_PUBLIC NamedValue: public Value {
15 public:
21 NamedValue(const std::string& name, const Value& value) noexcept:
22 Value(value), m_name(name) {}
23
29 NamedValue(std::string&& name, Value&& value) noexcept:
30 Value(std::move(value)), m_name(std::move(name)) {}
31
36 NamedValue(const NamedValue& other) = default;
37
42 NamedValue(NamedValue&& other) noexcept = default;
43
47 ~NamedValue() noexcept override = default;
48
54 NamedValue& operator=(const NamedValue& other) = default;
55
61 NamedValue& operator=(NamedValue&& other) noexcept = default;
62
68 inline bool operator==(const NamedValue& other) const noexcept {
69 return m_name == other.m_name && Value::operator==(other);
70 }
71
77 inline bool operator!=(const NamedValue& other) const noexcept {
78 return !(*this == other);
79 }
80
85 inline const std::string& Name() const noexcept {
86 return m_name;
87 }
88
89 private:
90 std::string m_name;
91 };
92}
NamedValue class for databases.
Definition named_value.hxx:14
NamedValue(NamedValue &&other) noexcept=default
Move Constructor.
bool operator!=(const NamedValue &other) const noexcept
Inequality operator.
Definition named_value.hxx:77
NamedValue(std::string &&name, Value &&value) noexcept
Constructor.
Definition named_value.hxx:29
NamedValue(const std::string &name, const Value &value) noexcept
Constructor.
Definition named_value.hxx:21
NamedValue(const NamedValue &other)=default
Copy Constructor.
~NamedValue() noexcept override=default
Destructor.
const std::string & Name() const noexcept
Gets the name of the value.
Definition named_value.hxx:85
Value class for databases.
Definition value.hxx:20