本文整理汇总了C++中NPT_String::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ NPT_String::Append方法的具体用法?C++ NPT_String::Append怎么用?C++ NPT_String::Append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NPT_String
的用法示例。
在下文中一共展示了NPT_String::Append方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QueueNextFile
bool CUPnPPlayer::QueueNextFile(const CFileItem& file)
{
CFileItem item(file);
NPT_Reference<CThumbLoader> thumb_loader;
NPT_Reference<PLT_MediaObject> obj;
NPT_String path(file.GetPath().c_str());
NPT_String tmp;
if (file.IsVideoDb())
thumb_loader = NPT_Reference<CThumbLoader>(new CVideoThumbLoader());
else if (item.IsMusicDb())
thumb_loader = NPT_Reference<CThumbLoader>(new CMusicThumbLoader());
obj = BuildObject(item, path, 0, thumb_loader, NULL, CUPnP::GetServer(), UPnPPlayer);
if(!obj.IsNull())
{
NPT_CHECK_LABEL_SEVERE(PLT_Didl::ToDidl(*obj, "", tmp), failed);
tmp.Insert(didl_header, 0);
tmp.Append(didl_footer);
}
NPT_CHECK_LABEL_WARNING(m_control->SetNextAVTransportURI(m_delegate->m_device
, m_delegate->m_instance
, file.GetPath().c_str()
, (const char*)tmp
, m_delegate), failed);
if(!m_delegate->m_resevent.WaitMSec(10000)) goto failed;
NPT_CHECK_LABEL_WARNING(m_delegate->m_resstatus, failed);
return true;
failed:
CLog::Log(LOGERROR, "UPNP: CUPnPPlayer::QueueNextFile - unable to queue file %s", file.GetPath().c_str());
return false;
}
示例2: while
/*----------------------------------------------------------------------
| NPT_Uri::PercentEncode
+---------------------------------------------------------------------*/
NPT_String
NPT_Uri::PercentEncode(const char* str, const char* chars, bool encode_percents)
{
NPT_String encoded;
// check args
if (str == NULL) return encoded;
// reserve at least the size of the current uri
encoded.Reserve(NPT_StringLength(str));
// process each character
char escaped[3];
escaped[0] = '%';
while (unsigned char c = *str++) {
bool encode = false;
if (encode_percents && c == '%') {
encode = true;
} else if (c < ' ' || c > '~') {
encode = true;
} else {
const char* match = chars;
while (*match) {
if (c == *match) {
encode = true;
break;
}
++match;
}
}
if (encode) {
// encode
NPT_ByteToHex(c, &escaped[1], true);
encoded.Append(escaped, 3);
} else {
// no encoding required
encoded += c;
}
}
return encoded;
}
示例3: generateContainerId
NPT_String RootContainer::generateContainerId()
{
static const char ab[] = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
static const NPT_UInt32 ac = sizeof(ab) - 1;
NPT_UInt64 seq = m_seq++;
NPT_UInt64 q;
NPT_UInt64 r;
NPT_String result;
for (;;) {
q = seq / ac;
r = seq - (q * ac);
result.Append(ab + r, 1);
if (q == 0) {
break;
}
seq = q;
}
return result;
}