no updateLinked when parsing

This commit is contained in:
Maarten L. Hekkelman
2026-02-12 08:44:07 +01:00
parent 83a2def09c
commit 25e167cfd3
3 changed files with 14 additions and 11 deletions

View File

@@ -539,7 +539,7 @@ class item
[[nodiscard]] const std::string &name() const { return m_name; } ///< Return the name of the item
[[nodiscard]] const item_value &value() const & { return m_value; } ///< Return the value of the item
item_value &value() & { return m_value; } ///< Return the value of the item
item_value &value() & { return m_value; } ///< Return the value of the item
/// \brief replace the content of the stored value with \a v
void value(item_value v) { m_value = std::move(v); }
@@ -589,7 +589,11 @@ struct item_handle
* @param value The value
* @return reference to this item_handle
*/
item_handle &operator=(item_value value);
item_handle &operator=(item_value value)
{
set(std::move(value), true);
return *this;
}
[[nodiscard]] item_value &value();
[[nodiscard]] const item_value &value() const;
@@ -716,9 +720,10 @@ struct item_handle
row &m_row;
uint16_t m_item_ix;
void assign_value(item_value value);
};
friend class parser;
void set(item_value value, bool updateLinked);
};
struct const_item_handle
{

View File

@@ -50,11 +50,10 @@ const item_value &item_handle::value() const
return m_row.operator[](m_item_ix);
}
item_handle &item_handle::operator=(item_value value)
void item_handle::set(item_value value, bool updateLinked)
{
row_handle rh{ m_category, m_row };
rh.assign(m_item_ix, std::move(value), true);
return *this;
rh.assign(m_item_ix, std::move(value), updateLinked);
}
bool const_item_handle::empty() const

View File

@@ -1044,9 +1044,8 @@ void parser::produce_row()
if (m_category == nullptr)
error("inconsistent categories in loop_");
m_category->emplace({});
m_row = m_category->back();
// m_row.lineNr(m_line_nr);
auto i = m_category->emplace({});
m_row = *i;
}
void parser::produce_item(std::string_view category, std::string_view item, item_value value)
@@ -1070,7 +1069,7 @@ void parser::produce_item(std::string_view category, std::string_view item, item
}
}
m_row[item] = std::move(value);
m_row[item].set(value, false);
}
} // namespace cif