/
farado
/
farado-binara
Обзор
Документация
Войти
/
farado
/
farado-binara
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
develop
src/common/elements/role_menu_item.cpp
113 строк
2 KB
Ostapenko Alexey
[common] Удаление лишних include.
20 мар 2024, 18:04
20 мар 2024, 18:04
b11d4b4
Код
Авторство
О чём код?
#include <mutex> #include "role_menu_item.h" namespace Elements { RoleMenuItem::RoleMenuItem(const RoleMenuItem& other) : Element(other) , m_roleId(other.m_roleId) , m_caption(other.m_caption) , m_link(other.m_link) , m_icon(other.m_icon) { } bool RoleMenuItem::isSame(Element* const other) const { const auto otherElement = dynamic_cast<RoleMenuItem const*>(other); if (nullptr == otherElement) return false; return bool( m_id == otherElement->m_id && m_roleId == otherElement->m_roleId && m_caption == otherElement->m_caption && m_link == otherElement->m_link && m_icon == otherElement->m_icon ); } Common::Json RoleMenuItem::toJson() const { std::shared_lock locker(m_lock); Common::Json result; result["id"] = m_id; result["elementType"] = unsigned(elementType()); result["roleId"] = m_roleId; result["caption"] = m_caption; result["link"] = m_link; result["icon"] = m_icon; return result; } void RoleMenuItem::fromJson(const Common::Json& json) { std::shared_lock locker(m_lock); m_id = json["id"].get<unsigned>(); m_roleId = json["roleId"].get<unsigned>(); m_caption = json["caption"].get<std::string>(); m_link = json["link"].get<std::string>(); m_icon = json["icon"].get<std::string>(); } Element* RoleMenuItem::clone() const { return new RoleMenuItem(*this); } ElementType RoleMenuItem::elementType() const { return ElementType::RoleMenuItem; } unsigned RoleMenuItem::roleId() const { std::shared_lock locker(m_lock); return m_roleId; } void RoleMenuItem::setRoleId(const unsigned value) { std::unique_lock locker(m_lock); m_roleId = value; } std::string RoleMenuItem::caption() const { std::shared_lock locker(m_lock); return m_caption; } void RoleMenuItem::setCaption(const std::string& value) { std::unique_lock locker(m_lock); m_caption = value; } std::string RoleMenuItem::link() const { std::shared_lock locker(m_lock); return m_link; } void RoleMenuItem::setLink(const std::string& value) { std::unique_lock locker(m_lock); m_link = value; } std::string RoleMenuItem::icon() const { std::shared_lock locker(m_lock); return m_icon; } void RoleMenuItem::setIcon(const std::string& value) { std::unique_lock locker(m_lock); m_icon = value; } } // namespace Elements