本文整理汇总了C++中nsAttrValue::BaseType方法的典型用法代码示例。如果您正苦于以下问题:C++ nsAttrValue::BaseType方法的具体用法?C++ nsAttrValue::BaseType怎么用?C++ nsAttrValue::BaseType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsAttrValue
的用法示例。
在下文中一共展示了nsAttrValue::BaseType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetStringValue
PRBool
nsAttrValue::Equals(const nsAttrValue& aOther) const
{
if (BaseType() != aOther.BaseType()) {
return PR_FALSE;
}
switch(BaseType()) {
case eStringBase:
{
return GetStringValue().Equals(aOther.GetStringValue());
}
case eOtherBase:
{
break;
}
case eAtomBase:
case eIntegerBase:
{
return mBits == aOther.mBits;
}
}
MiscContainer* thisCont = GetMiscContainer();
MiscContainer* otherCont = aOther.GetMiscContainer();
if (thisCont->mType != otherCont->mType) {
return PR_FALSE;
}
PRBool needsStringComparison = PR_FALSE;
switch (thisCont->mType) {
case eInteger:
{
if (thisCont->mInteger == otherCont->mInteger) {
needsStringComparison = PR_TRUE;
}
break;
}
case eEnum:
{
if (thisCont->mEnumValue == otherCont->mEnumValue) {
needsStringComparison = PR_TRUE;
}
break;
}
case ePercent:
{
if (thisCont->mPercent == otherCont->mPercent) {
needsStringComparison = PR_TRUE;
}
break;
}
case eColor:
{
if (thisCont->mColor == otherCont->mColor) {
needsStringComparison = PR_TRUE;
}
break;
}
case eCSSStyleRule:
{
return thisCont->mCSSStyleRule == otherCont->mCSSStyleRule;
}
case eAtomArray:
{
// For classlists we could be insensitive to order, however
// classlists are never mapped attributes so they are never compared.
if (!(*thisCont->mAtomArray == *otherCont->mAtomArray)) {
return PR_FALSE;
}
needsStringComparison = PR_TRUE;
break;
}
case eSVGValue:
{
return thisCont->mSVGValue == otherCont->mSVGValue;
}
case eDoubleValue:
{
return thisCont->mDoubleValue == otherCont->mDoubleValue;
}
case eIntMarginValue:
{
return thisCont->mIntMargin == otherCont->mIntMargin;
}
default:
{
NS_NOTREACHED("unknown type stored in MiscContainer");
return PR_FALSE;
}
}
if (needsStringComparison) {
if (thisCont->mStringBits == otherCont->mStringBits) {
return PR_TRUE;
}
if ((static_cast<ValueBaseType>(thisCont->mStringBits & NS_ATTRVALUE_BASETYPE_MASK) ==
eStringBase) &&
//.........这里部分代码省略.........
示例2: 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:
{
//.........这里部分代码省略.........
示例3: GetStringValue
bool
nsAttrValue::Equals(const nsAttrValue& aOther) const
{
if (BaseType() != aOther.BaseType()) {
return false;
}
switch(BaseType()) {
case eStringBase:
{
return GetStringValue().Equals(aOther.GetStringValue());
}
case eOtherBase:
{
break;
}
case eAtomBase:
case eIntegerBase:
{
return mBits == aOther.mBits;
}
}
MiscContainer* thisCont = GetMiscContainer();
MiscContainer* otherCont = aOther.GetMiscContainer();
if (thisCont == otherCont) {
return true;
}
if (thisCont->mType != otherCont->mType) {
return false;
}
bool needsStringComparison = false;
switch (thisCont->mType) {
case eInteger:
{
if (thisCont->mValue.mInteger == otherCont->mValue.mInteger) {
needsStringComparison = true;
}
break;
}
case eEnum:
{
if (thisCont->mValue.mEnumValue == otherCont->mValue.mEnumValue) {
needsStringComparison = true;
}
break;
}
case ePercent:
{
if (thisCont->mValue.mPercent == otherCont->mValue.mPercent) {
needsStringComparison = true;
}
break;
}
case eColor:
{
if (thisCont->mValue.mColor == otherCont->mValue.mColor) {
needsStringComparison = true;
}
break;
}
case eCSSStyleRule:
{
return thisCont->mValue.mCSSStyleRule == otherCont->mValue.mCSSStyleRule;
}
case eURL:
{
return thisCont->mValue.mURL == otherCont->mValue.mURL;
}
case eImage:
{
return thisCont->mValue.mImage == otherCont->mValue.mImage;
}
case eAtomArray:
{
// For classlists we could be insensitive to order, however
// classlists are never mapped attributes so they are never compared.
if (!(*thisCont->mValue.mAtomArray == *otherCont->mValue.mAtomArray)) {
return false;
}
needsStringComparison = true;
break;
}
case eDoubleValue:
{
return thisCont->mDoubleValue == otherCont->mDoubleValue;
}
case eIntMarginValue:
{
return thisCont->mValue.mIntMargin == otherCont->mValue.mIntMargin;
}
default:
{
if (IsSVGType(thisCont->mType)) {
// Currently this method is never called for nsAttrValue objects that
//.........这里部分代码省略.........
示例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: GetStringValue
PRBool
nsAttrValue::Equals(const nsAttrValue& aOther) const
{
if (BaseType() != aOther.BaseType()) {
return PR_FALSE;
}
switch(BaseType()) {
case eStringBase:
{
return GetStringValue().Equals(aOther.GetStringValue());
}
case eOtherBase:
{
break;
}
case eAtomBase:
case eIntegerBase:
{
return mBits == aOther.mBits;
}
}
MiscContainer* thisCont = GetMiscContainer();
MiscContainer* otherCont = aOther.GetMiscContainer();
if (thisCont->mType != otherCont->mType) {
return PR_FALSE;
}
switch (thisCont->mType) {
case eColor:
{
return thisCont->mColor == otherCont->mColor;
}
case eCSSStyleRule:
{
return thisCont->mCSSStyleRule == otherCont->mCSSStyleRule;
}
case eAtomArray:
{
// For classlists we could be insensitive to order, however
// classlists are never mapped attributes so they are never compared.
PRInt32 count = thisCont->mAtomArray->Count();
if (count != otherCont->mAtomArray->Count()) {
return PR_FALSE;
}
PRInt32 i;
for (i = 0; i < count; ++i) {
if (thisCont->mAtomArray->ObjectAt(i) !=
otherCont->mAtomArray->ObjectAt(i)) {
return PR_FALSE;
}
}
return PR_TRUE;
}
#ifdef MOZ_SVG
case eSVGValue:
{
return thisCont->mSVGValue == otherCont->mSVGValue;
}
#endif
default:
{
NS_NOTREACHED("unknown type stored in MiscContainer");
return PR_FALSE;
}
}
}
示例6: 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;
}
}
}