本文整理汇总了C++中nsAttrValue::ParseEnumValue方法的典型用法代码示例。如果您正苦于以下问题:C++ nsAttrValue::ParseEnumValue方法的具体用法?C++ nsAttrValue::ParseEnumValue怎么用?C++ nsAttrValue::ParseEnumValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsAttrValue
的用法示例。
在下文中一共展示了nsAttrValue::ParseEnumValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseAttribute
bool
HTMLMenuItemElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::type) {
bool success = aResult.ParseEnumValue(aValue, kMenuItemTypeTable,
false);
if (success) {
mType = aResult.GetEnumValue();
} else {
mType = kMenuItemDefaultType->value;
}
return success;
}
if (aAttribute == nsGkAtoms::radiogroup) {
aResult.ParseAtom(aValue);
return true;
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例2: tmp
PRBool
nsHTMLFontElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::size) {
nsAutoString tmp(aValue);
tmp.CompressWhitespace(PR_TRUE, PR_TRUE);
PRUnichar ch = tmp.IsEmpty() ? 0 : tmp.First();
if ((ch == '+' || ch == '-') &&
aResult.ParseEnumValue(aValue, kRelFontSizeTable)) {
return PR_TRUE;
}
return aResult.ParseIntValue(aValue);
}
if (aAttribute == nsGkAtoms::pointSize ||
aAttribute == nsGkAtoms::fontWeight) {
return aResult.ParseIntValue(aValue);
}
if (aAttribute == nsGkAtoms::color) {
return aResult.ParseColor(aValue, GetOwnerDoc());
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例3: ParseAttribute
bool
HTMLTrackElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
// Map html attribute string values to TextTrackKind enums.
static const nsAttrValue::EnumTable kKindTable[] = {
{ "subtitles", static_cast<int16_t>(TextTrackKind::Subtitles) },
{ "captions", static_cast<int16_t>(TextTrackKind::Captions) },
{ "descriptions", static_cast<int16_t>(TextTrackKind::Descriptions) },
{ "chapters", static_cast<int16_t>(TextTrackKind::Chapters) },
{ "metadata", static_cast<int16_t>(TextTrackKind::Metadata) },
{ 0 }
};
if (aNamespaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::kind) {
// Case-insensitive lookup, with the first element as the default.
return aResult.ParseEnumValue(aValue, kKindTable, false, kKindTable);
}
// Otherwise call the generic implementation.
return nsGenericHTMLElement::ParseAttribute(aNamespaceID,
aAttribute,
aValue,
aResult);
}
示例4: SetAdditiveErrorFlag
nsresult
nsSMILAnimationFunction::SetAdditive(const nsAString& aAdditive,
nsAttrValue& aResult)
{
mHasChanged = true;
bool parseResult
= aResult.ParseEnumValue(aAdditive, sAdditiveTable, true);
SetAdditiveErrorFlag(!parseResult);
return parseResult ? NS_OK : NS_ERROR_FAILURE;
}
示例5: SetCalcModeErrorFlag
nsresult
nsSMILAnimationFunction::SetCalcMode(const nsAString& aCalcMode,
nsAttrValue& aResult)
{
mHasChanged = PR_TRUE;
PRBool parseResult
= aResult.ParseEnumValue(aCalcMode, sCalcModeTable, PR_TRUE);
SetCalcModeErrorFlag(!parseResult);
return parseResult ? NS_OK : NS_ERROR_FAILURE;
}
示例6: ParseAttribute
bool
nsHTMLLIElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::type) {
return aResult.ParseEnumValue(aValue, kOrderedListItemTypeTable,
true) ||
aResult.ParseEnumValue(aValue, kUnorderedListItemTypeTable, false);
}
if (aAttribute == nsGkAtoms::value) {
return aResult.ParseIntValue(aValue);
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例7: ParseAttribute
PRBool
nsHTMLLIElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::type) {
return aResult.ParseEnumValue(aValue, kOrderedListItemTypeTable,
PR_TRUE) ||
aResult.ParseEnumValue(aValue, kUnorderedListItemTypeTable, PR_FALSE);
}
if (aAttribute == nsGkAtoms::value) {
return aResult.ParseIntWithBounds(aValue, 0);
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例8: tmp
PRBool
nsHTMLFontElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::size) {
nsAutoString tmp(aValue);
tmp.CompressWhitespace(PR_TRUE, PR_TRUE);
PRUnichar ch = tmp.IsEmpty() ? 0 : tmp.First();
if ((ch == '+' || ch == '-')) {
if (aResult.ParseEnumValue(aValue, kRelFontSizeTable, PR_FALSE))
return PR_TRUE;
// truncate after digit, then parse it again.
PRUint32 i;
for (i = 1; i < tmp.Length(); i++) {
ch = tmp.CharAt(i);
if (!nsCRT::IsAsciiDigit(ch)) {
tmp.Truncate(i);
break;
}
}
return aResult.ParseEnumValue(tmp, kRelFontSizeTable, PR_FALSE);
}
return aResult.ParseIntValue(aValue);
}
if (aAttribute == nsGkAtoms::pointSize ||
aAttribute == nsGkAtoms::fontWeight) {
return aResult.ParseIntValue(aValue);
}
if (aAttribute == nsGkAtoms::color) {
return aResult.ParseColor(aValue);
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例9: ParseAttribute
bool
nsHTMLBRElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aAttribute == nsGkAtoms::clear && aNamespaceID == kNameSpaceID_None) {
return aResult.ParseEnumValue(aValue, kClearTable, false);
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例10: ParseAttribute
bool
nsHTMLLegendElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aAttribute == nsGkAtoms::align && aNamespaceID == kNameSpaceID_None) {
return aResult.ParseEnumValue(aValue, kAlignTable, false);
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例11: ParseAttribute
PRBool
nsHTMLSharedListElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (mNodeInfo->Equals(nsGkAtoms::ol) ||
mNodeInfo->Equals(nsGkAtoms::ul)) {
if (aAttribute == nsGkAtoms::type) {
return aResult.ParseEnumValue(aValue, kListTypeTable, PR_FALSE) ||
aResult.ParseEnumValue(aValue, kOldListTypeTable, PR_TRUE);
}
if (aAttribute == nsGkAtoms::start) {
return aResult.ParseIntValue(aValue);
}
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例12: ParseAttribute
bool HTMLMarqueeElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) {
if (aNamespaceID == kNameSpaceID_None) {
if ((aAttribute == nsGkAtoms::width) || (aAttribute == nsGkAtoms::height)) {
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::bgcolor) {
return aResult.ParseColor(aValue);
}
if (aAttribute == nsGkAtoms::behavior) {
return aResult.ParseEnumValue(aValue, kBehaviorTable, false,
kDefaultBehavior);
}
if (aAttribute == nsGkAtoms::direction) {
return aResult.ParseEnumValue(aValue, kDirectionTable, false,
kDefaultDirection);
}
if ((aAttribute == nsGkAtoms::hspace) ||
(aAttribute == nsGkAtoms::vspace)) {
return aResult.ParseIntWithBounds(aValue, 0);
}
if (aAttribute == nsGkAtoms::loop) {
return aResult.ParseIntValue(aValue);
}
if (aAttribute == nsGkAtoms::scrollamount ||
aAttribute == nsGkAtoms::scrolldelay) {
return aResult.ParseNonNegativeIntValue(aValue);
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aMaybeScriptedPrincipal, aResult);
}
示例13: ParseAttribute
bool
HTMLButtonElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::type) {
return aResult.ParseEnumValue(aValue, kButtonTypeTable, false,
kButtonDefaultType);
}
if (aAttribute == nsGkAtoms::formmethod) {
return aResult.ParseEnumValue(aValue, kFormMethodTable, false);
}
if (aAttribute == nsGkAtoms::formenctype) {
return aResult.ParseEnumValue(aValue, kFormEnctypeTable, false);
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例14: ParseAttribute
bool
HTMLTrackElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::kind) {
// Case-insensitive lookup, with the first element as the default.
return aResult.ParseEnumValue(aValue, kKindTable, false, kKindTable);
}
// Otherwise call the generic implementation.
return nsGenericHTMLElement::ParseAttribute(aNamespaceID,
aAttribute,
aValue,
aResult);
}
示例15: ParseAttribute
bool
nsHTMLSharedElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None &&
mNodeInfo->Equals(nsGkAtoms::dir)) {
if (aAttribute == nsGkAtoms::type) {
return aResult.ParseEnumValue(aValue, kListTypeTable, false);
}
if (aAttribute == nsGkAtoms::start) {
return aResult.ParseIntWithBounds(aValue, 1);
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}