本文整理汇总了C++中file_info::meta_enum_value_count方法的典型用法代码示例。如果您正苦于以下问题:C++ file_info::meta_enum_value_count方法的具体用法?C++ file_info::meta_enum_value_count怎么用?C++ file_info::meta_enum_value_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类file_info
的用法示例。
在下文中一共展示了file_info::meta_enum_value_count方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: g_is_meta_equal_debug
bool file_info::g_is_meta_equal_debug(const file_info & p_item1,const file_info & p_item2) {
const t_size count = p_item1.meta_get_count();
if (count != p_item2.meta_get_count()) {
uDebugLog() << "meta count mismatch";
return false;
}
pfc::map_t<const char*,t_size,field_name_comparator> item2_meta_map;
for(t_size n=0; n<count; n++) {
item2_meta_map.set(p_item2.meta_enum_name(n),n);
}
for(t_size n1=0; n1<count; n1++) {
t_size n2;
if (!item2_meta_map.query(p_item1.meta_enum_name(n1),n2)) {
uDebugLog() << "item2 doesn't have " << p_item1.meta_enum_name(n1);
return false;
}
t_size value_count = p_item1.meta_enum_value_count(n1);
if (value_count != p_item2.meta_enum_value_count(n2)) {
uDebugLog() << "meta value count mismatch: " << p_item1.meta_enum_name(n1) << " : " << value_count << " vs " << p_item2.meta_enum_value_count(n2);
return false;
}
for(t_size v = 0; v < value_count; v++) {
if (strcmp(p_item1.meta_enum_value(n1,v),p_item2.meta_enum_value(n2,v)) != 0) {
uDebugLog() << "meta mismatch: " << p_item1.meta_enum_name(n1) << " : " << p_item1.meta_enum_value(n1,v) << " vs " << p_item2.meta_enum_value(n2,v);
return false;
}
}
}
return true;
}
示例2: merge_tags_calc_rating_by_index
static t_size merge_tags_calc_rating_by_index(const file_info & p_info,t_size p_index) {
t_size n,m = p_info.meta_enum_value_count(p_index);
t_size ret = 0;
for(n=0;n<m;n++)
ret += strlen(p_info.meta_enum_value(p_index,n)) + 10;//yes, strlen on utf8 data, plus a slight bump to prefer multivalue over singlevalue w/ separator
return ret;
}
示例3: update_metadata
void stream_encoders::update_metadata(const file_info&p_info){
metadata.remove_all();
pfc::string artist,title;
for (unsigned i=0;i<p_info.meta_get_count();i++) {
pfc::string name = p_info.meta_enum_name(i);
for (unsigned j=0;j<p_info.meta_enum_value_count(i);j++){
pfc::string value = p_info.meta_enum_value(i,j);
pfc::string buffer=name+"="+value;
metadata.add_item(buffer);
if(pfc::string::g_equalsCaseInsensitive(name,"artist"))
artist=value;
if(pfc::string::g_equalsCaseInsensitive(name,"title"))
title=value;
}
}
pfc::string meta=artist+" - "+title;
for(unsigned i=0;i<enc_list.get_count();++i){
strcpy(enc_list[i]->config->gSongTitle,(char*)meta.ptr());
enc_list[i]->config->ice2songChange=true;
updateSongTitle(enc_list[i]->config,0);
}
}
示例4: g_print_field
void selection_properties_t::g_print_field(const char * field, const file_info & p_info, pfc::string_base & p_out)
{
t_size meta_index = p_info.meta_find(field);
if (meta_index != pfc_infinite)
{
t_size i, count = p_info.meta_enum_value_count(meta_index);
for (i = 0; i < count; i++)
p_out << p_info.meta_enum_value(meta_index, i) << (i + 1 < count ? "; " : "");
}
}
示例5: copy_meta_single_rename_ex
void file_info::copy_meta_single_rename_ex(const file_info & p_source,t_size p_index,const char * p_new_name,t_size p_new_name_length)
{
t_size n, m = p_source.meta_enum_value_count(p_index);
t_size new_index = pfc_infinite;
for(n=0; n<m; n++)
{
const char * value = p_source.meta_enum_value(p_index,n);
if (n == 0) new_index = meta_set_ex(p_new_name,p_new_name_length,value,pfc_infinite);
else meta_add_value(new_index,value);
}
}
示例6: copy_meta_single_nocheck
void file_info::copy_meta_single_nocheck(const file_info & p_source,t_size p_index)
{
const char * name = p_source.meta_enum_name(p_index);
t_size n, m = p_source.meta_enum_value_count(p_index);
t_size new_index = pfc_infinite;
for(n=0; n<m; n++)
{
const char * value = p_source.meta_enum_value(p_index,n);
if (n == 0) new_index = meta_set_nocheck(name,value);
else meta_add_value(new_index,value);
}
}
示例7: strip_redundant_track_meta
static void strip_redundant_track_meta(unsigned p_tracknumber,const file_info & p_cueinfo,file_info_record::t_meta_map & p_meta,const char * p_metaname) {
t_size metaindex = p_cueinfo.meta_find(p_metaname);
if (metaindex == pfc_infinite) return;
pfc::string_formatter namelocal;
build_cue_meta_name(p_metaname,p_tracknumber,namelocal);
{
const file_info_record::t_meta_value * val = p_meta.query_ptr(namelocal);
if (val == NULL) return;
file_info_record::t_meta_value::const_iterator iter = val->first();
for(t_size valwalk = 0, valcount = p_cueinfo.meta_enum_value_count(metaindex); valwalk < valcount; ++valwalk) {
if (iter.is_empty()) return;
if (strcmp(*iter,p_cueinfo.meta_enum_value(metaindex,valwalk)) != 0) return;
++iter;
}
if (!iter.is_empty()) return;
}
//success
p_meta.remove(namelocal);
}
示例8: copy
void file_info_const_impl::copy(const file_info & p_source)
{
// profiler(file_info_const_impl__copy);
t_size meta_size = 0;
t_size info_size = 0;
t_size valuemap_size = 0;
t_size stringbuffer_size = 0;
#ifdef __file_info_const_impl_have_hintmap__
t_size hintmap_size = 0;
#endif
{
// profiler(file_info_const_impl__copy__pass1);
t_size index;
m_meta_count = pfc::downcast_guarded<t_index>(p_source.meta_get_count());
meta_size = m_meta_count * sizeof(meta_entry);
#ifdef __file_info_const_impl_have_hintmap__
hintmap_size = (m_meta_count > hintmap_cutoff) ? m_meta_count * sizeof(t_index) : 0;
#endif//__file_info_const_impl_have_hintmap__
for(index = 0; index < m_meta_count; index++ )
{
{
const char * name = p_source.meta_enum_name(index);
if (optimize_fieldname(name) == 0)
stringbuffer_size += strlen(name) + 1;
}
t_size val; const t_size val_max = p_source.meta_enum_value_count(index);
if (val_max == 1)
{
stringbuffer_size += strlen(p_source.meta_enum_value(index,0)) + 1;
}
else
{
valuemap_size += val_max * sizeof(char*);
for(val = 0; val < val_max; val++ )
{
stringbuffer_size += strlen(p_source.meta_enum_value(index,val)) + 1;
}
}
}
m_info_count = pfc::downcast_guarded<t_index>(p_source.info_get_count());
info_size = m_info_count * sizeof(info_entry);
for(index = 0; index < m_info_count; index++ )
{
const char * name = p_source.info_enum_name(index);
if (optimize_infoname(name) == NULL) stringbuffer_size += strlen(name) + 1;
stringbuffer_size += strlen(p_source.info_enum_value(index)) + 1;
}
}
{
// profiler(file_info_const_impl__copy__alloc);
m_buffer.set_size(
#ifdef __file_info_const_impl_have_hintmap__
hintmap_size +
#endif
meta_size + info_size + valuemap_size + stringbuffer_size);
}
char * walk = m_buffer.get_ptr();
#ifdef __file_info_const_impl_have_hintmap__
t_index* hintmap = (hintmap_size > 0) ? (t_index*) walk : NULL;
walk += hintmap_size;
#endif
meta_entry * meta = (meta_entry*) walk;
walk += meta_size;
char ** valuemap = (char**) walk;
walk += valuemap_size;
info_entry * info = (info_entry*) walk;
walk += info_size;
char * stringbuffer = walk;
m_meta = meta;
m_info = info;
#ifdef __file_info_const_impl_have_hintmap__
m_hintmap = hintmap;
#endif
{
// profiler(file_info_const_impl__copy__pass2);
t_size index;
for( index = 0; index < m_meta_count; index ++ )
{
t_size val; const t_size val_max = p_source.meta_enum_value_count(index);
{
const char * name = p_source.meta_enum_name(index);
const char * name_opt = optimize_fieldname(name);
if (name_opt == NULL)
meta[index].m_name = stringbuffer_append(stringbuffer, name );
else
meta[index].m_name = name_opt;
}
//.........这里部分代码省略.........
开发者ID:georgemouse,项目名称:foobar2000-Vorbis-Streamer-v1.1-mouse_fix-,代码行数:101,代码来源:file_info_const_impl.cpp
示例9: set_tag
void embeddedcue_metadata_manager::set_tag(file_info const & p_info) {
m_content.remove_all();
{
track_record & track0 = m_content.find_or_add((unsigned)0);
track0.m_info.from_info(p_info);
track0.m_info.m_info.set("cue_embedded","no");
}
const char * cuesheet = p_info.meta_get("cuesheet",0);
if (cuesheet == NULL) {
return;
}
//processing order
//1. cuesheet content
//2. overwrite with global metadata from the tag
//2. overwrite with local metadata from the tag
{
cue_creator::t_entry_list entries;
try {
cue_parser::parse_full(cuesheet,entries);
} catch(exception_io_data const & e) {
console::print(e.what());
return;
}
for(cue_creator::t_entry_list::const_iterator iter = entries.first(); iter.is_valid(); ) {
cue_creator::t_entry_list::const_iterator next = iter;
++next;
track_record & entry = m_content.find_or_add(iter->m_track_number);
entry.m_file = iter->m_file;
entry.m_flags = iter->m_flags;
entry.m_index_list = iter->m_index_list;
entry.m_info.from_info(iter->m_infos);
entry.m_info.from_info_overwrite_info(p_info);
entry.m_info.m_info.set("cue_embedded","yes");
double begin = entry.m_index_list.start(), end = next.is_valid() ? next->m_index_list.start() : p_info.get_length();
if (end <= begin) throw exception_io_data();
entry.m_info.set_length(end - begin);
iter = next;
}
}
for(t_size metawalk = 0, metacount = p_info.meta_get_count(); metawalk < metacount; ++metawalk) {
const char * name = p_info.meta_enum_name(metawalk);
const t_size valuecount = p_info.meta_enum_value_count(metawalk);
if (valuecount > 0 && !is_reserved_meta_entry(name) && is_global_meta_entry(name)) {
__set_tag_global_field_relay relay(p_info,metawalk);
m_content.enumerate(relay);
}
}
{
pfc::string8_fastalloc namebuffer;
for(t_size metawalk = 0, metacount = p_info.meta_get_count(); metawalk < metacount; ++metawalk) {
const char * name = p_info.meta_enum_name(metawalk);
const t_size valuecount = p_info.meta_enum_value_count(metawalk);
unsigned trackno;
if (valuecount > 0 && !is_reserved_meta_entry(name) && resolve_cue_meta_name(name,namebuffer,trackno)) {
track_record * rec = m_content.query_ptr(trackno);
if (rec != NULL) {
rec->m_info.transfer_meta_entry(namebuffer,p_info,metawalk);
}
}
}
}
}