/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Tools/Libs/ToolsFoundation/Object/DocumentObjectVisitor.h
42 строки
2 KB
Sanakan8472
Convert ezToolsFoundation to use ezStringView instead of const char* (#1071)
30 сен 2023, 17:40
Не верифицирован
30 сен 2023, 17:40
123eb05
Код
Авторство
О чём код?
#pragma once #include <Foundation/Strings/String.h> #include <Foundation/Types/Delegate.h> #include <ToolsFoundation/ToolsFoundationDLL.h> class ezDocumentObjectManager; class ezDocumentObject; /// \brief Implements visitor pattern for content of the document object manager. class EZ_TOOLSFOUNDATION_DLL ezDocumentObjectVisitor { public: /// \brief Constructor /// /// \param pManager /// Manager that will be iterated through. /// \param szChildrenProperty /// Name of the property that is used for finding children on an object. /// \param szRootProperty /// Same as szChildrenProperty, but for the root object of the document. ezDocumentObjectVisitor( const ezDocumentObjectManager* pManager, ezStringView sChildrenProperty = "Children", ezStringView sRootProperty = "Children"); using VisitorFunction = ezDelegate<bool(const ezDocumentObject*)>; /// \brief Executes depth first traversal starting at the given node. /// /// \param pObject /// Object to start traversal at. /// \param bVisitStart /// If true, function will be executed for the start object as well. /// \param function /// Functions executed for each visited object. Should true if the object's children should be traversed. void Visit(const ezDocumentObject* pObject, bool bVisitStart, VisitorFunction function); private: void TraverseChildren(const ezDocumentObject* pObject, ezStringView sProperty, VisitorFunction& function); const ezDocumentObjectManager* m_pManager = nullptr; ezString m_sChildrenProperty; ezString m_sRootProperty; };