13 #if defined __LINUX || __WINCMAKE 14 inline static QStringView nullName() {
return u
"None"; }
16 inline static QStringView nullName() {
return L
"None"; }
18 static constexpr uint null_ = 0xFFFFFFFF;
21 virtual const IThing *
getIThing()
const=0;
22 virtual QString
getName()
const=0;
31 static constexpr uint any_ = 0xFFFFFFFF;
32 static constexpr uint invalid_ = 0xFFFFFFFE;
33 static constexpr uint unresolved_ = 0xFFFFFFFD;
34 #if defined __LINUX || __WINCMAKE 35 inline static QStringView anyName() {
return u
"Any"; }
36 inline static QStringView defaultName() {
return u
"Default"; }
37 inline static QStringView invalidName() {
return u
"Invalid"; }
39 inline static QStringView anyName() {
return L
"Any"; }
40 inline static QStringView defaultName() {
return L
"Default"; }
41 inline static QStringView invalidName() {
return L
"Invalid"; }
45 virtual const IThing *
getIThing()
const=0;
46 virtual QString getName()
const=0;
48 virtual quint32 getIndex()
const = 0;
53 static constexpr uint any_ = ISlot::any_;
54 static constexpr uint unresolved_ = ISlot::unresolved_;
55 static constexpr uint invalid_ = ISlot::invalid_;
56 inline static QStringView anyName() {
return ISlot::anyName(); }
57 inline static QStringView defaultName() {
return ISlot::defaultName(); }
58 inline static QStringView invalidName() {
return ISlot::invalidName(); }
60 inline ISlotID(
const ISlot *slot) : slot_(slot), slotIndex_(slot ? ISlot::unresolved_ : ISlot::invalid_) { }
61 inline ISlotID(uint slot=any_) : slotIndex_(slot) { }
62 inline ISlotID(
const QString &name) : slotIndex_(name.length() ? ISlot::unresolved_ : ISlot::any_), slotName_(name) { }
63 inline ISlotID(
const ISlotID &
id) : slot_(
id.slot_), slotIndex_(
id.slotIndex_), slotName_(
id.slotName_), thread_(
id.thread_) {}
64 inline ISlotID(
ISlotID &&
id) noexcept : slot_(
id.slot_), slotIndex_(
id.slotIndex_), slotName_(std::move(
id.slotName_)), thread_(
id.thread_) {}
65 inline const ISlotID &operator=(
const ISlotID &
id) { slot_ =
id.slot_; slotIndex_ =
id.slotIndex_; slotName_ =
id.slotName_; thread_ =
id.thread_;
return *
this; }
66 inline const ISlotID &operator=(
ISlotID &&
id) noexcept { slot_ =
id.slot_; slotIndex_ =
id.slotIndex_; slotName_ = std::move(
id.slotName_); thread_ =
id.thread_;
return *
this; }
67 inline bool anySlot()
const {
return slot_ ? slot_->getIndex()==any_ : (slotIndex_!=unresolved_ ? slotIndex_==ISlot::any_ : slotName_.compare(anyName(), Qt::CaseInsensitive)==0 ); }
68 inline bool unresolvedSlot()
const {
return slot_==
nullptr && (slotIndex_!=unresolved_ || slotName_.length()); }
69 inline bool invalidSlot()
const {
return slotIndex_ == invalid_; }
70 inline bool hasSlot()
const {
return slot_ || slotIndex_!=unresolved_ || slotName_.length(); }
71 inline void setSlot(uint slot) { slot_ =
nullptr; slotIndex_ = slot; slotName_ = QString(); }
72 inline void setSlot(
const QString &name) { slot_ =
nullptr; slotName_ = name; slotIndex_ = name.length() ? unresolved_ : any_; }
73 inline void setSlot(
const ISlot *slot) { slot_ = slot; slotName_ = QString(); slotIndex_ = slot ? unresolved_ : invalid_; }
74 inline void setSlot(
const ISlotID &
id) { operator=(
id); }
75 inline void setAny() { slot_ =
nullptr; slotIndex_ = any_; slotName_ = QString(); }
76 inline const ISlot * slot()
const {
return slot_; }
77 inline uint slotIndex()
const {
return slot_ ? slot_->getIndex() : slotIndex_; }
78 inline QString slotName()
const {
return slot_ ? slot_->getName() : slotName_; }
79 inline const QString &givenSlotName()
const {
return slotName_; }
80 inline bool operator <(
const ISlotID &slot)
const {
return slotIndex()<slot.slotIndex(); }
81 inline quint32 thread()
const {
return thread_; }
82 inline void thread(quint32 t) { thread_ = t; }
85 const ISlot *slot_ =
nullptr;
86 quint32 slotIndex_ = ISlot::unresolved_;
93 inline static QStringView nullName() {
return IGroup::nullName(); }
98 inline IGroupID(
const QString &groupName) : groupName_(groupName) {}
100 inline IGroupID(
const QString &groupName,
const QString &slotName) :
ISlotID(slotName), group_(
nullptr), groupName_(groupName) { }
101 inline IGroupID(
const QString &groupName,quint32 slot) :
ISlotID(slot), groupName_(groupName) { }
103 inline IGroupID(
IGroupID &&
id) noexcept :
ISlotID(std::move(
id)), group_(
id.group_), groupName_(std::move(
id.groupName_)) {}
106 inline const IGroupID &operator=(
const IGroupID &
id) { ISlotID::operator=(
id); group_ =
id.group_; groupName_ =
id.groupName_;
return *
this; }
107 inline const IGroupID &operator=(
IGroupID &&
id) noexcept { ISlotID::operator=(std::move(
id)); group_ =
id.group_; groupName_ = std::move(
id.groupName_);
return *
this; }
108 inline bool hasGroup()
const {
if (group_ || groupName_.length())
return true;
return false; }
109 inline bool unresolvedGroup()
const {
return !group_ && groupName_.length(); }
110 inline bool unresolved()
const {
return unresolvedGroup() || unresolvedSlot(); }
111 inline void setGroup(
const IGroup *group) { group_ = group; groupName_ = QString(); }
112 inline void setGroup(
const QString &name) { groupName_ = name; group_ =
nullptr; }
113 inline const IGroup * group()
const {
return group_; }
114 inline QString groupName()
const {
return group_ ? group_->
getName() : groupName_; }
115 inline const QString &givenGroupName()
const {
return groupName_; }
116 inline bool operator <(
const IGroupID &group)
const {
if (slotIndex()!=group.slotIndex())
return slotIndex()<group.slotIndex();
return groupName().compare(group.groupName(),Qt::CaseInsensitive)<0; }
118 const IGroup *group_ =
nullptr;
Interface to a group object.
Definition: igroup.h:9
namespace Itasca
Definition: basememory.cpp:9
static constexpr TType type_
The type identification number for this class, for use in convert_cast() and convert_getcast().
Definition: igroup.h:30
Interface to a slot object.
Definition: igroup.h:27
virtual IThing * getIThing()=0
Return IThing interface associated with this group.
virtual IThing * getIThing()=0
Return IThing interface associated with this group.
unsigned int TType
class type indicator
Definition: basedef.h:41
static constexpr TType type_
The type identification number for this class, for use in convert_cast() and convert_getcast().
Definition: igroup.h:12
virtual QString getName() const =0
Return the group name.
All default base headers if Qt is being used.