本文整理汇总了C++中PlaylistItem::URL方法的典型用法代码示例。如果您正苦于以下问题:C++ PlaylistItem::URL方法的具体用法?C++ PlaylistItem::URL怎么用?C++ PlaylistItem::URL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlaylistItem
的用法示例。
在下文中一共展示了PlaylistItem::URL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
//.........这里部分代码省略.........
event.eventString = "Scanning external memory...";
function(&event, cookie);
}
privateReadPlaylist(rioExternal,
true,
&externalTotal,
&usedMem,
&origExternal,
function,
cookie);
}
count = list->size();
bool useExternal = false;
for(index = 0; index < count; index++)
{
PlaylistItem* item = (*list)[index];
if(item)
{
MetaData metadata = item->GetMetaData();
int32 size = metadata.Size();
if(!size)
{
struct stat st;
length = _MAX_PATH;
URLToFilePath(item->URL().c_str(), path, &length);
if(!stat(path, &st))
size = st.st_size;
else
{
result = kError_FileNoAccess;
break;
}
}
// figure out where to put it...
uint32* memorySize;
vector<PlaylistItem*>* addList;
if(!useExternal)
{
memorySize = &internalTotal;
addList = &newInternal;
if(*memorySize < (uint32)size)
useExternal = true;
else
*memorySize -= size;
}
if(useExternal)
{
memorySize = &externalTotal;
addList = &newExternal;
if(*memorySize < (uint32)size)
break;
示例2: WritePlaylist
Error PLS::WritePlaylist(const char* url, PlaylistFormatInfo* format,
vector<PlaylistItem*>* list,
PLMCallBackFunction function,
void* cookie)
{
Error result = kError_InvalidParam;
assert(url);
assert(format);
assert(list);
if(url && format && list)
{
result = kError_FormatNotSupported;
if(!strcasecmp("pls", format->GetExtension()))
{
FILE* fp = NULL;
char path[_MAX_PATH];
uint32 length = sizeof(path);
URLToFilePath(url, path, &length);
result = kError_FileNoAccess;
fp = fopen(path, "wb");
if(fp)
{
uint32 index;
uint32 count;
count = list->size();
for(index = 0; index < count; index++)
{
PlaylistItem* item = (*list)[index];
length = sizeof(path);
if(IsError(URLToFilePath(item->URL().c_str(), path, &length)))
fprintf(fp, "%s%s", item->URL().c_str(), LINE_END_MARKER_STR);
else
fprintf(fp, "%s%s", path, LINE_END_MARKER_STR);
}
fclose(fp);
result = kError_NoErr;
}
else
{
int err = errno;
switch(err)
{
case EACCES:
result = kError_FileNoAccess;
break;
case EEXIST:
result = kError_FileNoAccess;
break;
case EINVAL:
result = kError_FileNoAccess;
break;
case ENOENT:
result = kError_FileNoAccess;
break;
}
}
}
}
return result;
}