本文整理汇总了C++中DOMStringImpl::toInt方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMStringImpl::toInt方法的具体用法?C++ DOMStringImpl::toInt怎么用?C++ DOMStringImpl::toInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMStringImpl
的用法示例。
在下文中一共展示了DOMStringImpl::toInt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseAttribute
void HTMLFontElementImpl::parseAttribute(AttributeImpl *attr)
{
switch(attr->id())
{
case ATTR_SIZE:
{
DOMStringImpl* v = attr->val();
if(v) {
const QChar* s = v->s;
int num = v->toInt();
int len = v->l;
while( len && s->isSpace() )
len--,s++;
if ( len && *s == '+' )
num += 3;
int size;
switch (num)
{
case -2:
case 1: size = CSS_VAL_XX_SMALL; break;
case -1:
case 2: size = CSS_VAL_SMALL; break;
case 0: // treat 0 the same as 3, because people
// expect it to be between -1 and +1
case 3: size = CSS_VAL_MEDIUM; break;
case 4: size = CSS_VAL_LARGE; break;
case 5: size = CSS_VAL_X_LARGE; break;
case 6: size = CSS_VAL_XX_LARGE; break;
default:
if (num > 6)
size = CSS_VAL__KHTML_XXX_LARGE;
else
size = CSS_VAL_XX_SMALL;
}
addCSSProperty(CSS_PROP_FONT_SIZE, size);
}
break;
}
case ATTR_COLOR:
addHTMLColor(CSS_PROP_COLOR, attr->value());
break;
case ATTR_FACE:
addCSSProperty(CSS_PROP_FONT_FAMILY, attr->value());
break;
default:
HTMLElementImpl::parseAttribute(attr);
}
}
示例2: attach
// ### make sure we undo what we did during detach
void HTMLHRElementImpl::attach()
{
if (attributes(true /* readonly */)) {
// there are some attributes, lets check
DOMString color = getAttribute(ATTR_COLOR);
DOMStringImpl* si = getAttribute(ATTR_SIZE).implementation();
int _s = si ? si->toInt() : -1;
DOMString n("1");
if (!color.isNull()) {
addCSSProperty(CSS_PROP_BORDER_TOP_STYLE, CSS_VAL_SOLID);
addCSSProperty(CSS_PROP_BORDER_RIGHT_STYLE, CSS_VAL_SOLID);
addCSSProperty(CSS_PROP_BORDER_BOTTOM_STYLE, CSS_VAL_SOLID);
addCSSProperty(CSS_PROP_BORDER_LEFT_STYLE, CSS_VAL_SOLID);
addCSSProperty(CSS_PROP_BORDER_TOP_WIDTH, DOMString("0"));
addCSSLength(CSS_PROP_BORDER_BOTTOM_WIDTH, DOMString(si));
addHTMLColor(CSS_PROP_BORDER_COLOR, color);
}
else {
if (_s > 1 && getAttribute(ATTR_NOSHADE).isNull()) {
addCSSProperty(CSS_PROP_BORDER_BOTTOM_WIDTH, n);
addCSSProperty(CSS_PROP_BORDER_TOP_WIDTH, n);
addCSSProperty(CSS_PROP_BORDER_LEFT_WIDTH, n);
addCSSProperty(CSS_PROP_BORDER_RIGHT_WIDTH, n);
addCSSLength(CSS_PROP_HEIGHT, DOMString(QString::number(_s-2)));
}
else if (_s >= 0) {
addCSSProperty(CSS_PROP_BORDER_TOP_WIDTH, DOMString(QString::number(_s)));
addCSSProperty(CSS_PROP_BORDER_BOTTOM_WIDTH, DOMString("0"));
}
}
if (_s == 0)
addCSSProperty(CSS_PROP_MARGIN_BOTTOM, n);
}
HTMLElementImpl::attach();
}