本文整理汇总了C++中StrList::Ref方法的典型用法代码示例。如果您正苦于以下问题:C++ StrList::Ref方法的具体用法?C++ StrList::Ref怎么用?C++ StrList::Ref使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StrList
的用法示例。
在下文中一共展示了StrList::Ref方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPackTextureDirs
boolean GetPackTextureDirs(DIRLIST **dirlist)
{
UInt16 i;
char buf[57];
if (!pakopen)
return 1;
if (g_bPK3)
{
StrList *pl = g_PK3TexturePaths.Next();
while (pl != NULL)
{
AddToDirListAlphabetized(dirlist, pl->Ref(), 0);
pl = pl->Next();
}
return true;
}
for (i = 0; i < dirsize; i++)
{
if(!strnicmp(pakdirptr[i].name, "textures", 8))
{
strncpy(buf, &(pakdirptr[i].name[9]), 46);
if(strchr(buf, '\\'))
*strchr(buf, '\\') = '\0';
else if(strchr(buf, '/'))
*strchr(buf, '/') = '\0';
else
buf[56] = '\0';
if(strchr(buf, '.'))
continue;
AddToDirListAlphabetized(dirlist, buf, 0);
}
}
return true;
}
示例2: OpenPK3
// OpenPK3
// -------
// Opens a PK3 ( or zip ) file and creates a list of filenames
// and zip info structures
//
boolean OpenPK3(const char *filename)
{
char cFilename[WORK_LEN];
char cName[WORK_LEN];
char cWork[WORK_LEN];
unz_file_info zInfo;
unzFile *zFile = new unzFile(unzOpen(filename));
g_zFiles.Add(zFile);
if (zFile != NULL)
{
int nStatus = unzGoToFirstFile(*zFile);
while (nStatus == UNZ_OK)
{
cFilename[0] = '\0';
unzGetCurrentFileInfo(*zFile, &zInfo, cFilename, WORK_LEN, NULL, 0, NULL, 0);
strlwr(cFilename);
__ConvertDOSToUnixName( cWork, cFilename);
if (strstr(cWork, ".") != NULL)
{
PK3FileInfo *pInfo = new PK3FileInfo();
pInfo->m_pName = __StrDup(cWork);
memcpy(&pInfo->m_zInfo, (unz_s*)*zFile, sizeof(unz_s));
pInfo->m_lSize = zInfo.uncompressed_size;
pInfo->m_zFile = *zFile;
g_PK3Files.Add(pInfo);
}
char *p = strstr(cFilename, TEXTURE_PATH);
if (p != NULL)
{
// FIXME: path differences per os ?
// catch solo directory entry
if (strlen(p) > strlen(TEXTURE_PATH) + 1)
{
// skip textures + path seperator
p += strlen(TEXTURE_PATH) + 1;
int nEnd = strcspn(p, PATH_SEPERATORS);
strncpy(cName, p, nEnd);
cName[nEnd] = '\0';
boolean bFound = false;
StrList *pl = g_PK3TexturePaths.Next();
while (pl != NULL)
{
if (strcmpi(pl->Ref(), cName) == 0)
{
// already have this, continue
bFound = true;
break;
}
pl = pl->Next();
}
if (!bFound)
{
g_PK3TexturePaths.Add(new Str(cName));
}
}
}
nStatus = unzGoToNextFile(*zFile);
}
}
return (zFile != NULL);
}