Resolve "Improve GENERATED support"
This commit is contained in:
parent
54e39ccdb3
commit
9277731c4e
13 changed files with 749 additions and 246 deletions
|
|
@ -78,6 +78,36 @@ public:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const T* getByObjectName(const QString &name) const
|
||||
{
|
||||
auto find_res = std::find_if(m_container.begin(), m_container.end(),
|
||||
[&name](const T& item)
|
||||
{
|
||||
return item.objectName() == name;
|
||||
});
|
||||
|
||||
if (find_res != m_container.end())
|
||||
return &*find_res;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const T* getByObjectNsAndName(const QString &ns, const QString &name) const
|
||||
{
|
||||
auto find_res = std::find_if(m_container.begin(), m_container.end(),
|
||||
[&ns, &name](const T& item)
|
||||
{
|
||||
// check name first as it is less likely to pass
|
||||
return item.objectName() == name
|
||||
&& item.nsName() == ns;
|
||||
});
|
||||
|
||||
if (find_res != m_container.end())
|
||||
return &*find_res;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/// Retrieve element by index
|
||||
///
|
||||
/// This function throws when idx is out of range
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue