Commit 92bd52da by Maarten L. Hekkelman

get that code compiling

parent fb56a9cd
...@@ -182,7 +182,7 @@ class category ...@@ -182,7 +182,7 @@ class category
/// @brief Update the links in this category /// @brief Update the links in this category
/// @param db The enclosing @ref datablock /// @param db The enclosing @ref datablock
void update_links(datablock &db); void update_links(const datablock &db);
/// @brief Return the global @ref validator for the data /// @brief Return the global @ref validator for the data
/// @return The @ref validator or nullptr if not assigned /// @return The @ref validator or nullptr if not assigned
......
...@@ -666,7 +666,7 @@ void category::set_validator(const validator *v, datablock &db) ...@@ -666,7 +666,7 @@ void category::set_validator(const validator *v, datablock &db)
update_links(db); update_links(db);
} }
void category::update_links(datablock &db) void category::update_links(const datablock &db)
{ {
m_child_links.clear(); m_child_links.clear();
m_parent_links.clear(); m_parent_links.clear();
...@@ -675,7 +675,7 @@ void category::update_links(datablock &db) ...@@ -675,7 +675,7 @@ void category::update_links(datablock &db)
{ {
for (auto link : m_validator->get_links_for_parent(m_name)) for (auto link : m_validator->get_links_for_parent(m_name))
{ {
auto childCat = db.get(link->m_child_category); auto childCat = const_cast<category *>(db.get(link->m_child_category));
if (childCat == nullptr) if (childCat == nullptr)
continue; continue;
m_child_links.emplace_back(childCat, link); m_child_links.emplace_back(childCat, link);
...@@ -683,7 +683,7 @@ void category::update_links(datablock &db) ...@@ -683,7 +683,7 @@ void category::update_links(datablock &db)
for (auto link : m_validator->get_links_for_child(m_name)) for (auto link : m_validator->get_links_for_child(m_name))
{ {
auto parentCat = db.get(link->m_parent_category); auto parentCat = const_cast<category *>(db.get(link->m_parent_category));
if (parentCat == nullptr) if (parentCat == nullptr)
continue; continue;
m_parent_links.emplace_back(parentCat, link); m_parent_links.emplace_back(parentCat, link);
......
...@@ -109,7 +109,7 @@ bool datablock::validate_links() const ...@@ -109,7 +109,7 @@ bool datablock::validate_links() const
bool result = true; bool result = true;
for (auto &cat : *this) for (auto &cat : *this)
cat.update_links(*this); const_cast<category &>(cat).update_links(*this);
for (auto &cat : *this) for (auto &cat : *this)
result = cat.validate_links() and result; result = cat.validate_links() and result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment