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


C++ Handle::isBoolean方法代码示例

本文整理汇总了C++中js::Handle::isBoolean方法的典型用法代码示例。如果您正苦于以下问题:C++ Handle::isBoolean方法的具体用法?C++ Handle::isBoolean怎么用?C++ Handle::isBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在js::Handle的用法示例。


在下文中一共展示了Handle::isBoolean方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetAGpsDataConn

NS_IMETHODIMP
GonkGPSGeolocationProvider::Handle(const nsAString& aName,
                                   JS::Handle<JS::Value> aResult)
{
#ifdef MOZ_B2G_RIL
  if (aName.EqualsLiteral("ril.supl.apn")) {
    // When we get the APN, we attempt to call data_call_open of AGPS.
    if (aResult.isString()) {
      JSContext *cx = nsContentUtils::GetCurrentJSContext();
      NS_ENSURE_TRUE(cx, NS_OK);

      // NB: No need to enter a compartment to read the contents of a string.
      nsAutoJSString apn;
      if (!apn.init(cx, aResult.toString())) {
        return NS_ERROR_FAILURE;
      }
      if (!apn.IsEmpty()) {
        SetAGpsDataConn(apn);
      }
    }
  } else
#endif // MOZ_B2G_RIL
  if (aName.EqualsASCII(kSettingDebugGpsIgnored)) {
    gDebug_isGPSLocationIgnored = aResult.isBoolean() ? aResult.toBoolean() : false;
    if (gDebug_isLoggingEnabled) {
      nsContentUtils::LogMessageToConsole("geo: Debug: GPS ignored %d\n", gDebug_isGPSLocationIgnored);
    }
    return NS_OK;
  } else if (aName.EqualsASCII(kSettingDebugEnabled)) {
    gDebug_isLoggingEnabled = aResult.isBoolean() ? aResult.toBoolean() : false;
    return NS_OK;
  }
  return NS_OK;
}
开发者ID:L2-D2,项目名称:gecko-dev,代码行数:34,代码来源:GonkGPSGeolocationProvider.cpp

示例2: SetAGpsDataConn

NS_IMETHODIMP
GonkGPSGeolocationProvider::Handle(const nsAString& aName,
                                   JS::Handle<JS::Value> aResult)
{
#ifdef MOZ_B2G_RIL
  if (aName.EqualsLiteral("ril.supl.apn")) {
    // When we get the APN, we attempt to call data_call_open of AGPS.
    if (aResult.isString()) {
      JSContext *cx = nsContentUtils::GetCurrentJSContext();
      NS_ENSURE_TRUE(cx, NS_OK);

      // NB: No need to enter a compartment to read the contents of a string.
      nsAutoJSString apn;
      if (!apn.init(cx, aResult.toString())) {
        return NS_ERROR_FAILURE;
      }
      if (!apn.IsEmpty()) {
        SetAGpsDataConn(apn);
      }
    }
  } else
#endif // MOZ_B2G_RIL
  if (aName.EqualsLiteral(SETTING_DEBUG_ENABLED)) {
    gGPSDebugging = aResult.isBoolean() ? aResult.toBoolean() : false;
    return NS_OK;
  }
  return NS_OK;
}
开发者ID:aknow,项目名称:gecko-dev,代码行数:28,代码来源:GonkGPSGeolocationProvider.cpp

示例3:

NS_IMETHODIMP
SmsFilter::SetRead(JSContext* aCx, JS::Handle<JS::Value> aRead)
{
  if (aRead.isNull()) {
    mData.read() = eReadState_Unknown;
    return NS_OK;
  }

  if (!aRead.isBoolean()) {
    return NS_ERROR_INVALID_ARG;
  }

  mData.read() = aRead.toBoolean() ? eReadState_Read : eReadState_Unread;
  return NS_OK;
}
开发者ID:jp111,项目名称:gecko-dev,代码行数:15,代码来源:SmsFilter.cpp

示例4: Handle

  NS_DECL_ISUPPORTS

  NS_IMETHOD Handle(const nsAString& aName, JS::Handle<JS::Value> aResult)
  {
    MOZ_ASSERT(NS_IsMainThread());

    if (!aResult.isBoolean()) {
      BT_WARNING("Setting for '" BLUETOOTH_ENABLED_SETTING "' is not a boolean!");
      return NS_OK;
    }

    // It is theoretically possible to shut down before the first settings check
    // has completed (though extremely unlikely).
    if (sBluetoothService) {
      return sBluetoothService->HandleStartupSettingsCheck(aResult.toBoolean());
    }

    return NS_OK;
  }
开发者ID:arroway,项目名称:gecko-dev,代码行数:19,代码来源:BluetoothService.cpp


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