本文整理汇总了C++中nsAString::AssignLiteral方法的典型用法代码示例。如果您正苦于以下问题:C++ nsAString::AssignLiteral方法的具体用法?C++ nsAString::AssignLiteral怎么用?C++ nsAString::AssignLiteral使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsAString
的用法示例。
在下文中一共展示了nsAString::AssignLiteral方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
void
nsSVGViewBox::GetBaseValueString(nsAString& aValue) const
{
if (mBaseVal.none) {
aValue.AssignLiteral("none");
return;
}
char16_t buf[200];
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
MOZ_UTF16("%g %g %g %g"),
(double)mBaseVal.x, (double)mBaseVal.y,
(double)mBaseVal.width, (double)mBaseVal.height);
aValue.Assign(buf);
}
示例2: GetActionName
NS_IMETHODIMP
ImageAccessible::GetActionName(uint8_t aIndex, nsAString& aName)
{
aName.Truncate();
if (IsDefunct())
return NS_ERROR_FAILURE;
if (IsLongDescIndex(aIndex) && HasLongDesc()) {
aName.AssignLiteral("showlongdesc");
return NS_OK;
}
return LinkableAccessible::GetActionName(aIndex, aName);
}
示例3: IsEditable
void
XULTreeGridCellAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName)
{
aName.Truncate();
if (aIndex != eAction_Click || !mTreeView)
return;
if (mColumn->Cycler()) {
aName.AssignLiteral("cycle");
return;
}
if (mColumn->Type() == dom::TreeColumn_Binding::TYPE_CHECKBOX &&
IsEditable()) {
nsAutoString value;
mTreeView->GetCellValue(mRow, mColumn, value);
if (value.EqualsLiteral("true"))
aName.AssignLiteral("uncheck");
else
aName.AssignLiteral("check");
}
}
示例4: sizeof
void
nsSVGViewBox::GetBaseValueString(nsAString& aValue) const
{
if (mBaseVal.none) {
aValue.AssignLiteral("none");
return;
}
PRUnichar buf[200];
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
NS_LITERAL_STRING("%g %g %g %g").get(),
(double)mBaseVal.x, (double)mBaseVal.y,
(double)mBaseVal.width, (double)mBaseVal.height);
aValue.Assign(buf);
}
示例5: GetActionName
NS_IMETHODIMP
nsHTMLImageAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
{
aName.Truncate();
if (IsDefunct())
return NS_ERROR_FAILURE;
if (IsValidLongDescIndex(aIndex)) {
aName.AssignLiteral("showlongdesc");
return NS_OK;
}
return nsLinkableAccessible::GetActionName(aIndex, aName);
}
示例6:
void
HTMLLinkAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName)
{
aName.Truncate();
if (!IsLinked()) {
HyperTextAccessible::ActionNameAt(aIndex, aName);
return;
}
// Action 0 (default action): Jump to link
if (aIndex == eAction_Jump)
aName.AssignLiteral("jump");
}
示例7: GetHandlerElement
void
nsXBLPrototypeHandler::GetEventType(nsAString& aEvent)
{
nsCOMPtr<nsIContent> handlerElement = GetHandlerElement();
if (!handlerElement) {
aEvent.Truncate();
return;
}
handlerElement->GetAttr(kNameSpaceID_None, nsGkAtoms::event, aEvent);
if (aEvent.IsEmpty() && (mType & NS_HANDLER_TYPE_XUL))
// If no type is specified for a XUL <key> element, let's assume that we're "keypress".
aEvent.AssignLiteral("keypress");
}
示例8: SetDOMStringToNull
NS_IMETHODIMP
SmsRequest::GetError(nsAString& aError)
{
if (!mDone) {
NS_ASSERTION(mError == nsISmsRequestManager::SUCCESS_NO_ERROR,
"There should be no error if the request is still processing!");
SetDOMStringToNull(aError);
return NS_OK;
}
NS_ASSERTION(mError == nsISmsRequestManager::SUCCESS_NO_ERROR ||
mResult == JSVAL_VOID,
"mResult should be void when there is an error!");
switch (mError) {
case nsISmsRequestManager::SUCCESS_NO_ERROR:
SetDOMStringToNull(aError);
break;
case nsISmsRequestManager::NO_SIGNAL_ERROR:
aError.AssignLiteral("NoSignalError");
break;
case nsISmsRequestManager::NOT_FOUND_ERROR:
aError.AssignLiteral("NotFoundError");
break;
case nsISmsRequestManager::UNKNOWN_ERROR:
aError.AssignLiteral("UnknownError");
break;
case nsISmsRequestManager::INTERNAL_ERROR:
aError.AssignLiteral("InternalError");
break;
default:
MOZ_ASSERT(false, "Unknown error value.");
}
return NS_OK;
}
示例9: GetMenuPopupFrame
NS_IMETHODIMP
nsPopupBoxObject::GetPopupState(nsAString& aState)
{
aState.AssignLiteral("closed");
nsMenuPopupFrame *menuPopupFrame = GetMenuPopupFrame();
if (menuPopupFrame) {
switch (menuPopupFrame->PopupState()) {
case ePopupShowing:
case ePopupOpen:
aState.AssignLiteral("showing");
break;
case ePopupOpenAndVisible:
aState.AssignLiteral("open");
break;
case ePopupHiding:
case ePopupInvisible:
aState.AssignLiteral("hiding");
break;
}
}
return NS_OK;
}
示例10: StringBeginsWith
NS_IMETHODIMP
sbOriginPageImagePropertyInfo::GetCellProperties(const nsAString& aValue,
nsAString& _retval)
{
if(aValue.EqualsLiteral("unknownOrigin") ||
aValue.IsEmpty() ||
aValue.IsVoid()) {
_retval.AssignLiteral("image unknownOrigin");
return NS_OK;
}
if(aValue.EqualsLiteral("webOrigin") ||
StringBeginsWith(aValue, NS_LITERAL_STRING("http://"), CaseInsensitiveCompare) ||
StringBeginsWith(aValue, NS_LITERAL_STRING("https://"), CaseInsensitiveCompare) ||
StringBeginsWith(aValue, NS_LITERAL_STRING("ftp://"), CaseInsensitiveCompare)) {
_retval.AssignLiteral("image webOrigin");
return NS_OK;
}
_retval.AssignLiteral("image");
return NS_OK;
}
示例11: uri
nsresult
Link::GetProtocol(nsAString &_protocol)
{
nsCOMPtr<nsIURI> uri(GetURI());
if (!uri) {
_protocol.AssignLiteral("http");
}
else {
nsAutoCString scheme;
(void)uri->GetScheme(scheme);
CopyASCIItoUTF16(scheme, _protocol);
}
_protocol.Append(PRUnichar(':'));
return NS_OK;
}
示例12:
NS_IMETHODIMP
nsXULTreeItemAccessibleBase::GetActionName(PRUint8 aIndex, nsAString& aName)
{
if (IsDefunct())
return NS_ERROR_FAILURE;
if (aIndex == eAction_Click) {
aName.AssignLiteral("activate");
return NS_OK;
}
if (aIndex == eAction_Expand && IsExpandable()) {
PRBool isContainerOpen;
mTreeView->IsContainerOpen(mRow, &isContainerOpen);
if (isContainerOpen)
aName.AssignLiteral("collapse");
else
aName.AssignLiteral("expand");
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
}
示例13: GetActionName
NS_IMETHODIMP
nsHTMLLinkAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
{
aName.Truncate();
if (!IsLinked())
return nsHyperTextAccessible::GetActionName(aIndex, aName);
// Action 0 (default action): Jump to link
if (aIndex != eAction_Jump)
return NS_ERROR_INVALID_ARG;
aName.AssignLiteral("jump");
return NS_OK;
}
示例14:
NS_IMETHODIMP
CSSNameSpaceRuleImpl::GetCssText(nsAString& aCssText)
{
aCssText.AssignLiteral("@namespace ");
if (mPrefix) {
nsString atomStr;
mPrefix->ToString(atomStr);
aCssText.Append(atomStr);
aCssText.AppendLiteral(" ");
}
aCssText.AppendLiteral("url(");
aCssText.Append(mURLSpec);
aCssText.Append(NS_LITERAL_STRING(");"));
return NS_OK;
}
示例15: switch
NS_IMETHODIMP
IDBTransaction::GetMode(nsAString& aMode)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
switch (mMode) {
case READ_ONLY:
aMode.AssignLiteral("readonly");
break;
case READ_WRITE:
aMode.AssignLiteral("readwrite");
break;
case VERSION_CHANGE:
aMode.AssignLiteral("versionchange");
break;
case MODE_INVALID:
default:
NS_NOTREACHED("Bad mode value!");
return NS_ERROR_UNEXPECTED;
}
return NS_OK;
}