本文整理汇总了C++中nsCAutoString类的典型用法代码示例。如果您正苦于以下问题:C++ nsCAutoString类的具体用法?C++ nsCAutoString怎么用?C++ nsCAutoString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了nsCAutoString类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetFileSystemCharset
//-------------------------------------------------------------------------
void nsFilePicker::GetFileSystemCharset(nsCString & fileSystemCharset)
{
static nsCAutoString aCharset;
nsresult rv;
if (aCharset.Length() < 1) {
nsCOMPtr <nsIPlatformCharset> platformCharset = do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
rv = platformCharset->GetCharset(kPlatformCharsetSel_FileName, aCharset);
NS_ASSERTION(NS_SUCCEEDED(rv), "error getting platform charset");
if (NS_FAILED(rv))
aCharset.AssignLiteral("IBM850");
}
fileSystemCharset = aCharset;
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:17,代码来源:nsFilePicker.cpp
示例2: tempString
/* static */ void
nsBaseWidget::debug_DumpEvent(FILE * aFileOut,
nsIWidget * aWidget,
nsGUIEvent * aGuiEvent,
const nsCAutoString & aWidgetName,
PRInt32 aWindowID)
{
if (aGuiEvent->message == NS_MOUSE_MOVE)
{
if (!debug_GetCachedBoolPref("nglayout.debug.motion_event_dumping"))
return;
}
if (aGuiEvent->message == NS_MOUSE_ENTER ||
aGuiEvent->message == NS_MOUSE_EXIT)
{
if (!debug_GetCachedBoolPref("nglayout.debug.crossing_event_dumping"))
return;
}
if (!debug_GetCachedBoolPref("nglayout.debug.event_dumping"))
return;
NS_LossyConvertUTF16toASCII tempString(debug_GuiEventToString(aGuiEvent).get());
fprintf(aFileOut,
"%4d %-26s widget=%-8p name=%-12s id=%-8p refpt=%d,%d\n",
_GetPrintCount(),
tempString.get(),
(void *) aWidget,
aWidgetName.get(),
(void *) (aWindowID ? aWindowID : 0x0),
aGuiEvent->refPoint.x,
aGuiEvent->refPoint.y);
}
开发者ID:FunkyVerb,项目名称:devtools-window,代码行数:35,代码来源:nsBaseWidget.cpp
示例3: LOG
nsresult
nsUrlClassifierHashCompleterRequest::BuildRequest(nsCAutoString &aRequestBody)
{
LOG(("nsUrlClassifierHashCompleterRequest::BuildRequest [%p]", this));
nsCAutoString body;
for (PRUint32 i = 0; i < mRequests.Length(); i++) {
Request &request = mRequests[i];
body.Append(request.partialHash);
}
aRequestBody.AppendInt(PARTIAL_LENGTH);
aRequestBody.Append(':');
aRequestBody.AppendInt(body.Length());
aRequestBody.Append('\n');
aRequestBody.Append(body);
return NS_OK;
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:19,代码来源:nsUrlClassifierHashCompleter.cpp
示例4: fprintf
/* static */ void
nsBaseWidget::debug_DumpInvalidate(FILE * aFileOut,
nsIWidget * aWidget,
const nsIntRect * aRect,
bool aIsSynchronous,
const nsCAutoString & aWidgetName,
PRInt32 aWindowID)
{
if (!debug_GetCachedBoolPref("nglayout.debug.invalidate_dumping"))
return;
NS_ASSERTION(nsnull != aFileOut,"cmon, null output FILE");
NS_ASSERTION(nsnull != aWidget,"cmon, the widget is null");
fprintf(aFileOut,
"%4d Invalidate widget=%p name=%-12s id=%-8p",
_GetPrintCount(),
(void *) aWidget,
aWidgetName.get(),
(void *) aWindowID);
if (aRect)
{
fprintf(aFileOut,
" rect=%3d,%-3d %3d,%-3d",
aRect->x,
aRect->y,
aRect->width,
aRect->height);
}
else
{
fprintf(aFileOut,
" rect=%-15s",
"none");
}
fprintf(aFileOut,
" sync=%s",
(const char *) (aIsSynchronous ? "yes" : "no "));
fprintf(aFileOut,"\n");
}
开发者ID:vingtetun,项目名称:mozilla-central,代码行数:43,代码来源:nsBaseWidget.cpp
示例5: canonicalizeBase
static inline bool
canonicalizeBase(nsCAutoString &spec,
nsACString &out,
mozilla::Omnijar::Type aType)
{
nsCAutoString base;
nsresult rv = mozilla::Omnijar::GetURIString(aType, base);
if (NS_FAILED(rv) || !base.Length())
return false;
if (base.Compare(spec.get(), false, base.Length()))
return false;
out.Append("/resource/");
out.Append(baseName[aType]);
out.Append(Substring(spec, base.Length()));
return true;
}
开发者ID:mbuttu,项目名称:mozilla-central,代码行数:19,代码来源:StartupCacheUtils.cpp
示例6: printf
/**
Parses e.g. "a(href,title)" (but not several tags at once).
*/
nsresult
mozSanitizingHTMLSerializer::ParseTagPref(const nsCAutoString& tagpref)
{
nsIParserService* parserService = nsContentUtils::GetParserService();
if (!parserService)
return NS_ERROR_OUT_OF_MEMORY;
// Parsing tag
PRInt32 bracket = tagpref.FindChar('(');
if (bracket == 0)
{
printf(" malformed pref: %s\n", tagpref.get());
return NS_ERROR_CANNOT_CONVERT_DATA;
}
nsAutoString tag;
CopyUTF8toUTF16(StringHead(tagpref, bracket), tag);
// Create key
PRInt32 tag_id = parserService->HTMLStringTagToId(tag);
if (tag_id == eHTMLTag_userdefined)
{
printf(" unknown tag <%s>, won't add.\n",
NS_ConvertUTF16toUTF8(tag).get());
return NS_ERROR_CANNOT_CONVERT_DATA;
}
nsPRUint32Key tag_key(tag_id);
if (mAllowedTags.Exists(&tag_key))
{
printf(" duplicate tag: %s\n", NS_ConvertUTF16toUTF8(tag).get());
return NS_ERROR_CANNOT_CONVERT_DATA;
}
if (bracket == kNotFound)
/* There are no attributes in the pref. So, allow none; only the tag
itself */
{
mAllowedTags.Put(&tag_key, 0);
}
else
{
// Attributes
// where is the macro for non-fatal errors in opt builds?
if(tagpref[tagpref.Length() - 1] != ')' ||
tagpref.Length() < PRUint32(bracket) + 3)
{
printf(" malformed pref: %s\n", tagpref.get());
return NS_ERROR_CANNOT_CONVERT_DATA;
}
nsCOMPtr<nsIProperties> attr_bag =
do_CreateInstance(NS_PROPERTIES_CONTRACTID);
NS_ENSURE_TRUE(attr_bag, NS_ERROR_INVALID_POINTER);
nsCAutoString attrList;
attrList.Append(Substring(tagpref,
bracket + 1,
tagpref.Length() - 2 - bracket));
char* attrs_lasts;
for (char* iAttr = PL_strtok_r(attrList.BeginWriting(),
",", &attrs_lasts);
iAttr;
iAttr = PL_strtok_r(NULL, ",", &attrs_lasts))
{
attr_bag->Set(iAttr, 0);
}
nsIProperties* attr_bag_raw = attr_bag;
NS_ADDREF(attr_bag_raw);
mAllowedTags.Put(&tag_key, attr_bag_raw);
}
return NS_OK;
}
开发者ID:anuragbhatnagar,项目名称:mozilla-central,代码行数:76,代码来源:mozSanitizingSerializer.cpp
示例7: PrintError
void nsTestLog::PrintError(char * aCall, char * aMessage)
{
const char * trace = mTrace.get();
printf("ERROR at %s%s reason: %s.\n", trace, aCall, aMessage);
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:5,代码来源:TestUConv.cpp
示例8: DelTrace
void nsTestLog::DelTrace(char * aTrace)
{
mTrace.Truncate(mTrace.Length() - strlen(aTrace) - strlen(kTraceDelimiter));
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:4,代码来源:TestUConv.cpp
示例9: AddTrace
void nsTestLog::AddTrace(char * aTrace)
{
mTrace.Append(aTrace);
mTrace.Append(kTraceDelimiter);
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:5,代码来源:TestUConv.cpp
注:本文中的nsCAutoString类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论