本文整理汇总了C++中pfc::list_base_t类的典型用法代码示例。如果您正苦于以下问题:C++ list_base_t类的具体用法?C++ list_base_t怎么用?C++ list_base_t使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了list_base_t类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sort_by_relative_path_partial
void metadb_handle_list_helper::sort_by_relative_path_partial(pfc::list_base_t<metadb_handle_ptr> & p_list,t_size base,t_size count)
{
assert(base+count<=p_list.get_count());
pfc::array_t<t_size> order; order.set_size(count);
sort_by_relative_path_get_order_partial(p_list,base,count,order.get_ptr());
p_list.reorder_partial(base,order.get_ptr(),count);
}
示例2: remove_duplicates
void metadb_handle_list_helper::remove_duplicates(pfc::list_base_t<metadb_handle_ptr> & p_list)
{
t_size count = p_list.get_count();
if (count>0)
{
bit_array_bittable mask(count);
pfc::array_t<t_size> order; order.set_size(count);
order_helper::g_fill(order);
p_list.sort_get_permutation_t(pfc::compare_t<metadb_handle_ptr,metadb_handle_ptr>,order.get_ptr());
t_size n;
bool found = false;
for(n=0;n<count-1;n++)
{
if (p_list.get_item(order[n])==p_list.get_item(order[n+1]))
{
found = true;
mask.set(order[n+1],true);
}
}
if (found) p_list.remove_mask(mask);
}
}
示例3: g_filter_dead_files_sorted
t_size file_move_helper::g_filter_dead_files_sorted(pfc::list_base_t<metadb_handle_ptr> & p_data,const pfc::list_base_const_t<const char*> & p_dead)
{
bit_array_bittable mask(p_data.get_count());
t_size found = g_filter_dead_files_sorted_make_mask(p_data,p_dead,mask);
if (found > 0) p_data.remove_mask(mask);
return found;
}
示例4: g_get_root_items
static void g_get_root_items(pfc::list_base_t<mainmenu_root_group> & p_out)
{
p_out.remove_all();
mnemonic_manager mnemonics;
service_enum_t<mainmenu_group> e;
service_ptr_t<mainmenu_group> ptr;
service_ptr_t<mainmenu_group_popup> ptrp;
while(e.next(ptr))
{
if (ptr->get_parent() == pfc::guid_null)
{
if (ptr->service_query_t(ptrp))
{
mainmenu_root_group item;
pfc::string8 name;
ptrp->get_display_string(name);
item.m_guid = ptrp->get_guid();
item.m_sort_priority = ptrp->get_sort_priority();
uFixAmpersandChars_v2(name, item.m_name);
name.reset();
mnemonics.process_string(item.m_name, name);
pfc::stringcvt::string_os_from_utf8 os(name);
item.m_name_with_accelerators.append_fromptr(os.get_ptr(), os.length());
item.m_name_with_accelerators.append_single(0);
p_out.add_item(item);
}
}
}
p_out.sort_t(g_compare);
}
示例5: filterTracksByCloseTitle
void filterTracksByCloseTitle(const std::string& title, pfc::list_base_t<metadb_handle_ptr>& tracks)
{
const t_size n = tracks.get_count();
bit_array_bittable deleteMask(n);
for(t_size i = 0; i < n; i++)
{
deleteMask.set(i, !doesTrackHaveSimilarTitle(title, tracks[i]));
}
tracks.remove_mask(deleteMask);
}
示例6: filterTracksByArtist
void filterTracksByArtist(const std::string& artist, pfc::list_base_t<metadb_handle_ptr>& tracks)
{
const t_size n = tracks.get_count();
bit_array_bittable deleteMask(n);
for(t_size i = 0; i < n; i++)
{
deleteMask.set(i, !isTrackByArtist(artist, tracks[i]));
}
tracks.remove_mask(deleteMask);
}
示例7: g_filter_dead_files_sorted_make_mask
t_size file_move_helper::g_filter_dead_files_sorted_make_mask(pfc::list_base_t<metadb_handle_ptr> & p_data,const pfc::list_base_const_t<const char*> & p_dead,bit_array_var & p_mask)
{
t_size n, m = p_data.get_count();
t_size found = 0;
for(n=0;n<m;n++)
{
t_size dummy;
bool dead = p_dead.bsearch_t(metadb::path_compare,p_data.get_item(n)->get_path(),dummy);
if (dead) found++;
p_mask.set(n,dead);
}
return found;
}
示例8: is_point_ours
bool splitter_window_impl::is_point_ours(HWND wnd_point, const POINT & pt_screen, pfc::list_base_t<uie::window::ptr> & p_hierarchy)
{
if (wnd_point == get_wnd() || IsChild(get_wnd(), wnd_point))
{
if (wnd_point == get_wnd())
{
p_hierarchy.add_item(this);
return true;
}
else
{
t_size i, count = m_panels.get_count();
for (i = 0; i<count; i++)
{
uie::splitter_window_v2_ptr sptr;
if (m_panels[i]->m_child.is_valid())
{
if (m_panels[i]->m_child->service_query_t(sptr))
{
pfc::list_t<uie::window::ptr> temp;
temp.add_item(this);
if (sptr->is_point_ours(wnd_point, pt_screen, temp))
{
p_hierarchy.add_items(temp);
return true;
}
}
else if (wnd_point == m_panels[i]->m_wnd_child || IsChild(m_panels[i]->m_wnd_child, wnd_point))
{
p_hierarchy.add_item(this);
p_hierarchy.add_item(m_panels[i]->m_child);
return true;
}
else if (wnd_point == m_panels[i]->m_wnd)
{
p_hierarchy.add_item(this);
return true;
}
}
}
}
}
return false;
};
示例9: g_find_inputs_by_content_type
bool input_entry::g_find_inputs_by_content_type(pfc::list_base_t<service_ptr_t<input_entry> > & p_out, const char * p_content_type, bool p_from_redirect) {
service_enum_t<input_entry> e;
service_ptr_t<input_entry> ptr;
bool ret = false;
while (e.next(ptr)) {
if (!(p_from_redirect && ptr->is_redirect())) {
if (ptr->is_our_content_type(p_content_type)) { p_out.add_item(ptr); ret = true; }
}
}
return ret;
}
示例10: g_find_inputs_by_path
bool input_entry::g_find_inputs_by_path(pfc::list_base_t<service_ptr_t<input_entry> > & p_out, const char * p_path, bool p_from_redirect) {
service_enum_t<input_entry> e;
service_ptr_t<input_entry> ptr;
auto extension = pfc::string_extension(p_path);
bool ret = false;
while (e.next(ptr)) {
if (!(p_from_redirect && ptr->is_redirect())) {
if (ptr->is_our_path(p_path, extension)) { p_out.add_item(ptr); ret = true; }
}
}
return ret;
}
示例11:
void splitter_window_impl::splitter_host_impl::get_children(pfc::list_base_t<uie::window::ptr> & p_out)
{
if (m_this.is_valid())
{
t_size i, count = m_this->m_panels.get_count();
for (i = 0; i < count; i++)
{
if (m_this->m_panels[i]->m_child.is_valid())
p_out.add_item(m_this->m_panels[i]->m_child);
}
}
}
示例12: sort_by_pointer_remove_duplicates
void metadb_handle_list_helper::sort_by_pointer_remove_duplicates(pfc::list_base_t<metadb_handle_ptr> & p_list)
{
t_size count = p_list.get_count();
if (count>0)
{
sort_by_pointer(p_list);
bool b_found = false;
t_size n;
for(n=0;n<count-1;n++)
{
if (p_list.get_item(n)==p_list.get_item(n+1))
{
b_found = true;
break;
}
}
if (b_found)
{
bit_array_bittable mask(count);
t_size n;
for(n=0;n<count-1;n++)
{
if (p_list.get_item(n)==p_list.get_item(n+1))
mask.set(n+1,true);
}
p_list.remove_mask(mask);
}
}
}
示例13: grab_items_by_path
static bool grab_items_by_path(pfc::list_base_t<metadb_handle_ptr> & p_out,const char * p_path,abort_callback & p_abort)
{
try {
pfc::string8 path;
filesystem::g_get_canonical_path(p_path,path);
p_out.remove_all();
service_ptr_t<input_info_reader> reader;
input_entry::g_open_for_info_read(reader,0,path,p_abort);
static_api_ptr_t<metadb> l_metadb;
const t_uint32 count = reader->get_subsong_count();
for(t_uint32 n=0;n<count;n++) {
p_abort.check_e();
metadb_handle_ptr ptr;
l_metadb->handle_create(ptr,make_playable_location(path,reader->get_subsong(n)));
p_out.add_item(ptr);
}
return p_out.get_count() > 0;
} catch(std::exception const &) {return false;}
}
示例14: getBestTrackByTitle
// all tracks will be analysed; try to cut the size of the list down before calling.
metadb_handle_ptr getBestTrackByTitle(const std::string& title, const pfc::list_base_t<metadb_handle_ptr>& tracks)
{
if(tracks.get_count() == 1)
{
console::info(("Only one version of " + title + " exists in library").c_str());
return tracks[0];
}
console::info(("Finding best version of " + title + ". " + to_string(tracks.get_count()) + " candidates").c_str());
metadb_handle_ptr bestTrack = 0;
float bestTrackRating = std::numeric_limits<float>::min();
for(t_size index = 0; index < tracks.get_count(); index++)
{
const float trackRating = calculateTrackRating(title, tracks[index]);
console::info(("Rating: " + to_string(trackRating, 2) + ": " + tracks[index]->get_path()).c_str());
if(trackRating >= 0.0f && trackRating > bestTrackRating)
{
bestTrackRating = trackRating;
bestTrack = tracks[index];
}
}
if(bestTrack == 0)
{
console::info(("Couldn't find a match for " + title).c_str());
}
else
{
console::info(("Picked track with rating: " + to_string(bestTrackRating, 2) + ": " + bestTrack->get_path()).c_str());
}
return bestTrack;
}
示例15: make_new_item_list
void file_move_helper::make_new_item_list(pfc::list_base_t<metadb_handle_ptr> & p_out,const char * p_new_path,file_move_callback_manager & p_cb)
{
pfc::string8 new_path;
filesystem::g_get_canonical_path(p_new_path,new_path);
t_size n; const t_size m = m_data.get_size();
static_api_ptr_t<metadb> api;
pfc::array_t<metadb_handle_ptr> hint_handles;
pfc::array_t<const file_info*> hint_infos;
pfc::array_t<t_filestats> hint_stats;
hint_handles.set_size(m); hint_infos.set_size(m); hint_stats.set_size(m);
t_size hintptr = 0;
for(n=0;n<m;n++)
{
metadb_handle_ptr temp;
api->handle_create(temp,make_playable_location(new_path,m_data[n].m_location.get_subsong()));
if (m_data[n].m_have_info)
{
hint_handles[hintptr] = temp;
hint_infos[hintptr] = &m_data[n].m_info;
hint_stats[hintptr] = m_data[n].m_stats;
hintptr++;
}
p_out.add_item(temp);
}
if (hintptr > 0)
{
p_cb.on_hint(
pfc::list_const_array_t<metadb_handle_ptr,const pfc::array_t<metadb_handle_ptr> &>(hint_handles,hintptr),
pfc::list_const_array_t<const file_info *,const pfc::array_t<const file_info *> &>(hint_infos,hintptr),
pfc::list_const_array_t<t_filestats,const pfc::array_t<t_filestats> &>(hint_stats,hintptr)
);
/*
static_api_ptr_t<metadb_io>()->hint_multi(
list_const_array_t<metadb_handle_ptr,const array_t<metadb_handle_ptr> &>(hint_handles,hintptr),
list_const_array_t<const file_info *,const array_t<const file_info *> &>(hint_infos,hintptr),
list_const_array_t<t_filestats,const array_t<t_filestats> &>(hint_stats,hintptr),
bit_array_false());*/
}
}