19#ifndef CPPREALM_MANAGED_STRING_HPP
20#define CPPREALM_MANAGED_STRING_HPP
22#include <cpprealm/macros.hpp>
41 operator char()
const;
68 using value_type = std::string;
69 using managed<std::string>::managed_base::managed_base;
70 using managed<std::string>::managed_base::operator=;
72 [[nodiscard]] std::string detach()
const;
77 managed& operator =(std::string&& v) { set(std::move(v));
return *
this; }
78 managed& operator =(
const std::string& v) { set(v);
return *
this; }
79 managed& operator =(
const char* v) { set(v);
return *
this; }
101 operator std::string_view()
const =
delete;
102 operator std::string()
const;
105 [[nodiscard]]
size_t size() const noexcept;
107 void clear() noexcept;
108 void push_back(
char c);
110 managed& append(const std::
string&);
112 managed& operator+=(const std::
string&);
117 rbool operator==(const std::
string& rhs) const noexcept;
118 rbool operator==(const
char* rhs) const noexcept;
119 rbool operator!=(const std::
string& rhs) const noexcept;
120 rbool operator!=(const
char* rhs) const noexcept;
121 rbool contains(const std::
string &s,
bool case_sensitive = true) const noexcept;
122 rbool empty() const noexcept;
126 void inline set(const std::
string& v) { m_obj->template set<std::string>(m_key, v); }
127 [[nodiscard]]
inline std::string get()
const {
return m_obj->get<std::string>(m_key); }
129 managed(
const managed&) =
delete;
130 managed(managed &&) =
delete;
131 managed& operator=(
const managed&) =
delete;
132 managed& operator=(managed&&) =
delete;
133 template<
typename,
typename>
134 friend struct managed;
137 template <>
struct managed<std::optional<std::string>> final :
public managed<std::string> {
138 using value_type = std::optional<std::string>;
139 using managed<std::string>::operator=;
140 managed& operator =(std::optional<std::string>&& v) { set(std::move(v));
return *
this; }
141 managed& operator =(
const std::optional<std::string>& v) { set(v);
return *
this; }
142 managed& operator =(
const char* v) { set(v);
return *
this; }
144 [[nodiscard]] std::optional<std::string> detach()
const {
145 return m_obj->template get_optional<std::string>(m_key);
148 [[nodiscard]] std::optional<std::string> operator *()
const {
152 [[nodiscard]]
operator std::optional<std::string>()
const {
156 rbool operator==(
const std::optional<std::string>& rhs)
const noexcept;
157 rbool operator!=(
const std::optional<std::string>& rhs)
const noexcept;
159 void inline set(
const std::optional<std::string>& v) { m_obj->template set<std::optional<std::string>>(m_key, v); }
165 template<
typename,
typename>
Definition: managed_string.hpp:50
Definition: managed_string.hpp:30
Definition: managed_string.hpp:58
Definition: managed_string.hpp:40
Definition: managed_string.hpp:67
Definition: macros.hpp:286