You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
700 B
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#include <memory>
#include "ifaces/ILink.h"
/// \brief Интерфейс для классов, поддерживающих связь с дочерними элементами через ILink.
/// \tparam TElem Тип дочернего элемента.
template <class TElem>
class ILinkMixin {
public:
using LinkPtr = std::shared_ptr<ILink<TElem>>;
using ElemPtr = std::shared_ptr<TElem>;
virtual ~ILinkMixin() = default;
virtual operator std::shared_ptr<TElem>() = 0;
virtual void linkChild(const ElemPtr& child) = 0;
virtual void unlinkParent() = 0;
virtual const std::vector<ElemPtr>& children() = 0;
virtual ElemPtr parent() = 0;
virtual LinkPtr getLink() = 0;
};