void ContentUIElement::SetContent(Ref<IData> content)
{
SetProperty(ContentProperty, _content, content);
if(content.Is<UIElement>()) // dynamic_cast
{
SetContentTemplate(UIElementDataTemplate());
}
else if(content.Is<TextContent>()) // dynamic_cast
{
SetContentTemplate(TextDataTemplate());
}
else
{
InvalidateMeasure();
InvalidateContentPresenter();
}
}
class ChunkIterator
{
private:
TRange& _range;
size_t _size;
TIterator _begin;
TIterator _end;
public:
constexpr ChunkIterator(TRange& range, size_t size, TIterator begin):
_range(range),
_size(size),
_begin(begin),
_end(begin)
{
MoveNext();
}
constexpr auto operator*() const
{
return std::ranges::subrange(_begin, _end);
}
constexpr ChunkIterator& operator++()
{
MoveNext();
return *this;
}
constexpr ChunkIterator operator++(int)
{
ChunkIterator tmp = *this;
++(*this);
return tmp;
}
constexpr bool operator==(const ChunkIterator& other) const
{
return _begin == other._begin && _end == other._end;
}
constexpr bool operator!=(const ChunkIterator& other) const
{
return !(*this == other);
}
void MoveNext()
{
_begin = _end;
std::ranges::advance(_end, _size, _range.end());
}
};
В обзоре ИИ при гугл запросе "sqlite like case insensitive"
void SetCursor(const Cursor& value)
{
SetProperty(CursorProperty, _cursor, value);
}
static inline BindableProperty<UIElement, const Cursor&> CursorProperty =
BindableProperty<UIElement, const Cursor&>(&SetCursor);template<typename TOwner, typename TField, typename TValue>
void SetProperty(BindableProperty<TOwner, TValue>& property, TField& field,
const std::remove_reference_t<TValue>& value)
{
// code
}
template<typename TOwner, typename TField, typename TValue>
void SetProperty(BindableProperty<TOwner, TValue>& property, TField& field, TValue value)
{
// code
}