本文整理汇总了C++中CAtlList::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ CAtlList::IsEmpty方法的具体用法?C++ CAtlList::IsEmpty怎么用?C++ CAtlList::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAtlList
的用法示例。
在下文中一共展示了CAtlList::IsEmpty方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseTypes
void File::ParseTypes(InputStream& s, CAtlList<CStringW>& types)
{
types.RemoveAll();
CStringW str;
for(int c = s.SkipWhiteSpace(); iswcsym(c) || c == '.' || c == '@'; c = s.PeekChar())
{
c = s.GetChar();
if(c == '.')
{
if(str.IsEmpty()) s.ThrowError(_T("'type' cannot be an empty string"));
if(!iswcsym(s.PeekChar())) s.ThrowError(_T("unexpected dot after type '%s'"), CString(str));
types.AddTail(str);
str.Empty();
}
else
{
if(str.IsEmpty() && iswdigit(c)) s.ThrowError(_T("'type' cannot start with a number"));
if((!str.IsEmpty() || !types.IsEmpty()) && c == '@') s.ThrowError(_T("unexpected @ in 'type'"));
str += (WCHAR)c;
}
}
if(!str.IsEmpty())
{
types.AddTail(str);
}
}
示例2: Definition
Definition& Definition::operator[](LPCWSTR type)
{
Definition* pRetDef = NULL;
if(m_type2def.Lookup(type, pRetDef))
return *pRetDef;
pRetDef = DNew Definition(m_pnf, L"");
pRetDef->m_priority = PLow;
pRetDef->m_type = type;
m_type2def[type] = pRetDef;
CAtlList<Definition*> l;
GetChildDefs(l, type);
while(!l.IsEmpty())
{
Definition* pDef = l.RemoveHead();
pRetDef->m_priority = pDef->m_priority;
pRetDef->m_parent = pDef->m_parent;
if(pDef->IsValue())
{
pRetDef->SetAsValue(pDef->m_status, pDef->m_value, pDef->m_unit);
}
else
{
pRetDef->m_status = node;
pRetDef->m_nodes.AddTailList(&pDef->m_nodes);
}
}
return *pRetDef;
}
示例3: GetAssociatedExtensionsFromRegistry
bool CFileAssoc::GetAssociatedExtensionsFromRegistry(CAtlList<CString>& exts) const
{
exts.RemoveAll();
CRegKey rkHKCR(HKEY_CLASSES_ROOT);
LONG ret;
DWORD i = 0;
CString keyName, ext;
DWORD len = MAX_PATH;
while ((ret = rkHKCR.EnumKey(i, keyName.GetBuffer(len), &len)) != ERROR_NO_MORE_ITEMS) {
if (ret == ERROR_SUCCESS) {
keyName.ReleaseBuffer(len);
if (keyName.Find(PROGID) == 0) {
ext = keyName.Mid(_countof(PROGID) - 1);
if (IsRegistered(ext)) {
exts.AddTail(ext);
}
}
i++;
len = MAX_PATH;
}
}
return !exts.IsEmpty();
}
示例4: ParseDefs
void File::ParseDefs(InputStream& s, Reference* pParentRef)
{
while(s.SkipWhiteSpace(L";") != '}' && s.PeekChar() != Stream::EOS)
{
NodePriority priority = PNormal;
CAtlList<CStringW> types;
CStringW name;
int c = s.SkipWhiteSpace();
if(c == '*') {s.GetChar(); priority = PLow;}
else if(c == '!') {s.GetChar(); priority = PHigh;}
ParseTypes(s, types);
if(s.SkipWhiteSpace() == '#')
{
s.GetChar();
ParseName(s, name);
}
if(types.IsEmpty())
{
if(name.IsEmpty()) s.ThrowError(_T("syntax error"));
types.AddTail(L"?");
}
Reference* pRef = pParentRef;
while(types.GetCount() > 1)
pRef = CreateRef(CreateDef(pRef, types.RemoveHead()));
Definition* pDef = NULL;
if(!types.IsEmpty())
pDef = CreateDef(pRef, types.RemoveHead(), name, priority);
c = s.SkipWhiteSpace(L":=");
if(c == '"' || c == '\'') ParseQuotedString(s, pDef);
else if(iswdigit(c) || c == '+' || c == '-') ParseNumber(s, pDef);
else if(pDef->IsType(L"@")) ParseBlock(s, pDef);
else ParseRefs(s, pDef);
}
s.GetChar();
}
示例5: ParsePlayList
void CPlayerPlaylistBar::ParsePlayList(CAtlList<CString>& fns, CAtlList<CString>* subs)
{
if (fns.IsEmpty()) {
return;
}
const CAppSettings& s = AfxGetAppSettings();
ResolveLinkFiles(fns);
CAtlList<CString> sl;
if (SearchFiles(fns.GetHead(), sl)) {
if (sl.GetCount() > 1) {
subs = NULL;
}
POSITION pos = sl.GetHeadPosition();
while (pos) {
ParsePlayList(sl.GetNext(pos), subs);
}
return;
}
CAtlList<CString> redir;
CStringA ct = GetContentType(fns.GetHead(), &redir);
if (!redir.IsEmpty()) {
POSITION pos = redir.GetHeadPosition();
while (pos) {
ParsePlayList(sl.GetNext(pos), subs);
}
return;
}
if (ct == "application/x-mpc-playlist") {
ParseMPCPlayList(fns.GetHead());
return;
} else {
#if INTERNAL_SOURCEFILTER_MPEG
if (ct == "application/x-bdmv-playlist" && s.SrcFilters[SRC_MPEG]) {
ParseBDMVPlayList(fns.GetHead());
return;
}
#endif
}
AddItem(fns, subs);
}
示例6: SetupList
void CFavoriteOrganizeDlg::SetupList(bool fSave)
{
int i = m_tab.GetCurSel();
if (fSave) {
CAtlList<CString> sl;
for (int j = 0; j < m_list.GetItemCount(); j++) {
CAtlList<CString> args;
ExplodeEsc(m_sl[i].GetAt((POSITION)m_list.GetItemData(j)), args, _T(';'));
args.RemoveHead();
args.AddHead(m_list.GetItemText(j, 0));
sl.AddTail(ImplodeEsc(args, _T(';')));
}
m_sl[i].RemoveAll();
m_sl[i].AddTailList(&sl);
} else {
m_list.DeleteAllItems();
POSITION pos = m_sl[i].GetHeadPosition(), tmp;
while (pos) {
tmp = pos;
CAtlList<CString> sl;
ExplodeEsc(m_sl[i].GetNext(pos), sl, _T(';'), 3);
int n = m_list.InsertItem(m_list.GetItemCount(), sl.RemoveHead());
m_list.SetItemData(n, (DWORD_PTR)tmp);
if (!sl.IsEmpty()) {
REFERENCE_TIME rt = 0;
if (1 == _stscanf_s(sl.GetHead(), _T("%I64d"), &rt) && rt > 0) {
DVD_HMSF_TIMECODE hmsf = RT2HMSF(rt);
CString str;
str.Format(_T("[%02d:%02d:%02d]"), hmsf.bHours, hmsf.bMinutes, hmsf.bSeconds);
m_list.SetItemText(n, 1, str);
}
}
}
UpdateColumnsSizes();
}
}
示例7: GetAssociatedExtensions
bool CFileAssoc::GetAssociatedExtensions(const CMediaFormats& mf, CAtlList<CString>& exts)
{
exts.RemoveAll();
CAtlList<CString> mfcExts;
for (size_t i = 0, cnt = mf.GetCount(); i < cnt; i++) {
ExplodeMin(mf[i].GetExtsWithPeriod(), mfcExts, _T(' '));
POSITION pos = mfcExts.GetHeadPosition();
while (pos) {
const CString ext = mfcExts.GetNext(pos);
if (CFileAssoc::IsRegistered(ext)) {
exts.AddTail(ext);
}
}
}
return !exts.IsEmpty();
}
示例8: ParseDirs
void ParseDirs(CAtlList<CString>& paths)
{
POSITION pos = paths.GetHeadPosition();
while (pos) {
POSITION prevPos = pos;
CString fn = paths.GetNext(pos);
// Try to follow link files that point to a directory
if (IsLinkFile(fn)) {
fn = ResolveLinkFile(fn);
}
if (IsDir(fn)) {
CAtlList<CString> subDirs;
RecurseAddDir(fn, subDirs);
// Add the subdirectories just after their parent
// so that the tree is not parsed multiple times
while (!subDirs.IsEmpty()) {
paths.InsertAfter(prevPos, subDirs.RemoveTail());
}
}
}
}
示例9: ATLASSERT
// Define the integer list
CAtlList<int> myList;
// Populate the list
myList.AddTail(1);
myList.AddTail(2);
myList.AddTail(3);
myList.AddTail(4);
// Confirm not empty
ATLASSERT(myList.IsEmpty() == false);
// Remove the tail element
myList.RemoveTailNoReturn();
// Confirm not empty
ATLASSERT(myList.IsEmpty() == false);
// Remove the head element
myList.RemoveHeadNoReturn();
// Confirm not empty
ATLASSERT(myList.IsEmpty() == false);
// Remove all remaining elements
myList.RemoveAll();
// Confirm empty
ATLASSERT(myList.IsEmpty() == true);
示例10: GetMediaTypeDesc
CString CBaseSplitterOutputPin::GetMediaTypeDesc(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter)
{
if (mts.IsEmpty()) {
return pName;
}
CLSID clSID;
HRESULT hr = pFilter->GetClassID(&clSID);
if ((clSID == __uuidof(CMpegSourceFilter)) || (clSID == __uuidof(CMpegSplitterFilter))) {
return pName;
}
CAtlList<CString> Infos;
const CMediaType* pmt = &mts[0];
if (pmt->majortype == MEDIATYPE_Video) {
const VIDEOINFOHEADER *pVideoInfo = NULL;
const VIDEOINFOHEADER2 *pVideoInfo2 = NULL;
BOOL bAdd = FALSE;
if (pmt->formattype == FORMAT_VideoInfo) {
pVideoInfo = GetFormatHelper(pVideoInfo, pmt);
} else if (pmt->formattype == FORMAT_MPEGVideo) {
Infos.AddTail(L"MPEG");
const MPEG1VIDEOINFO *pInfo = GetFormatHelper(pInfo, pmt);
pVideoInfo = &pInfo->hdr;
bAdd = TRUE;
} else if (pmt->formattype == FORMAT_MPEG2_VIDEO) {
const MPEG2VIDEOINFO *pInfo = GetFormatHelper(pInfo, pmt);
pVideoInfo2 = &pInfo->hdr;
bool bIsAVC = false;
bool bIsMPEG2 = false;
if (pInfo->hdr.bmiHeader.biCompression == FCC('AVC1') || pInfo->hdr.bmiHeader.biCompression == FCC('H264')) {
bIsAVC = true;
Infos.AddTail(L"AVC (H.264)");
bAdd = TRUE;
} else if (pInfo->hdr.bmiHeader.biCompression == FCC('AMVC')) {
bIsAVC = true;
Infos.AddTail(L"MVC (Full)");
bAdd = TRUE;
} else if (pInfo->hdr.bmiHeader.biCompression == FCC('EMVC')) {
bIsAVC = true;
Infos.AddTail(L"MVC (Subset)");
bAdd = TRUE;
} else if (pInfo->hdr.bmiHeader.biCompression == 0) {
Infos.AddTail(L"MPEG2");
bIsMPEG2 = true;
bAdd = TRUE;
}
if (bIsMPEG2) {
Infos.AddTail(MPEG2_Profile[pInfo->dwProfile]);
} else if (pInfo->dwProfile) {
if (bIsAVC) {
switch (pInfo->dwProfile) {
case 44:
Infos.AddTail(L"CAVLC Profile");
break;
case 66:
Infos.AddTail(L"Baseline Profile");
break;
case 77:
Infos.AddTail(L"Main Profile");
break;
case 88:
Infos.AddTail(L"Extended Profile");
break;
case 100:
Infos.AddTail(L"High Profile");
break;
case 110:
Infos.AddTail(L"High 10 Profile");
break;
case 118:
Infos.AddTail(L"Multiview High Profile");
break;
case 122:
Infos.AddTail(L"High 4:2:2 Profile");
break;
case 244:
Infos.AddTail(L"High 4:4:4 Profile");
break;
case 128:
Infos.AddTail(L"Stereo High Profile");
break;
default:
Infos.AddTail(FormatString(L"Profile %d", pInfo->dwProfile));
break;
}
} else {
Infos.AddTail(FormatString(L"Profile %d", pInfo->dwProfile));
}
}
//.........这里部分代码省略.........
示例11: Dump
void SZYamlDocument::Dump(CString& strText, int nDumpIndent/* = SZYAML_DUMP_INDENT*/)
{
POSITION pos = m_YamlItemList.GetHeadPosition();
struct _KeyStackNode
{
_KeyStackNode()
: nIndent(0)
, nChildIndent(0)
, bIsList(FALSE)
{
}
int nIndent;
int nChildIndent;
CString strKey;
BOOL bIsList;
};
CAtlList<_KeyStackNode> listKeyStack;
int nLastIndent = -1;
BOOL bListItem = FALSE, bPrintThisLine = TRUE;
CString strLine;
strText = _T("");
while (pos)
{
_YamlItem &item = m_YamlItemList.GetAt(pos);
if (listKeyStack.IsEmpty())
bListItem = FALSE;
else
bListItem = listKeyStack.GetTail().bIsList;
if (item.nIndent == nLastIndent + 1)
{
_KeyStackNode &newkey = listKeyStack.GetAt(listKeyStack.AddTail());
POSITION posNext = _GetNextPos(pos, TRUE);
newkey.nIndent = item.nIndent;
newkey.strKey = item.node.Key();
newkey.bIsList = (posNext != NULL);
}
else if (item.nIndent == nLastIndent)
{
_KeyStackNode &newkey = listKeyStack.GetTail();
POSITION posNext = _GetNextPos(pos, TRUE);
newkey.nIndent = item.nIndent;
newkey.strKey = item.node.Key();
newkey.bIsList = (posNext != NULL);
}
else if (item.nIndent < nLastIndent)
{
for (nLastIndent -= item.nIndent; nLastIndent > 0; -- nLastIndent)
listKeyStack.RemoveTail();
if (listKeyStack.IsEmpty())
bPrintThisLine = TRUE;
else
{
_KeyStackNode &newkey = listKeyStack.GetTail();
newkey.nIndent = item.nIndent;
if (newkey.strKey != item.node.Key())
{
newkey.strKey = item.node.Key();
POSITION posNext = _GetNextPos(pos, TRUE);
newkey.bIsList = (posNext != NULL);
}
else
bPrintThisLine = !newkey.bIsList;
}
}
#ifdef _SZYAML_DEBUG_TRACE
{ // Trace Key Stack
kconsole::printf(_T(" "));
for (POSITION pos = listKeyStack.GetHeadPosition(); pos != NULL; listKeyStack.GetNext(pos))
{
_KeyStackNode key = listKeyStack.GetAt(pos);
kconsole::settextcolor(TRUE, TRUE, TRUE, FALSE);
kconsole::printf(_T("(%d, '%s', %d)"), key.nIndent, key.strKey, key.bIsList);
kconsole::settextcolor(TRUE, TRUE, TRUE, TRUE);
}
kconsole::printf(_T("\r\n"));
}
#endif
// 这里对不确定长度的%s不使用Format,是因为MIN_CRT的格式化输出限制长度为1024,见atlstr.h
// by bbcallen 2009-07-02
if (bPrintThisLine)
{
if (bListItem)
{
strLine.Format(
_T("%s-%s"),
CString(_T(' '), (item.nIndent - 1) * nDumpIndent),
CString(_T(' '), nDumpIndent - 1)
);
//.........这里部分代码省略.........
示例12: Load
BOOL SZYamlDocument::Load(LPCTSTR lpszText)
{
BOOL bResult = FALSE;
BOOL bNotFinish = TRUE;
CString strText = lpszText, strLine, strKey, strValue;
int nThisLinePos = 0, nNextLinePos = 0, nColonPos = 0;
int nIndent = 0, nLineNum = 1;
struct _KeyStackNode
{
_KeyStackNode()
: nIndent(0)
, nChildIndent(0)
, bIsList(FALSE)
{
}
int nIndent;
int nChildIndent;
CString strKey;
BOOL bIsList;
};
CAtlList<_KeyStackNode> listKeyStack;
BOOL bNewChild = FALSE, bIsListItem = FALSE;
m_YamlItemList.RemoveAll();
if (!lpszText)
goto Exit0;
while (bNotFinish)
{
nNextLinePos = strText.Find(_T('\n'), nThisLinePos);
if (-1 == nNextLinePos)
{
bNotFinish = FALSE;
strLine = strText.Mid(nThisLinePos);
}
else
strLine = strText.Mid(nThisLinePos, nNextLinePos - nThisLinePos);
nIndent = 0;
// Get indent
while (_T(' ') == strLine[nIndent])
nIndent ++;
nColonPos = strLine.Find(_T(':'));
strKey = strLine.Left(nColonPos).Trim();
strValue = strLine.Mid(nColonPos + 1).Trim();
if (_T('-') == strKey[0])
{
int nIndentMore = 1;
while (_T(' ') == strKey[nIndentMore])
nIndentMore ++;
nIndent += nIndentMore;
strKey = strKey.Mid(nIndentMore);
bIsListItem = TRUE;
}
else
bIsListItem = FALSE;
if (bNewChild)
{
_KeyStackNode &LastKey = listKeyStack.GetTail();
LastKey.nChildIndent = nIndent;
if (bIsListItem)
LastKey.bIsList = TRUE;
#ifdef _SZYAML_DEBUG_TRACE
{ // Trace Key Stack
kconsole::printf(_T(" "));
for (POSITION pos = listKeyStack.GetHeadPosition(); pos != NULL; listKeyStack.GetNext(pos))
{
_KeyStackNode key = listKeyStack.GetAt(pos);
kconsole::printf(_T("(%d, '%s', %d)"), key.nChildIndent, key.strKey, key.bIsList);
}
kconsole::printf(_T("\r\n"));
}
#endif
}
strLine = strLine.Mid(nIndent);
if (strLine.IsEmpty())
continue;
while (!listKeyStack.IsEmpty())
{
_KeyStackNode &LastKey = listKeyStack.GetTail();
if (LastKey.nChildIndent == nIndent)
break;
//.........这里部分代码省略.........