本文整理汇总了C++中metadb_handle_list_cref类的典型用法代码示例。如果您正苦于以下问题:C++ metadb_handle_list_cref类的具体用法?C++ metadb_handle_list_cref怎么用?C++ metadb_handle_list_cref使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了metadb_handle_list_cref类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: sort_by_relative_path_get_order
void metadb_handle_list_helper::sort_by_relative_path_get_order(metadb_handle_list_cref p_list,t_size* order)
{
const t_size count = p_list.get_count();
t_size n;
pfc::array_t<custom_sort_data> data;
data.set_size(count);
static_api_ptr_t<library_manager> api;
pfc::string8_fastalloc temp;
temp.prealloc(512);
for(n=0;n<count;n++)
{
metadb_handle_ptr item;
p_list.get_item_ex(item,n);
if (!api->get_relative_path(item,temp)) temp = "";
data[n].index = n;
data[n].text = makeSortString(temp);
//data[n].subsong = item->get_subsong_index();
}
pfc::sort_t(data,custom_sort_compare<1>,count);
//qsort(data.get_ptr(),count,sizeof(custom_sort_data),(int (__cdecl *)(const void *elem1, const void *elem2 ))custom_sort_compare);
for(n=0;n<count;n++)
{
order[n]=data[n].index;
delete[] data[n].text;
}
}
开发者ID:exscape,项目名称:foo_simpleserver,代码行数:29,代码来源:metadb_handle_list.cpp
示例2: context_command
virtual void context_command(unsigned int p_index, metadb_handle_list_cref p_data, const GUID& p_caller)
{
if(p_index == 0 && p_data.get_count() == 1)
AlsongLyricLinkDialog::OpenLyricLinkDialog(core_api::get_main_window(), p_data.get_item(0));
else if(p_index == 1 && p_data.get_count() == 1)
LyricSyncDialog::Open(p_data.get_item(0), core_api::get_main_window());
}
开发者ID:andinue,项目名称:foo_alsong_lyric,代码行数:7,代码来源:MenuItem.cpp
示例3: context_command
virtual void
context_command(
unsigned int index,
metadb_handle_list_cref tracks,
const GUID& /*caller*/
)
{
switch(index)
{
case Items::GetArtistTopTracks:
{
generateArtistPlaylist(tracks);
break;
}
case Items::GetSimilarTracks:
{
if(tracks.get_count() > 0)
{
generateSimilarTracksPlaylist(tracks.get_item(0));
}
break;
}
default:
{
uBugCheck();
}
}
}
开发者ID:hymerman,项目名称:foo_bestversion,代码行数:30,代码来源:ContextMenu.cpp
示例4: calc_total_duration
double metadb_handle_list_helper::calc_total_duration(metadb_handle_list_cref p_list)
{
double ret = 0;
t_size n, m = p_list.get_count();
for(n=0;n<m;n++)
{
double temp = p_list.get_item(n)->get_length();
if (temp > 0) ret += temp;
}
return ret;
}
开发者ID:exscape,项目名称:foo_simpleserver,代码行数:11,代码来源:metadb_handle_list.cpp
示例5: playlist_update_content
bool playlist_manager::playlist_update_content(t_size playlist, metadb_handle_list_cref content, bool bUndoBackup) {
metadb_handle_list old;
playlist_get_all_items(playlist, old);
if (old.get_size() == 0) {
if (content.get_size() == 0) return false;
if (bUndoBackup) playlist_undo_backup(playlist);
playlist_add_items(playlist, content, bit_array_false());
return true;
}
pfc::avltree_t<metadb_handle::nnptr> itemsOld, itemsNew;
for(t_size walk = 0; walk < old.get_size(); ++walk) itemsOld += old[walk];
for(t_size walk = 0; walk < content.get_size(); ++walk) itemsNew += content[walk];
bit_array_bittable removeMask(old.get_size());
bit_array_bittable filterMask(content.get_size());
bool gotNew = false, filterNew = false, gotRemove = false;
for(t_size walk = 0; walk < content.get_size(); ++walk) {
const bool state = !itemsOld.have_item(content[walk]);
if (state) gotNew = true;
else filterNew = true;
filterMask.set(walk, state);
}
for(t_size walk = 0; walk < old.get_size(); ++walk) {
const bool state = !itemsNew.have_item(old[walk]);
if (state) gotRemove = true;
removeMask.set(walk, state);
}
if (!gotNew && !gotRemove) return false;
if (bUndoBackup) playlist_undo_backup(playlist);
if (gotRemove) {
playlist_remove_items(playlist, removeMask);
}
if (gotNew) {
if (filterNew) {
metadb_handle_list temp(content);
temp.filter_mask(filterMask);
playlist_add_items(playlist, temp, bit_array_false());
} else {
playlist_add_items(playlist, content, bit_array_false());
}
}
{
playlist_get_all_items(playlist, old);
pfc::array_t<t_size> order;
if (pfc::guess_reorder_pattern<pfc::list_base_const_t<metadb_handle_ptr> >(order, old, content)) {
playlist_reorder_items(playlist, order.get_ptr(), order.get_size());
}
}
return true;
}
开发者ID:Irwin1138,项目名称:foo_bestversion,代码行数:51,代码来源:playlist.cpp
示例6: context_get_display
virtual bool context_get_display(unsigned int p_index, metadb_handle_list_cref p_data, pfc::string_base & p_out, unsigned & p_displayflags, const GUID & p_caller)
{
if(p_index == 0)
{
p_out = EncodingFunc::ToUTF8(TEXT("알송 가사 추가/변경")).c_str();
return p_data.get_count() == 1;
}
else if(p_index == 1)
{
p_out = EncodingFunc::ToUTF8(TEXT("가사 싱크 수정")).c_str();
return p_data.get_count() == 1;
}
return false;
}
开发者ID:andinue,项目名称:foo_alsong_lyric,代码行数:14,代码来源:MenuItem.cpp
示例7: context_get_display
virtual bool
context_get_display(
unsigned int index,
metadb_handle_list_cref tracks,
pfc::string_base& out,
unsigned int& /*displayflags*/,
const GUID& /*caller*/
)
{
switch(index)
{
case Items::ReplaceWithBestVersion:
{
out = "Replace with best version of track";
if(tracks.get_count() > 1)
{
out.add_string("s");
}
return true;
}
default:
{
// Nothing wants to customise the display of the item; let the regular name be displayed.
get_item_name(index, out);
return true;
}
}
}
开发者ID:hymerman,项目名称:foo_bestversion,代码行数:31,代码来源:ContextMenu.cpp
示例8: sort_by_format_get_order
void metadb_handle_list_helper::sort_by_format_get_order(metadb_handle_list_cref p_list,t_size* order,const service_ptr_t<titleformat_object> & p_script,titleformat_hook * p_hook,int p_direction)
{
// pfc::hires_timer timer; timer.start();
const t_size count = p_list.get_count();
pfc::array_t<custom_sort_data> data; data.set_size(count);
{
pfc::counter counter(0);
pfc::array_t<pfc::rcptr_t<tfthread> > threads; threads.set_size(pfc::getOptimalWorkerThreadCountEx(p_list.get_count() / 128));
PFC_ASSERT( threads.get_size() > 0 );
for(t_size walk = 0; walk < threads.get_size(); ++walk) {
threads[walk].new_t(&counter,p_list,data.get_ptr(),p_script,p_hook);
}
for(t_size walk = 1; walk < threads.get_size(); ++walk) threads[walk]->start();
threads[0]->threadProc();
for(t_size walk = 1; walk < threads.get_size(); ++walk) threads[walk]->waitTillDone();
}
// console::formatter() << "metadb_handle sort: prepared in " << pfc::format_time_ex(timer.query(),6);
pfc::sort_t(data, p_direction > 0 ? custom_sort_compare<1> : custom_sort_compare<-1>,count);
//qsort(data.get_ptr(),count,sizeof(custom_sort_data),p_direction > 0 ? _custom_sort_compare<1> : _custom_sort_compare<-1>);
// console::formatter() << "metadb_handle sort: sorted in " << pfc::format_time_ex(timer.query(),6);
for(t_size n=0;n<count;n++)
{
order[n]=data[n].index;
delete[] data[n].text;
}
// console::formatter() << "metadb_handle sort: finished in " << pfc::format_time_ex(timer.query(),6);
}
开发者ID:exscape,项目名称:foo_simpleserver,代码行数:34,代码来源:metadb_handle_list.cpp
示例9: g_get_count
t_size file_list_from_metadb_handle_list::g_get_count(metadb_handle_list_cref data, t_size max) {
pfc::avltree_t<const char*, metadb::path_comparator> content;
const t_size inCount = data.get_size();
for(t_size walk = 0; walk < inCount && content.get_count() < max; ++walk) {
content += data[walk]->get_path();
}
return content.get_count();
}
开发者ID:9060,项目名称:columns_ui,代码行数:8,代码来源:file_list_helper.cpp
示例10: on_file_rechaptered
void playlist_manager::on_file_rechaptered(const char * path, metadb_handle_list_cref newItems) {
if (newItems.get_size() == 0) return;
const size_t numPlaylists = this->get_playlist_count();
for( size_t walkPlaylist = 0; walkPlaylist < numPlaylists; ++ walkPlaylist ) {
if (!playlist_lock_is_present(walkPlaylist)) {
auto itemCount = [=] () -> unsigned {
return this->playlist_get_item_count( walkPlaylist );
};
auto itemHandle = [=] ( unsigned item ) -> metadb_handle_ptr {
return this->playlist_get_item_handle( walkPlaylist, item );
};
auto itemMatch = [=] ( unsigned item ) -> bool {
return metadb::path_compare(path, itemHandle(item)->get_path()) == 0;
};
auto itemMatch2 = [=] ( metadb_handle_ptr item ) -> bool {
return metadb::path_compare(path, item->get_path() ) == 0;
};
for( size_t walkItem = 0; walkItem < itemCount(); ) {
if (itemMatch( walkItem )) {
pfc::avltree_t<uint32_t> subsongs;
unsigned base = walkItem;
bool bSel = false;
for( ++walkItem ; walkItem < itemCount() ; ++ walkItem ) {
auto handle = itemHandle( walkItem );
if (! itemMatch2( handle ) ) break;
if (! subsongs.add_item_check(handle->get_subsong_index())) break;
bSel = bSel || this->playlist_is_item_selected(walkPlaylist, walkItem);
}
// REMOVE base ... walkItem range and insert newHandles at base
this->playlist_remove_items( walkPlaylist, pfc::bit_array_range(base, walkItem-base) );
this->playlist_insert_items( walkPlaylist, base, newItems, pfc::bit_array_val( bSel ) );
walkItem = base + newItems.get_size();
} else {
++walkItem;
}
}
}
}
}
开发者ID:unjello,项目名称:foo_input_amr,代码行数:44,代码来源:playlist.cpp
示例11: extract_single_path
bool metadb_handle_list_helper::extract_single_path(metadb_handle_list_cref list, const char * &pathOut) {
const t_size total = list.get_count();
if (total == 0) return false;
const char * path = list[0]->get_path();
for(t_size walk = 1; walk < total; ++walk) {
if (metadb::path_compare(path, list[walk]->get_path()) != 0) return false;
}
pathOut = path;
return true;
}
开发者ID:exscape,项目名称:foo_simpleserver,代码行数:10,代码来源:metadb_handle_list.cpp
示例12: on_files_rechaptered
void playlist_manager::on_files_rechaptered( metadb_handle_list_cref newHandles ) {
pfc::map_t< const char*, metadb_handle_list, metadb::path_comparator > byPath;
const size_t total = newHandles.get_count();
for( size_t w = 0; w < total; ++w ) {
auto handle = newHandles[w];
byPath[ handle->get_path() ] += handle;
}
for( auto iter = byPath.first(); iter.is_valid(); ++ iter ) {
this->on_file_rechaptered( iter->m_key, iter->m_value );
}
}
开发者ID:unjello,项目名称:foo_input_amr,代码行数:13,代码来源:playlist.cpp
示例13: RunCalculatePeak
void RunCalculatePeak(metadb_handle_list_cref data) {
try {
if (data.get_count() == 0) throw pfc::exception_invalid_params();
service_ptr_t<threaded_process_callback> cb = new service_impl_t<calculate_hash>(data);
static_api_ptr_t<threaded_process>()->run_modeless(
cb,
threaded_process::flag_show_progress_dual | threaded_process::flag_show_item | threaded_process::flag_show_abort,
core_api::get_main_window(),
"Calculating audio data hashes...");
} catch(std::exception const & e) {
popup_message::g_complain("Could not start audio hashing process", e);
}
}
开发者ID:Crazybond,项目名称:foobar2000,代码行数:13,代码来源:foo_audiohasher.cpp
示例14: calc_total_size
t_filesize metadb_handle_list_helper::calc_total_size(metadb_handle_list_cref p_list, bool skipUnknown) {
pfc::avltree_t< const char*, metadb::path_comparator > beenHere;
// metadb_handle_list list(p_list);
// list.sort_t(metadb::path_compare_metadb_handle);
t_filesize ret = 0;
t_size n, m = p_list.get_count();
for(n=0;n<m;n++) {
bool isNew;
metadb_handle_ptr h; p_list.get_item_ex(h, n);
beenHere.add_ex( h->get_path(), isNew);
if (isNew) {
t_filesize t = h->get_filesize();
if (t == filesize_invalid) {
if (!skipUnknown) return filesize_invalid;
} else {
ret += t;
}
}
}
return ret;
}
开发者ID:exscape,项目名称:foo_simpleserver,代码行数:22,代码来源:metadb_handle_list.cpp
示例15: on_selection_changed
void nonautoregister_callbacks::on_selection_changed(metadb_handle_list_cref p_selection)
{
if (p_selection.get_count() > 0)
{
simple_callback_data<metadb_handle_ptr>* on_selection_changed_data
= new simple_callback_data<metadb_handle_ptr>(p_selection[0]);
panel_manager::instance().post_msg_to_all_pointer(CALLBACK_UWM_ON_SELECTION_CHANGED, on_selection_changed_data);
}
else
{
panel_manager::instance().post_msg_to_all(CALLBACK_UWM_ON_SELECTION_CHANGED);
}
}
开发者ID:19379,项目名称:foo-jscript-panel,代码行数:14,代码来源:panel_manager.cpp
示例16: on_changed_sorted
void selection_properties_t::on_changed_sorted(metadb_handle_list_cref p_items_sorted, bool p_fromhook)
{
if (!p_fromhook)
{
bool b_refresh = false;
t_size i, count = m_handles.get_count();
for (i=0; i<count && !b_refresh; i++)
{
t_size index = pfc_infinite;
if (p_items_sorted.bsearch_t(pfc::compare_t<metadb_handle_ptr, metadb_handle_ptr>, m_handles[i], index))
b_refresh = true;
}
if (b_refresh)
{
refresh_contents();
}
}
}
开发者ID:9060,项目名称:columns_ui,代码行数:18,代码来源:item_properties.cpp
示例17: getMainArtist
std::string getMainArtist(metadb_handle_list_cref tracks)
{
// Don't look at too many tracks - this method should be quick but won't be if we don't limit ourselves.
static const t_size maxNumberOfTracksToConsider = 100;
// Keep track of the number of each artist name we encounter.
std::map<const char*, t_size> artists;
// For each track, increment the number of occurrences of its artist.
for(t_size i = 0; i < tracks.get_count() && i < maxNumberOfTracksToConsider; i++)
{
service_ptr_t<metadb_info_container> outInfo;
if(tracks[i]->get_async_info_ref(outInfo))
{
const file_info& fileInfo = outInfo->info();
const bool has_artist_tag = fileInfo.meta_exists("artist");
const bool has_album_artist_tag = fileInfo.meta_exists("album artist");
if(has_artist_tag || has_album_artist_tag)
{
const char * artist = has_artist_tag ? fileInfo.meta_get("artist", 0) : fileInfo.meta_get("album artist", 0);
++artists[artist];
}
}
}
// Find the artist that occurred the most.
t_size maxCount = 0;
const char* maxArtist = "";
for(auto iter = artists.begin(); iter != artists.end(); iter++)
{
if((iter->second) > maxCount)
{
maxCount = iter->second;
maxArtist = iter->first;
}
}
// We've kept the database locked this whole time because we're just storing char* in the map, not copying the strings.
return maxArtist;
}
开发者ID:hymerman,项目名称:foo_bestversion,代码行数:40,代码来源:BestVersion.cpp
示例18: bsearch_by_pointer
t_size metadb_handle_list_helper::bsearch_by_pointer(metadb_handle_list_cref p_list,const metadb_handle_ptr & val)
{
t_size blah;
if (p_list.bsearch_t(pfc::compare_t<metadb_handle_ptr,metadb_handle_ptr>,val,blah)) return blah;
else return ~0;
}
开发者ID:exscape,项目名称:foo_simpleserver,代码行数:6,代码来源:metadb_handle_list.cpp
注:本文中的metadb_handle_list_cref类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论