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


C++ nsAString::EqualsASCII方法代码示例

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


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

示例1:

static bool
IsSupportedAudioCodec(const nsAString& aCodec,
                      bool& aOutContainsAAC,
                      bool& aOutContainsMP3)
{
  // AAC-LC or HE-AAC in M4A.
  aOutContainsAAC = aCodec.EqualsASCII("mp4a.40.2") ||
                    aCodec.EqualsASCII("mp4a.40.5");
  if (aOutContainsAAC) {
#ifdef XP_WIN
    if (!Preferences::GetBool("media.fragmented-mp4.use-blank-decoder") &&
        !WMFDecoderModule::HasAAC()) {
      return false;
    }
#endif
    return true;
  }
#ifndef MOZ_GONK_MEDIACODEC // B2G doesn't support MP3 in MP4 yet.
  aOutContainsMP3 = aCodec.EqualsASCII("mp3");
  if (aOutContainsMP3) {
    return true;
  }
#else
  aOutContainsMP3 = false;
#endif
  return false;
}
开发者ID:Acidburn0zzz,项目名称:tor-browser,代码行数:27,代码来源:MP4Decoder.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.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

示例3: IsVistaOrLater

static bool
IsSupportedKeySystem(const nsAString& aKeySystem)
{
  return aKeySystem.EqualsASCII("org.w3.clearkey") ||
#ifdef XP_WIN
         (aKeySystem.EqualsASCII("com.adobe.access") &&
          IsVistaOrLater() &&
          Preferences::GetBool("media.eme.adobe-access.enabled", false)) ||
#endif
         false;
}
开发者ID:andrenatal,项目名称:gecko-dev,代码行数:11,代码来源:MediaKeys.cpp

示例4: EnsureMinCDMVersion

/* static */
MediaKeySystemStatus
MediaKeySystemAccess::GetKeySystemStatus(const nsAString& aKeySystem,
        int32_t aMinCdmVersion,
        nsACString& aOutMessage,
        nsACString& aOutCdmVersion)
{
    MOZ_ASSERT(MediaPrefs::EMEEnabled() || IsClearkeyKeySystem(aKeySystem));
    nsCOMPtr<mozIGeckoMediaPluginService> mps =
        do_GetService("@mozilla.org/gecko-media-plugin-service;1");
    if (NS_WARN_IF(!mps)) {
        aOutMessage = NS_LITERAL_CSTRING("Failed to get GMP service");
        return MediaKeySystemStatus::Error;
    }

    if (aKeySystem.EqualsASCII(kEMEKeySystemClearkey)) {
        return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion, aOutMessage, aOutCdmVersion);
    }

    if (Preferences::GetBool("media.gmp-eme-adobe.visible", false)) {
        if (aKeySystem.EqualsASCII(kEMEKeySystemPrimetime)) {
            if (!Preferences::GetBool("media.gmp-eme-adobe.enabled", false)) {
                aOutMessage = NS_LITERAL_CSTRING("Adobe EME disabled");
                return MediaKeySystemStatus::Cdm_disabled;
            }
#ifdef XP_WIN
            // Win Vista and later only.
            if (!IsVistaOrLater()) {
                aOutMessage = NS_LITERAL_CSTRING("Minimum Windows version (Vista) not met for Adobe EME");
                return MediaKeySystemStatus::Cdm_not_supported;
            }
#endif
            return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion, aOutMessage, aOutCdmVersion);
        }
    }

    if (Preferences::GetBool("media.gmp-widevinecdm.visible", false)) {
        if (aKeySystem.EqualsASCII(kEMEKeySystemWidevine)) {
#ifdef XP_WIN
            // Win Vista and later only.
            if (!IsVistaOrLater()) {
                aOutMessage = NS_LITERAL_CSTRING("Minimum Windows version (Vista) not met for Widevine EME");
                return MediaKeySystemStatus::Cdm_not_supported;
            }
#endif
            if (!Preferences::GetBool("media.gmp-widevinecdm.enabled", false)) {
                aOutMessage = NS_LITERAL_CSTRING("Widevine EME disabled");
                return MediaKeySystemStatus::Cdm_disabled;
            }
            return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion, aOutMessage, aOutCdmVersion);
        }
    }

    return MediaKeySystemStatus::Cdm_not_supported;
}
开发者ID:cliqz-oss,项目名称:browser-f,代码行数:55,代码来源:MediaKeySystemAccess.cpp

示例5: tokenizer

bool
WMFDecoder::CanPlayType(const nsACString& aType,
                        const nsAString& aCodecs)
{
  if (!MediaDecoder::IsWMFEnabled() ||
      NS_FAILED(LoadDLLs())) {
    return false;
  }

  // Assume that if LoadDLLs() didn't fail, we can playback the types that
  // we know should be supported by Windows Media Foundation.
  if ((aType.EqualsASCII("audio/mpeg") || aType.EqualsASCII("audio/mp3")) &&
      IsMP3Supported()) {
    // Note: We block MP3 playback on Window 7 SP0 since it seems to crash
    // in some circumstances.
    return !aCodecs.Length() || aCodecs.EqualsASCII("mp3");
  }

  // AAC-LC or MP3 in M4A.
  if (aType.EqualsASCII("audio/mp4") || aType.EqualsASCII("audio/x-m4a")) {
    return !aCodecs.Length() ||
           aCodecs.EqualsASCII("mp4a.40.2") ||
           aCodecs.EqualsASCII("mp3");
  }

  if (!aType.EqualsASCII("video/mp4")) {
    return false;
  }

  // H.264 + AAC in MP4. Verify that all the codecs specifed are ones that
  // we expect that we can play.
  nsCharSeparatedTokenizer tokenizer(aCodecs, ',');
  bool expectMoreTokens = false;
  while (tokenizer.hasMoreTokens()) {
    const nsSubstring& token = tokenizer.nextToken();
    expectMoreTokens = tokenizer.separatorAfterCurrentToken();
    if (token.EqualsASCII("mp4a.40.2") || // AAC-LC
        token.EqualsASCII("mp3") ||
        IsSupportedH264Codec(token)) {
      continue;
    }
    return false;
  }
  if (expectMoreTokens) {
    // Last codec name was empty
    return false;
  }
  return true;
}
开发者ID:Balakrishnan-Vivek,项目名称:gecko-dev,代码行数:49,代码来源:WMFDecoder.cpp

示例6: return

/* static */
bool
WaveDecoder::CanHandleMediaType(const nsACString& aType,
                                const nsAString& aCodecs)
{
  if (!IsWaveEnabled()) {
    return false;
  }
  if (aType.EqualsASCII("audio/wave") || aType.EqualsASCII("audio/x-wav") ||
      aType.EqualsASCII("audio/wav")  || aType.EqualsASCII("audio/x-pn-wav")) {
    return (aCodecs.IsEmpty() || aCodecs.EqualsASCII("1") ||
            aCodecs.EqualsASCII("6") || aCodecs.EqualsASCII("7"));
  }

  return false;
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:16,代码来源:WaveDecoder.cpp

示例7:

NS_IMETHODIMP
DataTransfer::SetEffectAllowed(const nsAString& aEffectAllowed)
{
  if (aEffectAllowed.EqualsLiteral("uninitialized")) {
    mEffectAllowed = nsIDragService::DRAGDROP_ACTION_UNINITIALIZED;
    return NS_OK;
  }

  static_assert(nsIDragService::DRAGDROP_ACTION_NONE == 0,
                "DRAGDROP_ACTION_NONE constant is wrong");
  static_assert(nsIDragService::DRAGDROP_ACTION_COPY == 1,
                "DRAGDROP_ACTION_COPY constant is wrong");
  static_assert(nsIDragService::DRAGDROP_ACTION_MOVE == 2,
                "DRAGDROP_ACTION_MOVE constant is wrong");
  static_assert(nsIDragService::DRAGDROP_ACTION_LINK == 4,
                "DRAGDROP_ACTION_LINK constant is wrong");

  for (uint32_t e = 0; e < ArrayLength(sEffects); e++) {
    if (aEffectAllowed.EqualsASCII(sEffects[e])) {
      mEffectAllowed = e;
      break;
    }
  }

  return NS_OK;
}
开发者ID:Mardak,项目名称:tiles-dev,代码行数:26,代码来源:DataTransfer.cpp

示例8: if

nsresult
GonkCameraParameters::MapIsoToGonk(const nsAString& aIso, nsACString& aIsoOut)
{
  if (aIso.EqualsASCII("hjr")) {
    aIsoOut = "ISO_HJR";
  } else if (aIso.EqualsASCII("auto")) {
    aIsoOut = "auto";
  } else {
    nsAutoCString v = NS_LossyConvertUTF16toASCII(aIso);
    unsigned int iso;
    if (sscanf(v.get(), "%u", &iso) != 1) {
      return NS_ERROR_INVALID_ARG;
    }
    aIsoOut = nsPrintfCString("ISO%u", iso);
  }

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

示例9: IsEnabled

/* static */
bool MP3Decoder::CanHandleMediaType(const nsACString& aType,
                                    const nsAString& aCodecs)
{
  if (aType.EqualsASCII("audio/mp3") || aType.EqualsASCII("audio/mpeg")) {
    return IsEnabled() &&
      (aCodecs.IsEmpty() || aCodecs.EqualsASCII("mp3"));
  }
  return false;
}
开发者ID:70599,项目名称:Waterfox,代码行数:10,代码来源:MP3Decoder.cpp

示例10:

static bool
ToSessionType(const nsAString& aSessionType, MediaKeySessionType& aOutType)
{
  using MediaKeySessionTypeValues::strings;
  const char* temporary =
    strings[static_cast<uint32_t>(MediaKeySessionType::Temporary)].value;
  if (aSessionType.EqualsASCII(temporary)) {
    aOutType = MediaKeySessionType::Temporary;
    return true;
  }
  const char* persistentLicense =
    strings[static_cast<uint32_t>(MediaKeySessionType::Persistent_license)].value;
  if (aSessionType.EqualsASCII(persistentLicense)) {
    aOutType = MediaKeySessionType::Persistent_license;
    return true;
  }
  return false;
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:18,代码来源:MediaKeySystemAccess.cpp

示例11: IsEnabled

/* static */ bool
ADTSDecoder::CanHandleMediaType(const nsACString& aType,
                                const nsAString& aCodecs)
{
  if (aType.EqualsASCII("audio/aac") || aType.EqualsASCII("audio/aacp")) {
    return IsEnabled() && (aCodecs.IsEmpty() || aCodecs.EqualsASCII("aac"));
  }

  return false;
}
开发者ID:Danielzac,项目名称:gecko-dev,代码行数:10,代码来源:ADTSDecoder.cpp

示例12:

bool
logging::IsEnabled(const nsAString& aModuleStr)
{
  for (unsigned int idx = 0; idx < ArrayLength(sModuleMap); idx++) {
    if (aModuleStr.EqualsASCII(sModuleMap[idx].mStr))
      return sModules & sModuleMap[idx].mModule;
  }

  return false;
}
开发者ID:EFForg,项目名称:mozilla-central-httpse-tests,代码行数:10,代码来源:Logging.cpp

示例13: ResetIfSet

PRBool
nsAttrValue::ParseEnumValue(const nsAString& aValue,
                            const EnumTable* aTable,
                            PRBool aCaseSensitive,
                            const EnumTable* aDefaultValue)
{
  ResetIfSet();
  const EnumTable* tableEntry = aTable;

  while (tableEntry->tag) {
    if (aCaseSensitive ? aValue.EqualsASCII(tableEntry->tag) :
                         aValue.LowerCaseEqualsASCII(tableEntry->tag)) {
      PRInt32 value = EnumTableEntryToValue(aTable, tableEntry);

      PRBool equals = aCaseSensitive || aValue.EqualsASCII(tableEntry->tag);
      if (!equals) {
        nsAutoString tag;
        tag.AssignASCII(tableEntry->tag);
        ToUpperCase(tag);
        if ((equals = tag.Equals(aValue))) {
          value |= NS_ATTRVALUE_ENUMTABLE_VALUE_NEEDS_TO_UPPER;
        }
      }
      SetIntValueAndType(value, eEnum, equals ? nsnull : &aValue);
      NS_ASSERTION(GetEnumValue() == tableEntry->value,
                   "failed to store enum properly");

      return PR_TRUE;
    }
    tableEntry++;
  }

  if (aDefaultValue) {
    NS_PRECONDITION(aTable <= aDefaultValue && aDefaultValue < tableEntry,
                    "aDefaultValue not inside aTable?");
    SetIntValueAndType(EnumTableEntryToValue(aTable, aDefaultValue),
                       eEnum, &aValue);
    return PR_TRUE;
  }

  return PR_FALSE;
}
开发者ID:Egyptghost1,项目名称:DOMinator,代码行数:42,代码来源:nsAttrValue.cpp

示例14: IsFontMimeType

bool IsFontMimeType(const nsAString& aType) {
  if (aType.IsEmpty()) {
    return true;
  }
  for (uint32_t i = 0; i < StyleLinkElementFontMimeTypesNum; i++) {
    if (aType.EqualsASCII(StyleLinkElementFontMimeTypes[i])) {
      return true;
    }
  }
  return false;
}
开发者ID:Noctem,项目名称:gecko-dev,代码行数:11,代码来源:HTMLLinkElement.cpp

示例15: return

static PRUint16
GetAlignForString(const nsAString &aAlignString)
{
  for (PRUint32 i = 0 ; i < NS_ARRAY_LENGTH(sAlignStrings) ; i++) {
    if (aAlignString.EqualsASCII(sAlignStrings[i])) {
      return (i + nsIDOMSVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE);
    }
  }

  return nsIDOMSVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_UNKNOWN;
}
开发者ID:ehsan,项目名称:mozilla-history,代码行数:11,代码来源:SVGAnimatedPreserveAspectRatio.cpp


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