64             return m_parentPtr.lock();
 
   72         const std::list<std::shared_ptr<T>>& 
Children()
 
   84         std::shared_ptr<T> 
Child(
size_t index)
 
   86             if (m_children.size() <= index) {
 
   89             auto iter = std::next(m_children.begin(), index);
 
  101             auto iter = m_children.begin();
 
  103             while (iter != m_children.end()) {
 
  104                 if (*iter == childPtr) {
 
  118             std::shared_ptr<T> parentPtr = 
Parent();
 
  119             if (parentPtr != 
nullptr)
 
  121                 parentPtr->RemoveChild(std::enable_shared_from_this<T>::shared_from_this());
 
  133             if (objPtr == 
nullptr)
 
  138             std::shared_ptr<T> parentPtr = 
Parent();
 
  139             while (parentPtr != 
nullptr) {
 
  140                 if (objPtr == parentPtr)
 
  144                 parentPtr = parentPtr->Parent();
 
  194             for (
auto childPtr : m_children)
 
  196                 if (callback(childPtr))
 
  198                     childPtr->ForEachDescendant(callback);
 
  210             if (callback(std::enable_shared_from_this<T>::shared_from_this()))
 
  220         template <
typename A>
 
  241                 if (m_current != 
nullptr) {
 
  242                     m_current = m_current->Parent();
 
  244                 return (m_current!= 
nullptr);
 
  254                 return m_current == other.m_current;
 
  264                 return m_current != other.m_current;
 
  304         template <
typename D>
 
  325                 if (m_current != 
nullptr) {
 
  326                     if (m_current->Children().size() > 0)
 
  328                         typename std::list<D>::const_iterator iter = m_current->Children().cbegin();
 
  329                         m_stack.push(std::make_pair(m_current, iter));
 
  330                         m_current = *(m_stack.top().second);
 
  331                         return m_current != 
nullptr;
 
  334                         while (m_stack.size() > 0) {
 
  335                             m_stack.top().second++;
 
  336                             if (m_stack.top().second != m_stack.top().first->Children().cend())
 
  338                                 m_current = *(m_stack.top().second);
 
  339                                 return m_current != 
nullptr;
 
  348                 return m_current != 
nullptr;
 
  358                 return m_current == other.m_current && m_stack == other.m_stack;
 
  368                 return m_current != other.m_current || m_stack != other.m_stack;
 
  381             std::stack<std::pair<D, typename std::list<D>::const_iterator>> m_stack;
 
  407         std::weak_ptr<T> m_parentPtr;
 
  408         std::list<std::shared_ptr<T>> m_children;
 
  417         virtual bool MoveChild(std::shared_ptr<T> childPtr, 
int newIndex)
 
  419             if (childPtr == 
nullptr)
 
  421                 throw std::invalid_argument(
"Argument null exception");
 
  424             auto iter = std::find(m_children.begin(), m_children.end(), childPtr);
 
  425             if (iter != m_children.end())
 
  427                 m_children.remove(childPtr);
 
  428                 m_children.insert(std::next(m_children.begin(), newIndex), childPtr);
 
  447             if (childPtr == 
nullptr)
 
  449                 throw std::invalid_argument(
"Argument null exception");
 
  452             if (childPtr->m_parentPtr.lock() == std::enable_shared_from_this<T>::shared_from_this() ||
 
  453                 childPtr == std::enable_shared_from_this<T>::shared_from_this() ||
 
  459             childPtr->PerformDetach();
 
  460             childPtr->m_parentPtr = std::enable_shared_from_this<T>::shared_from_this();
 
  461             m_children.push_back(childPtr);
 
  479             if (childPtr == 
nullptr)
 
  481                 throw std::invalid_argument(
"Argument null exception");
 
  484             if (index > (
int)m_children.size() || index < 0 ||
 
  485                 childPtr->m_parentPtr.lock() == std::enable_shared_from_this<T>::shared_from_this() ||
 
  486                 childPtr == std::enable_shared_from_this<T>::shared_from_this() ||
 
  492             childPtr->PerformDetach();
 
  493             childPtr->m_parentPtr = std::enable_shared_from_this<T>::shared_from_this();
 
  494             auto iter = std::next(m_children.begin(), index);
 
  495             m_children.insert(iter, childPtr);
 
  510             if (childPtr == 
nullptr)
 
  512                 throw std::invalid_argument(
"Argument null exception");
 
  515             auto iter = std::find(m_children.begin(), m_children.end(), childPtr);
 
  516             if (iter != m_children.end()) 
 
  518                 m_children.remove(childPtr);
 
  519                 childPtr->m_parentPtr.reset();
 
  532             std::shared_ptr<T> parentPtr = 
Parent();
 
  533             if (parentPtr != 
nullptr)
 
  535                 std::static_pointer_cast<ksHierarchyObject<T>>(parentPtr)->
 
Definition: ksHierarchyObject.h:222
 
AncestorIter(A obj)
Definition: ksHierarchyObject.h:229
 
bool operator==(const AncestorIter< A > &other) const
Definition: ksHierarchyObject.h:252
 
bool Next()
Definition: ksHierarchyObject.h:239
 
A Value()
Definition: ksHierarchyObject.h:272
 
bool operator!=(const AncestorIter< A > &other) const
Definition: ksHierarchyObject.h:262
 
Definition: ksHierarchyObject.h:306
 
DescendantIter(D obj)
Definition: ksHierarchyObject.h:313
 
D Value()
Definition: ksHierarchyObject.h:376
 
bool operator!=(const DescendantIter< D > &other) const
Definition: ksHierarchyObject.h:366
 
bool Next()
Definition: ksHierarchyObject.h:323
 
bool operator==(const DescendantIter< D > &other) const
Definition: ksHierarchyObject.h:356
 
Definition: ksHierarchyObject.h:33
 
AncestorIter< std::shared_ptr< T > > Ancestors()
Definition: ksHierarchyObject.h:295
 
ksHierarchyObject()
Definition: ksHierarchyObject.h:46
 
virtual ~ksHierarchyObject()
Definition: ksHierarchyObject.h:53
 
virtual bool PerformAddChild(std::shared_ptr< T > childPtr)
Definition: ksHierarchyObject.h:445
 
virtual bool PerformRemoveChild(std::shared_ptr< T > childPtr)
Definition: ksHierarchyObject.h:508
 
bool IsDescendantOf(std::shared_ptr< T > objPtr)
Definition: ksHierarchyObject.h:131
 
const std::list< std::shared_ptr< T > > & Children()
Definition: ksHierarchyObject.h:72
 
void PerformDetach()
Definition: ksHierarchyObject.h:530
 
virtual bool MoveChild(std::shared_ptr< T > childPtr, int newIndex)
Definition: ksHierarchyObject.h:417
 
virtual bool RemoveChild(std::shared_ptr< T > childPtr)
Definition: ksHierarchyObject.h:182
 
int IndexOfChild(std::shared_ptr< T > childPtr)
Definition: ksHierarchyObject.h:99
 
DescendantIter< std::shared_ptr< T > > SelfAndDescendants()
Definition: ksHierarchyObject.h:390
 
void Detach()
Definition: ksHierarchyObject.h:116
 
void ForEachDescendant(ForEachCallback callback)
Definition: ksHierarchyObject.h:192
 
virtual bool PerformInsertChild(int index, std::shared_ptr< T > childPtr)
Definition: ksHierarchyObject.h:477
 
virtual bool AddChild(std::shared_ptr< T > childPtr)
Definition: ksHierarchyObject.h:157
 
void ForSelfAndDescendants(ForEachCallback callback)
Definition: ksHierarchyObject.h:208
 
virtual bool InsertChild(int index, std::shared_ptr< T > childPtr)
Definition: ksHierarchyObject.h:171
 
std::function< bool(std::shared_ptr< T >)> ForEachCallback
Definition: ksHierarchyObject.h:41
 
std::shared_ptr< T > Parent()
Definition: ksHierarchyObject.h:62
 
DescendantIter< std::shared_ptr< T > > Descendants()
Definition: ksHierarchyObject.h:400
 
std::shared_ptr< T > Child(size_t index)
Definition: ksHierarchyObject.h:84
 
AncestorIter< std::shared_ptr< T > > SelfAndAncestors()
Definition: ksHierarchyObject.h:285
 
Definition: sfDictionaryProperty.h:24