Work on the graphical interface requirements tree
This commit is contained in:
@@ -10,7 +10,8 @@ using namespace core::project;
|
||||
/* Default constructor */
|
||||
RequirementManager::RequirementManager()
|
||||
{
|
||||
m_rootRequirement = make_shared<RequirementItem>(*this); // Create the root requirement item and set it as the root requirement
|
||||
m_rootRequirement = make_shared<RequirementItem>(*this); // Create the root requirement item and set it as the root requirement
|
||||
m_requirementsByUuid[m_rootRequirement->metadata.uuid] = m_rootRequirement; // Register the root requirement item
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
/* Get the root requirement */
|
||||
@@ -28,9 +29,13 @@ std::vector<RequirementManager::RequirementItemPtr> RequirementManager::getRootR
|
||||
/* Get a requirement by its UUID */
|
||||
RequirementManager::RequirementItemPtr RequirementManager::getRequirement(const std::string &uuid) const
|
||||
{
|
||||
if (uuid.empty())
|
||||
return m_rootRequirement; // Return the root requirement item pointer if the UUID is empty
|
||||
|
||||
if (m_requirementsByUuid.contains(uuid))
|
||||
return m_requirementsByUuid.at(uuid); // Return the requirement item pointer if found in the map
|
||||
return {}; // Return nullptr if the requirement with the given UUID is not found
|
||||
|
||||
return {}; // Return nullptr if the requirement with the given UUID is not found
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
/* Get the vector of child requirement items of a requirement by its UUID */
|
||||
|
||||
@@ -14,7 +14,6 @@ RequirementItem::RequirementItem(RequirementManager &manager, const std::shared_
|
||||
m_parent = parentRequirement; // Set the m_parent requirement item
|
||||
|
||||
// Register this requirement item in the manager's internal map
|
||||
m_requirementManager.registerRequirement(shared_from_this());
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
/* Convert this requirement item to an api::requirement::Requirement struct and return it */
|
||||
@@ -52,6 +51,8 @@ void RequirementItem::appendChild(const Requirement &child)
|
||||
{
|
||||
// Create a new requirement item for the child requirement and set this requirement item as its m_parent
|
||||
const auto childItem = make_shared<RequirementItem>(m_requirementManager, shared_from_this());
|
||||
m_requirementManager.registerRequirement(childItem); // Register the child requirement item
|
||||
|
||||
childItem->update(child); // Update the child requirement item with the provided child requirement data
|
||||
|
||||
// Append the child requirement item to the vector of children
|
||||
|
||||
Reference in New Issue
Block a user