本文整理汇总了C++中not_null::absoluteIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ not_null::absoluteIndex方法的具体用法?C++ not_null::absoluteIndex怎么用?C++ not_null::absoluteIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类not_null
的用法示例。
在下文中一共展示了not_null::absoluteIndex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeRow
void PeerListContent::removeRow(not_null<PeerListRow*> row) {
auto index = row->absoluteIndex();
auto isSearchResult = row->isSearchResult();
auto &eraseFrom = isSearchResult ? _searchRows : _rows;
Assert(index >= 0 && index < eraseFrom.size());
Assert(eraseFrom[index].get() == row);
auto pressedData = saveSelectedData(_pressed);
auto contextedData = saveSelectedData(_contexted);
setSelected(Selected());
setPressed(Selected());
setContexted(Selected());
_rowsById.erase(row->id());
auto &byPeer = _rowsByPeer[row->peer()];
byPeer.erase(ranges::remove(byPeer, row), end(byPeer));
removeFromSearchIndex(row);
_filterResults.erase(
ranges::remove(_filterResults, row),
end(_filterResults));
removeRowAtIndex(eraseFrom, index);
restoreSelection();
setPressed(restoreSelectedData(pressedData));
setContexted(restoreSelectedData(contextedData));
}
示例2: convertRowToSearchResult
void PeerListContent::convertRowToSearchResult(not_null<PeerListRow*> row) {
if (row->isSearchResult()) {
return;
} else if (!showingSearch() || !_controller->hasComplexSearch()) {
return removeRow(row);
}
auto index = row->absoluteIndex();
Assert(index >= 0 && index < _rows.size());
Assert(_rows[index].get() == row);
removeFromSearchIndex(row);
row->setIsSearchResult(true);
row->setAbsoluteIndex(_searchRows.size());
_searchRows.push_back(std::move(_rows[index]));
removeRowAtIndex(_rows, index);
}
示例3: prependRowFromSearchResult
void PeerListContent::prependRowFromSearchResult(not_null<PeerListRow*> row) {
if (!row->isSearchResult()) {
return;
}
Assert(_rowsById.find(row->id()) != _rowsById.cend());
auto index = row->absoluteIndex();
Assert(index >= 0 && index < _searchRows.size());
Assert(_searchRows[index].get() == row);
row->setIsSearchResult(false);
_rows.insert(_rows.begin(), std::move(_searchRows[index]));
refreshIndices();
removeRowAtIndex(_searchRows, index);
if (addingToSearchIndex()) {
addToSearchIndex(row);
}
}