/*
 * Copyright 2015 - 2025 gary@drinkingtea.net
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */

#pragma once

#include "cstringview.hpp"
#include "string.hpp"

namespace ox {

class StringParam {
	private:
		ox::String m_value;
	public:
		StringParam(StringParam const&) = delete;
		constexpr StringParam(StringParam &&o) noexcept: m_value{std::move(o.m_value)} {}
		constexpr StringParam(char const*value) noexcept: m_value{value} {}
		constexpr StringParam(detail::BaseStringView const&value) noexcept: m_value{value} {}
		template<size_t sz>
		constexpr StringParam(ox::IString<sz> const&value) noexcept: m_value{value} {}
		constexpr StringParam(ox::String const&value) noexcept: m_value{value} {}
		constexpr StringParam(ox::String &&value) noexcept: m_value{std::move(value)} {}
		constexpr operator ox::String() && noexcept { return std::move(m_value); }
		explicit constexpr operator ox::CStringView() const noexcept { return m_value; }
		explicit constexpr operator ox::StringView() const noexcept { return m_value; }
		[[nodiscard]]
		constexpr ox::CStringView view() const noexcept { return m_value; }
};

}
