本文整理汇总了C++中nsString::ToInteger方法的典型用法代码示例。如果您正苦于以下问题:C++ nsString::ToInteger方法的具体用法?C++ nsString::ToInteger怎么用?C++ nsString::ToInteger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsString
的用法示例。
在下文中一共展示了nsString::ToInteger方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
static void
ParseAlignAttribute(nsString& aValue, eAlign& aAlign, PRInt32& aRowIndex)
{
// by default, the table is centered about the axis
aRowIndex = 0;
aAlign = eAlign_axis;
PRInt32 len = 0;
if (0 == aValue.Find("top")) {
len = 3; // 3 is the length of 'top'
aAlign = eAlign_top;
}
else if (0 == aValue.Find("bottom")) {
len = 6; // 6 is the length of 'bottom'
aAlign = eAlign_bottom;
}
else if (0 == aValue.Find("center")) {
len = 6; // 6 is the length of 'center'
aAlign = eAlign_center;
}
else if (0 == aValue.Find("baseline")) {
len = 8; // 8 is the length of 'baseline'
aAlign = eAlign_baseline;
}
else if (0 == aValue.Find("axis")) {
len = 4; // 4 is the length of 'axis'
aAlign = eAlign_axis;
}
if (len) {
PRInt32 error;
aValue.Cut(0, len); // aValue is not a const here
aRowIndex = aValue.ToInteger(&error);
if (error)
aRowIndex = 0;
}
}
示例2: if
PRBool
LocalSearchDataSource::doIntMatch(nsIRDFInt *aInt,
const nsAString& matchMethod,
const nsString& matchText)
{
nsresult rv;
PRBool found = PR_FALSE;
PRInt32 val;
rv = aInt->GetValue(&val);
if (NS_FAILED(rv)) return PR_FALSE;
PRInt32 error=0;
PRInt32 matchVal = matchText.ToInteger(&error);
if (error != 0) return PR_FALSE;
if (matchMethod.EqualsLiteral("is"))
found = (val == matchVal);
else if (matchMethod.EqualsLiteral("isgreater"))
found = (val > matchVal);
else if (matchMethod.EqualsLiteral("isless"))
found = (val < matchVal);
return found;
}
示例3: ToUnicode
PRInt32 CViewSourceHTML::ToUnicode(const nsString &strNum, PRInt32 radix, PRInt32 fallback)
{
PRInt32 result;
PRInt32 code = strNum.ToInteger(&result, radix);
if (result == NS_OK) {
return code;
}
return fallback;
}
示例4: if
static void
ParseAlignAttribute(nsString& aValue, eAlign& aAlign, int32_t& aRowIndex)
{
// by default, the table is centered about the axis
aRowIndex = 0;
aAlign = eAlign_axis;
int32_t len = 0;
// we only have to remove the leading spaces because
// ToInteger ignores the whitespaces around the number
aValue.CompressWhitespace(true, false);
if (0 == aValue.Find("top")) {
len = 3; // 3 is the length of 'top'
aAlign = eAlign_top;
}
else if (0 == aValue.Find("bottom")) {
len = 6; // 6 is the length of 'bottom'
aAlign = eAlign_bottom;
}
else if (0 == aValue.Find("center")) {
len = 6; // 6 is the length of 'center'
aAlign = eAlign_center;
}
else if (0 == aValue.Find("baseline")) {
len = 8; // 8 is the length of 'baseline'
aAlign = eAlign_baseline;
}
else if (0 == aValue.Find("axis")) {
len = 4; // 4 is the length of 'axis'
aAlign = eAlign_axis;
}
if (len) {
nsresult error;
aValue.Cut(0, len); // aValue is not a const here
aRowIndex = aValue.ToInteger(&error);
if (NS_FAILED(error))
aRowIndex = 0;
}
}