本文整理汇总了C++中LinkViewRef::size方法的典型用法代码示例。如果您正苦于以下问题:C++ LinkViewRef::size方法的具体用法?C++ LinkViewRef::size怎么用?C++ LinkViewRef::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinkViewRef
的用法示例。
在下文中一共展示了LinkViewRef::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CaptureHelper
CaptureHelper(std::string const& path, SharedRealm const& r, LinkViewRef lv)
: m_history(make_client_history(path))
, m_sg(*m_history, SharedGroup::durability_MemOnly)
, m_realm(r)
, m_group(m_sg.begin_read())
, m_linkview(lv)
{
m_realm->begin_transaction();
m_initial.reserve(lv->size());
for (size_t i = 0; i < lv->size(); ++i)
m_initial.push_back(lv->get(i).get_int(0));
}
示例2: validate
void validate(CollectionChangeSet const& info)
{
info.insertions.verify();
info.deletions.verify();
info.modifications.verify();
std::vector<size_t> move_sources;
for (auto const& move : info.moves)
move_sources.push_back(m_initial[move.from]);
// Apply the changes from the transaction log to our copy of the
// initial, using UITableView's batching rules (i.e. delete, then
// insert, then update)
auto it = util::make_reverse_iterator(info.deletions.end());
auto end = util::make_reverse_iterator(info.deletions.begin());
for (; it != end; ++it) {
m_initial.erase(m_initial.begin() + it->first, m_initial.begin() + it->second);
}
for (auto const& range : info.insertions) {
for (auto i = range.first; i < range.second; ++i)
m_initial.insert(m_initial.begin() + i, m_linkview->get(i).get_int(0));
}
for (auto const& range : info.modifications) {
for (auto i = range.first; i < range.second; ++i)
m_initial[i] = m_linkview->get(i).get_int(0);
}
REQUIRE(m_linkview->is_attached());
// and make sure we end up with the same end result
REQUIRE(m_initial.size() == m_linkview->size());
for (size_t i = 0; i < m_initial.size(); ++i)
CHECK(m_initial[i] == m_linkview->get(i).get_int(0));
// Verify that everything marked as a move actually is one
for (size_t i = 0; i < move_sources.size(); ++i) {
if (!info.modifications.contains(info.moves[i].to)) {
CHECK(m_linkview->get(info.moves[i].to).get_int(0) == move_sources[i]);
}
}
}
示例3: CollectionNotifier
ListNotifier::ListNotifier(LinkViewRef lv, std::shared_ptr<Realm> realm)
: CollectionNotifier(std::move(realm))
, m_prev_size(lv->size())
{
// Find the lv's column, since that isn't tracked directly
size_t row_ndx = lv->get_origin_row_index();
m_col_ndx = not_found;
auto& table = lv->get_origin_table();
for (size_t i = 0, count = table.get_column_count(); i != count; ++i) {
if (table.get_column_type(i) == type_LinkList && table.get_linklist(i, row_ndx) == lv) {
m_col_ndx = i;
break;
}
}
REALM_ASSERT(m_col_ndx != not_found);
set_table(lv->get_target_table());
auto& sg = Realm::Internal::get_shared_group(*get_realm());
m_lv_handover = sg.export_linkview_for_handover(lv);
}