当前位置: 首页>>代码示例>>C++>>正文


C++ nsString::ToInteger方法代码示例

本文整理汇总了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;
  }
}
开发者ID:mozilla,项目名称:mozilla-history,代码行数:35,代码来源:nsMathMLmtableFrame.cpp

示例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;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:25,代码来源:nsLocalSearchService.cpp

示例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;
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:9,代码来源:nsViewSourceHTML.cpp

示例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;
  }
}
开发者ID:multi-sim,项目名称:releases-mozilla-central,代码行数:40,代码来源:nsMathMLmtableFrame.cpp


注:本文中的nsString::ToInteger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。