本文整理汇总了C++中var_table_t::find方法的典型用法代码示例。如果您正苦于以下问题:C++ var_table_t::find方法的具体用法?C++ var_table_t::find怎么用?C++ var_table_t::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类var_table_t
的用法示例。
在下文中一共展示了var_table_t::find方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generate_callbacks
/* Given a variable table, generate callbacks representing the difference between our vars and the new vars */
void env_universal_t::generate_callbacks(const var_table_t &new_vars, callback_data_list_t *callbacks) const
{
assert(callbacks != NULL);
/* Construct callbacks for erased values */
for (var_table_t::const_iterator iter = this->vars.begin(); iter != this->vars.end(); ++iter)
{
const wcstring &key = iter->first;
/* Skip modified values */
if (this->modified.find(key) != this->modified.end())
{
continue;
}
/* If the value is not present in new_vars, it has been erased */
if (new_vars.find(key) == new_vars.end())
{
callbacks->push_back(callback_data_t(ERASE, key, L""));
}
}
/* Construct callbacks for newly inserted or changed values */
for (var_table_t::const_iterator iter = new_vars.begin(); iter != new_vars.end(); ++iter)
{
const wcstring &key = iter->first;
/* Skip modified values */
if (this->modified.find(key) != this->modified.end())
{
continue;
}
/* See if the value has changed */
const var_entry_t &new_entry = iter->second;
var_table_t::const_iterator existing = this->vars.find(key);
if (existing == this->vars.end() || existing->second.exportv != new_entry.exportv || existing->second.val != new_entry.val)
{
/* Value has changed */
callbacks->push_back(callback_data_t(new_entry.exportv ? SET_EXPORT : SET, key, new_entry.val));
}
}
}