本文整理汇总了C++中NPT_List::Remove方法的典型用法代码示例。如果您正苦于以下问题:C++ NPT_List::Remove方法的具体用法?C++ NPT_List::Remove怎么用?C++ NPT_List::Remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NPT_List
的用法示例。
在下文中一共展示了NPT_List::Remove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UnregisterUserdata
void CUPnP::UnregisterUserdata(void* ptr)
{
NPT_AutoLock lock(g_UserDataLock);
g_UserData.Remove(ptr);
}
示例2: while
/*----------------------------------------------------------------------
| PLT_FileMediaServer::BuildFromFilePath
+---------------------------------------------------------------------*/
PLT_MediaObject*
PLT_FileMediaServer::BuildFromFilePath(const NPT_String& filepath,
bool with_count /* = true */,
NPT_SocketInfo* info /* = NULL */,
bool keep_extension_in_title /* = false */)
{
NPT_String delimiter = m_DirDelimiter;
NPT_String root = m_Path;
PLT_MediaItemResource resource;
PLT_MediaObject* object = NULL;
int dir_delim_index;
/* make sure this is a valid entry */
/* and retrieve the entry type (directory or file) */
NPT_DirectoryEntryInfo entry_info;
if (!ProceedWithEntry(filepath, entry_info)) goto failure;
/* find the last directory delimiter */
dir_delim_index = filepath.ReverseFind(delimiter);
if (dir_delim_index < 0) goto failure;
if (entry_info.type == NPT_FILE_TYPE) {
object = new PLT_MediaItem();
/* we need a valid extension to retrieve the mimetype for the protocol info */
int ext_index = filepath.ReverseFind('.');
if (ext_index <= 0 || ext_index < dir_delim_index) {
ext_index = filepath.GetLength();
}
/* Set the title using the filename for now */
object->m_Title = filepath.SubString(dir_delim_index+1,
keep_extension_in_title?filepath.GetLength():ext_index - dir_delim_index -1);
if (object->m_Title.GetLength() == 0) goto failure;
/* Set the protocol Info from the extension */
const char* ext = ((const char*)filepath) + ext_index;
resource.m_ProtocolInfo = PLT_MediaItem::GetProtInfoFromExt(ext);
if (resource.m_ProtocolInfo.GetLength() == 0) goto failure;
/* Set the resource file size */
resource.m_Size = entry_info.size;
/* format the resource URI */
NPT_String url = filepath.SubString(root.GetLength());
// get list of ip addresses
NPT_List<NPT_String> ips;
NPT_CHECK_LABEL_SEVERE(PLT_UPnPMessageHelper::GetIPAddresses(ips), failure);
// if we're passed an interface where we received the request from
// move the ip to the top
if (info && info->local_address.GetIpAddress().ToString() != "0.0.0.0") {
ips.Remove(info->local_address.GetIpAddress().ToString());
ips.Insert(ips.GetFirstItem(), info->local_address.GetIpAddress().ToString());
}
// iterate through list and build list of resources
NPT_List<NPT_String>::Iterator ip = ips.GetFirstItem();
while (ip) {
NPT_HttpUrl uri = m_FileBaseUri;
NPT_HttpUrlQuery query;
query.AddField("path", url);
uri.SetHost(*ip);
uri.SetQuery(query.ToString());
//uri.SetPath(uri.GetPath() + url);
/* prepend the base URI and url encode it */
//resource.m_Uri = NPT_Uri::Encode(uri.ToString(), NPT_Uri::UnsafeCharsToEncode);
resource.m_Uri = uri.ToString();
/* Look to see if a metadatahandler exists for this extension */
PLT_MetadataHandler* handler = NULL;
NPT_Result res = NPT_ContainerFind(m_MetadataHandlers, PLT_MetadataHandlerFinder(ext), handler);
if (NPT_SUCCEEDED(res) && handler) {
/* if it failed loading data, reset the metadatahandler so we don't use it */
if (NPT_SUCCEEDED(handler->LoadFile(filepath))) {
/* replace the title with the one from the Metadata */
NPT_String newTitle;
if (handler->GetTitle(newTitle) != NULL) {
object->m_Title = newTitle;
}
/* assign description */
handler->GetDescription(object->m_Description.long_description);
/* assign album art uri if we haven't yet */
/* prepend the album art base URI and url encode it */
if (object->m_ExtraInfo.album_art_uri.GetLength() == 0) {
NPT_HttpUrl uri = m_AlbumArtBaseUri;
NPT_HttpUrlQuery query;
query.AddField("path", url);
uri.SetHost(*ip);
uri.SetQuery(query.ToString());
//uri.SetPath(uri.GetPath() + url);
object->m_ExtraInfo.album_art_uri = NPT_Uri::PercentEncode(uri.ToString(), NPT_Uri::UnsafeCharsToEncode);
//.........这里部分代码省略.........