本文整理汇总了C++中nsAttrValue::GetAtomValue方法的典型用法代码示例。如果您正苦于以下问题:C++ nsAttrValue::GetAtomValue方法的具体用法?C++ nsAttrValue::GetAtomValue怎么用?C++ nsAttrValue::GetAtomValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsAttrValue
的用法示例。
在下文中一共展示了nsAttrValue::GetAtomValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseAttribute
bool
nsStyledElementNotElementCSSInlineStyle::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::style) {
SetMayHaveStyle();
ParseStyleAttribute(aValue, aResult, false);
return true;
}
if (aAttribute == nsGkAtoms::_class) {
SetFlags(NODE_MAY_HAVE_CLASS);
aResult.ParseAtomArray(aValue);
return true;
}
if (aAttribute == nsGkAtoms::id) {
// Store id as an atom. id="" means that the element has no id,
// not that it has an emptystring as the id.
RemoveFromIdTable();
if (aValue.IsEmpty()) {
ClearHasID();
return false;
}
aResult.ParseAtom(aValue);
SetHasID();
AddToIdTable(aResult.GetAtomValue());
return true;
}
}
return nsStyledElementBase::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例2: RemoveFromIdTable
bool
nsXMLElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aAttribute == GetIDAttributeName() &&
aNamespaceID == kNameSpaceID_None) {
// Store id as an atom. id="" means that the element has no id,
// not that it has an emptystring as the id.
RemoveFromIdTable();
if (aValue.IsEmpty()) {
ClearHasID();
return false;
}
aResult.ParseAtom(aValue);
SetHasID();
AddToIdTable(aResult.GetAtomValue());
return true;
}
return false;
}
示例3: switch
void
nsAttrValue::SetTo(const nsAttrValue& aOther)
{
switch (aOther.BaseType()) {
case eStringBase:
{
ResetIfSet();
nsStringBuffer* str = static_cast<nsStringBuffer*>(aOther.GetPtr());
if (str) {
str->AddRef();
SetPtrValueAndType(str, eStringBase);
}
#ifdef TAINTED
if(aOther.isTainted()==1){
mTainted=1;
mJSStr=aOther.mJSStr;
}
#endif
return;
}
case eOtherBase:
{
break;
}
case eAtomBase:
{
ResetIfSet();
nsIAtom* atom = aOther.GetAtomValue();
NS_ADDREF(atom);
SetPtrValueAndType(atom, eAtomBase);
return;
}
case eIntegerBase:
{
ResetIfSet();
mBits = aOther.mBits;
return;
}
}
MiscContainer* otherCont = aOther.GetMiscContainer();
if (!EnsureEmptyMiscContainer()) {
return;
}
MiscContainer* cont = GetMiscContainer();
switch (otherCont->mType) {
case eInteger:
{
cont->mInteger = otherCont->mInteger;
break;
}
case eEnum:
{
cont->mEnumValue = otherCont->mEnumValue;
break;
}
case ePercent:
{
cont->mPercent = otherCont->mPercent;
break;
}
case eColor:
{
cont->mColor = otherCont->mColor;
break;
}
case eCSSStyleRule:
{
NS_ADDREF(cont->mCSSStyleRule = otherCont->mCSSStyleRule);
break;
}
case eAtomArray:
{
if (!EnsureEmptyAtomArray() ||
!GetAtomArrayValue()->AppendElements(*otherCont->mAtomArray)) {
Reset();
return;
}
break;
}
case eSVGValue:
{
NS_ADDREF(cont->mSVGValue = otherCont->mSVGValue);
break;
}
case eDoubleValue:
{
cont->mDoubleValue = otherCont->mDoubleValue;
break;
}
case eIntMarginValue:
{
if (otherCont->mIntMargin)
cont->mIntMargin = new nsIntMargin(*otherCont->mIntMargin);
break;
}
default:
{
//.........这里部分代码省略.........
示例4: ClearMiscContainer
void
nsAttrValue::SetTo(const nsAttrValue& aOther)
{
if (this == &aOther) {
return;
}
switch (aOther.BaseType()) {
case eStringBase:
{
ResetIfSet();
nsStringBuffer* str = static_cast<nsStringBuffer*>(aOther.GetPtr());
if (str) {
str->AddRef();
SetPtrValueAndType(str, eStringBase);
}
return;
}
case eOtherBase:
{
break;
}
case eAtomBase:
{
ResetIfSet();
nsIAtom* atom = aOther.GetAtomValue();
NS_ADDREF(atom);
SetPtrValueAndType(atom, eAtomBase);
return;
}
case eIntegerBase:
{
ResetIfSet();
mBits = aOther.mBits;
return;
}
}
MiscContainer* otherCont = aOther.GetMiscContainer();
if (otherCont->IsRefCounted()) {
delete ClearMiscContainer();
NS_ADDREF(otherCont);
SetPtrValueAndType(otherCont, eOtherBase);
return;
}
MiscContainer* cont = EnsureEmptyMiscContainer();
switch (otherCont->mType) {
case eInteger:
{
cont->mValue.mInteger = otherCont->mValue.mInteger;
break;
}
case eEnum:
{
cont->mValue.mEnumValue = otherCont->mValue.mEnumValue;
break;
}
case ePercent:
{
cont->mValue.mPercent = otherCont->mValue.mPercent;
break;
}
case eColor:
{
cont->mValue.mColor = otherCont->mValue.mColor;
break;
}
case eCSSStyleRule:
{
MOZ_CRASH("These should be refcounted!");
}
case eURL:
{
NS_ADDREF(cont->mValue.mURL = otherCont->mValue.mURL);
break;
}
case eImage:
{
NS_ADDREF(cont->mValue.mImage = otherCont->mValue.mImage);
break;
}
case eAtomArray:
{
if (!EnsureEmptyAtomArray() ||
!GetAtomArrayValue()->AppendElements(*otherCont->mValue.mAtomArray)) {
Reset();
return;
}
break;
}
case eDoubleValue:
{
cont->mDoubleValue = otherCont->mDoubleValue;
break;
}
case eIntMarginValue:
{
if (otherCont->mValue.mIntMargin)
cont->mValue.mIntMargin =
//.........这里部分代码省略.........
示例5: switch
void
nsAttrValue::SetTo(const nsAttrValue& aOther)
{
switch (aOther.BaseType()) {
case eStringBase:
{
ResetIfSet();
nsStringBuffer* str = static_cast<nsStringBuffer*>(aOther.GetPtr());
if (str) {
str->AddRef();
SetPtrValueAndType(str, eStringBase);
}
return;
}
case eOtherBase:
{
break;
}
case eAtomBase:
{
ResetIfSet();
nsIAtom* atom = aOther.GetAtomValue();
NS_ADDREF(atom);
SetPtrValueAndType(atom, eAtomBase);
return;
}
case eIntegerBase:
{
ResetIfSet();
mBits = aOther.mBits;
return;
}
}
MiscContainer* otherCont = aOther.GetMiscContainer();
switch (otherCont->mType) {
case eColor:
{
if (EnsureEmptyMiscContainer()) {
MiscContainer* cont = GetMiscContainer();
cont->mColor = otherCont->mColor;
cont->mType = eColor;
}
break;
}
case eCSSStyleRule:
{
SetTo(otherCont->mCSSStyleRule);
break;
}
case eAtomArray:
{
if (!EnsureEmptyAtomArray() ||
!GetAtomArrayValue()->AppendObjects(*otherCont->mAtomArray)) {
Reset();
}
break;
}
#ifdef MOZ_SVG
case eSVGValue:
{
SetTo(otherCont->mSVGValue);
}
#endif
default:
{
NS_NOTREACHED("unknown type stored in MiscContainer");
break;
}
}
}