本文整理汇总了C++中CAtlMap::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CAtlMap::GetCount方法的具体用法?C++ CAtlMap::GetCount怎么用?C++ CAtlMap::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAtlMap
的用法示例。
在下文中一共展示了CAtlMap::GetCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseMPCPlayList
bool CPlayerPlaylistBar::ParseMPCPlayList(CString fn)
{
CString str;
CAtlMap<int, CPlaylistItem> pli;
CAtlArray<int> idx;
CWebTextFile f;
if (!f.Open(fn) || !f.ReadString(str) || str != _T("MPCPLAYLIST")) {
return false;
}
if (f.GetEncoding() == CTextFile::ASCII) {
f.SetEncoding(CTextFile::ANSI);
}
CPath base(fn);
base.RemoveFileSpec();
while (f.ReadString(str)) {
CAtlList<CString> sl;
Explode(str, sl, ',', 3);
if (sl.GetCount() != 3) {
continue;
}
if (int i = _ttoi(sl.RemoveHead())) {
CString key = sl.RemoveHead();
CString value = sl.RemoveHead();
if (key == _T("type")) {
pli[i].m_type = (CPlaylistItem::type_t)_ttol(value);
idx.Add(i);
} else if (key == _T("label")) {
pli[i].m_label = value;
} else if (key == _T("filename")) {
value = CombinePath(base, value);
pli[i].m_fns.AddTail(value);
} else if (key == _T("subtitle")) {
value = CombinePath(base, value);
pli[i].m_subs.AddTail(value);
} else if (key == _T("video")) {
while (pli[i].m_fns.GetCount() < 2) {
pli[i].m_fns.AddTail(_T(""));
}
pli[i].m_fns.GetHead() = value;
} else if (key == _T("audio")) {
while (pli[i].m_fns.GetCount() < 2) {
pli[i].m_fns.AddTail(_T(""));
}
pli[i].m_fns.GetTail() = value;
} else if (key == _T("vinput")) {
pli[i].m_vinput = _ttol(value);
} else if (key == _T("vchannel")) {
pli[i].m_vchannel = _ttol(value);
} else if (key == _T("ainput")) {
pli[i].m_ainput = _ttol(value);
} else if (key == _T("country")) {
pli[i].m_country = _ttol(value);
}
}
}
qsort(idx.GetData(), idx.GetCount(), sizeof(int), s_int_comp);
for (size_t i = 0; i < idx.GetCount(); i++) {
m_pl.AddTail(pli[idx[i]]);
}
return pli.GetCount() > 0;
}
示例2: OnDataChange
void AsyncUpdateHandler::OnDataChange(COPCGroup & group, CAtlMap<COPCItem *, OPCItemData *> & changes)
{
log_NOTICE("OnDataChange called, group [", group.getName(),"] change count [", pantheios::integer(changes.GetCount()),"] have callback [",(callbackFn != NULL?"Y":"N"),"]");
for(POSITION pos = changes.GetStartPosition(); pos != NULL; )
{
CAtlMap<COPCItem *, OPCItemData *>::CPair* pPair = changes.GetNext(pos);
ItemValueStruct itemValueStruct(pPair->m_value);
const ItemValue& itemValue = itemValueStruct.getItemValue();
log_NOTICE("\t item [",pPair->m_key->getName(),"] value [", itemValueStruct.getItemValue().value,"]");
if(callbackFn != NULL)
{
log_NOTICE("\t OnDataChange calling callback fn");
//Update* update = createUpdate(pPair->m_key->getName().GetString(), itemValue.value, itemValue.quality, itemValue.dataType, itemValue.timestamp);
callbackFn(pPair->m_key->getName().GetString(), itemValue.value, itemValue.quality, itemValue.dataType, itemValue.timestamp);
log_DEBUG("\t OnDataChange called callback fn");
/*
callbackFn(update);
log_DEBUG("\t OnDataChange called callback fn");
destroyUpdate(update);
log_DEBUG("\t OnDataChange destroyed object");
*/
}
}
}