3#include <AUI/Common/AException.h>
14 using AException::AException;
25 mUserdata(std::move(userdata)) {}
35 return std::any_cast<T>(mUserdata);
37 throw Exception(
"ATreeModelIndex::as any_cast failed (asked for {}, actually stored {})"_format(
38 typeid(T).name(), mUserdata.type().name()));
43 bool hasValue() const noexcept {
44 return mUserdata.has_value();
51 std::size_t
row()
const {
68 static constexpr struct {}
ROOT {};
105 return !std::holds_alternative<ATreeModelIndex>(lhs);
109 return std::holds_alternative<ATreeModelIndex>(lhs);
116inline const ATreeModelIndex& operator*(
const ATreeModelIndexOrRoot& v) {
117 if (
auto i = std::get_if<ATreeModelIndex>(&v)) {
Abstract AUI exception.
Definition: AException.h:29
Definition: ATreeModelIndex.h:12
Valid index of ITreeModel.
Definition: ATreeModelIndex.h:10
ATreeModelIndex(std::size_t row, std::size_t column, std::any userdata) noexcept
Definition: ATreeModelIndex.h:22
static constexpr struct ATreeModelIndex::@2 ROOT
Tag type to define root vertex.
std::size_t row() const
row of the vertex relative to it's parent.
Definition: ATreeModelIndex.h:51
T as() const
any_cast the external user data stored in this vertex.
Definition: ATreeModelIndex.h:33
std::size_t column() const
column of the vertex relative to it's parent.
Definition: ATreeModelIndex.h:59