本文整理汇总了C++中nsACString::AssignASCII方法的典型用法代码示例。如果您正苦于以下问题:C++ nsACString::AssignASCII方法的具体用法?C++ nsACString::AssignASCII怎么用?C++ nsACString::AssignASCII使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsACString
的用法示例。
在下文中一共展示了nsACString::AssignASCII方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
ThreadStackHelper::GetStack(HangStack& aStack, nsACString& aRunnableName, bool aStackWalk)
{
aRunnableName.AssignLiteral("???");
if (!PrepareStackBuffer(aStack)) {
return;
}
Array<char, nsThread::kRunnableNameBufSize> runnableName;
runnableName[0] = '\0';
ScopedSetPtr<HangStack> _stackGuard(mStackToFill, &aStack);
ScopedSetPtr<Array<char, nsThread::kRunnableNameBufSize>>
_runnableGuard(mRunnableNameBuffer, &runnableName);
// XXX: We don't need to pass in ProfilerFeature::StackWalk to trigger
// stackwalking, as that is instead controlled by the last argument.
profiler_suspend_and_sample_thread(
mThreadId, ProfilerFeature::Privacy, *this, aStackWalk);
// Copy the name buffer allocation into the output string. We explicitly set
// the last byte to null in case we read in some corrupted data without a null
// terminator.
runnableName[nsThread::kRunnableNameBufSize - 1] = '\0';
aRunnableName.AssignASCII(runnableName.cbegin());
}
示例2: SetProxyResult
static void SetProxyResult(const char* aType, const nsACString& aHostPort,
nsACString& aResult)
{
aResult.AssignASCII(aType);
aResult.Append(' ');
aResult.Append(aHostPort);
}
示例3:
NS_IMETHODIMP
nsMediaSniffer::GetMIMETypeFromContent(nsIRequest* aRequest,
const uint8_t* aData,
const uint32_t aLength,
nsACString& aSniffedType)
{
// For media, we want to sniff only if the Content-Type is unknown, or if it
// is application/octet-stream.
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
if (channel) {
nsAutoCString contentType;
nsresult rv = channel->GetContentType(contentType);
NS_ENSURE_SUCCESS(rv, rv);
if (!contentType.IsEmpty() &&
!contentType.EqualsLiteral(APPLICATION_OCTET_STREAM) &&
!contentType.EqualsLiteral(UNKNOWN_CONTENT_TYPE)) {
return NS_ERROR_NOT_AVAILABLE;
}
}
const uint32_t clampedLength = std::min(aLength, MAX_BYTES_SNIFFED);
for (uint32_t i = 0; i < mozilla::ArrayLength(sSnifferEntries); ++i) {
const nsMediaSnifferEntry& currentEntry = sSnifferEntries[i];
if (clampedLength < currentEntry.mLength || currentEntry.mLength == 0) {
continue;
}
bool matched = true;
for (uint32_t j = 0; j < currentEntry.mLength; ++j) {
if ((currentEntry.mMask[j] & aData[j]) != currentEntry.mPattern[j]) {
matched = false;
break;
}
}
if (matched) {
aSniffedType.AssignASCII(currentEntry.mContentType);
return NS_OK;
}
}
if (MatchesMP4(aData, clampedLength)) {
aSniffedType.AssignLiteral(VIDEO_MP4);
return NS_OK;
}
if (MatchesWebM(aData, clampedLength)) {
aSniffedType.AssignLiteral(VIDEO_WEBM);
return NS_OK;
}
if (MatchesMP3(aData, clampedLength)) {
aSniffedType.AssignLiteral(AUDIO_MP3);
return NS_OK;
}
// Could not sniff the media type, we are required to set it to
// application/octet-stream.
aSniffedType.AssignLiteral(APPLICATION_OCTET_STREAM);
return NS_ERROR_NOT_AVAILABLE;
}
示例4: GetName
NS_DECL_ISUPPORTS
NS_IMETHOD GetName(nsACString& aName)
{
aName.AssignASCII("dom-memory-file-data-owner");
return NS_OK;
}
示例5: SetProxyResult
static void SetProxyResult(const char* aType, const nsACString& aHost,
PRInt32 aPort, nsACString& aResult)
{
aResult.AssignASCII(aType);
aResult.Append(' ');
aResult.Append(aHost);
aResult.Append(':');
aResult.Append(nsPrintfCString("%d", aPort));
}
示例6: SetProxyResultDirect
static void SetProxyResultDirect(nsACString& aResult)
{
// For whatever reason, a proxy is not to be used.
aResult.AssignASCII("DIRECT");
}
示例7:
NS_IMETHODIMP
DecoderDoctorDocumentWatcher::GetName(nsACString& aName)
{
aName.AssignASCII("DecoderDoctorDocumentWatcher_timer");
return NS_OK;
}