本文整理汇总了C++中VString::EndsWith方法的典型用法代码示例。如果您正苦于以下问题:C++ VString::EndsWith方法的具体用法?C++ VString::EndsWith怎么用?C++ VString::EndsWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VString
的用法示例。
在下文中一共展示了VString::EndsWith方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SwapComment
void VHTMLSyntax::SwapComment( ICodeEditorDocument* inDocument, VString& ioString, bool inComment )
{
if ( inComment )
{
ioString.Insert( CVSTR( "<!--" ), 1 );
ioString += CVSTR( "-->" );
}
else
{
if ( ioString.BeginsWith( CVSTR( "<!--" ) ) )
ioString.Remove( 1, 4 );
if ( ioString.EndsWith( CVSTR( "-->" ) ) )
ioString.Truncate( ioString.GetLength() - 3 );
}
}
示例2: SetFontSize
void VSpanHandler::SetFontSize(const VString& inValue, float inDPI)
{
Real size = 0;
VTextStyle* TheStyle = fStyles->GetData();
if(!TheStyle)
return;
if(inValue.EndsWith("pt", true))
{
VString textsize = inValue;
textsize.Truncate( inValue.GetLength()-2);
size = textsize.GetReal();
//we need convert from format dpi to 72 dpi
#if VERSIONWIN
TheStyle->SetFontSize(floor(size*(inDPI ? inDPI : VSpanTextParser::Get()->GetDPI())/72.0f+0.5f));
#else
TheStyle->SetFontSize(size);
#endif
}
}
示例3: Contains
bool VFolder::Contains( const XBOX::VString& inExtension) const
{
bool found = false;
VArrayString* files = GetContents(FF_NO_FOLDERS);
if (files)
{
VString name;
for (sLONG i = 1; i <= files->GetCount(); ++i)
{
files->GetString(name, i);
if (name.EndsWith(inExtension))
{
found = true;
break;
}
}
delete files;
}
return found;
}
示例4: _HandlePacket
VError VServiceDiscoveryServer::_HandlePacket (VUDPEndPoint *inEndPoint, uBYTE *inPacket, uLONG inPacketSize, uLONG inBufferSize)
{
xbox_assert(inEndPoint != NULL);
xbox_assert(inPacket != NULL);
uLONG numberQuestions, size, i, offset;
VError error;
const uBYTE *p;
VString vString;
std::list<VServiceRecord>::iterator j;
std::map<VString, bool> queriedServices, queriedAddresses;
std::map<VString, bool>::iterator k;
if (inPacketSize < 12)
return VE_SRVR_BONJOUR_MALFORMED_PACKET;
if ((inPacket[2] & 0x80)
|| (inPacket[3] & 0x0f)
|| !(numberQuestions = Bonjour::Read2Bytes(&inPacket[4])))
return VE_OK;
p = &inPacket[12];
for (i = 0; i < numberQuestions; i++) {
uWORD questionType, questionClass;
size = inPacketSize;
if ((error = Bonjour::ParseDNSName(inPacket, &size, p - inPacket, &vString)) != VE_OK)
return error;
p += size;
questionType = Bonjour::Read2Bytes(p);
questionClass = Bonjour::Read2Bytes(p + 2);
p += 4;
if (questionClass != 1)
continue;
if (questionType == Bonjour::kTypePTR) {
if (vString.EndsWith(".local", true)) {
vString.Truncate(vString.GetLength() - 6);
for (j = fServiceRecords.begin(); j != fServiceRecords.end(); j++)
if (j->fServiceName.EqualToString(vString, true)) {
queriedServices[vString] = true;
break;
} else if (vString.EqualToString("_services._dns-sd._udp", true)) {
queriedServices[vString] = true;
break;
}
}
} else if (questionType == Bonjour::kTypeA)
queriedAddresses[vString] = true;
// Ignore all other types of queries.
}
error = VE_OK;
offset = p - inPacket;
for (k = queriedServices.begin(); k != queriedServices.end(); k++)
if (k->first.EqualToString("_services._dns-sd._udp", true))
error = _SendServiceList(inEndPoint, inPacket, inBufferSize, offset);
else
error = _AnswerQuery(inEndPoint, inPacket, inBufferSize, offset, k->first);
// Note that a hostname can have several network address(es).
for (k = queriedAddresses.begin(); k != queriedAddresses.end(); k++)
for (j = fServiceRecords.begin(); j != fServiceRecords.end(); j++)
if (j->fHostName.EqualToString(k->first, false))
error = _SendAddressAnswer(inEndPoint, inPacket, inBufferSize, offset, *j);
return error;
}
示例5: _ParsePacket
//.........这里部分代码省略.........
}
case Bonjour::kTypeAAAA: {
if (dataSize != 16) {
error = VE_SRVR_BONJOUR_MALFORMED_PACKET;
break;
}
for (j = 0; j < pendingRecords.size(); j++)
if (pendingRecords[j].fHasSRV
&& pendingRecords[j].fTarget.EqualToString(name, true)) {
VNetAddress address(*((IP6 *) data));
pendingRecords[j].fServiceRecord.fIPv6Address = address.GetIP(NULL);
pendingRecords[j].fHasAAAA = true;
}
break;
}
case Bonjour::kTypePTR: {
VString notSuffixedName;
notSuffixedName = name;
if (notSuffixedName.EndsWith(".local", true))
notSuffixedName.Truncate(notSuffixedName .GetLength() - 6);
for (j = 0; j < inServiceNames.size(); j++)
if (inServiceNames[j].EqualToString(notSuffixedName, true))
break;
if (j == inServiceNames.size())
break;
size = inPacketSize;
if ((error = Bonjour::ParseDNSName(inPacket, &size , data - inPacket, &vString)) != VE_OK)
break;
if (size != dataSize) {
error = VE_SRVR_BONJOUR_MALFORMED_PACKET;
break;
}
for (j = 0; j < pendingRecords.size(); j++)
if (pendingRecords[j].fServiceRecord.fServiceName.EqualToString(name, true)
&& pendingRecords[j].fServiceRecord.fProviderName.EqualToString(vString, true))
break;
示例6: IsComment
bool VHTMLSyntax::IsComment( ICodeEditorDocument* inDocument, const VString& inString )
{
return inString.BeginsWith( CVSTR( "<!--" ) ) && inString.EndsWith( CVSTR( "-->" ) );
}