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


C++ MOZ_UTF16函数代码示例

本文整理汇总了C++中MOZ_UTF16函数的典型用法代码示例。如果您正苦于以下问题:C++ MOZ_UTF16函数的具体用法?C++ MOZ_UTF16怎么用?C++ MOZ_UTF16使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: DisplayError

static void DisplayError(void)
{
    nsresult rv;

    nsCOMPtr<nsIPromptService> promptService = do_GetService("@mozilla.org/embedcomp/prompt-service;1");
    if (!promptService)
        return;

    nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID);
    if (!bundleService)
        return;

    nsCOMPtr<nsIStringBundle> bundle;
    bundleService->CreateBundle("chrome://autoconfig/locale/autoconfig.properties",
                                getter_AddRefs(bundle));
    if (!bundle)
        return;

    nsXPIDLString title;
    rv = bundle->GetStringFromName(MOZ_UTF16("readConfigTitle"), getter_Copies(title));
    if (NS_FAILED(rv))
        return;

    nsXPIDLString err;
    rv = bundle->GetStringFromName(MOZ_UTF16("readConfigMsg"), getter_Copies(err));
    if (NS_FAILED(rv))
        return;

    promptService->Alert(nullptr, title.get(), err.get());
}
开发者ID:JaminLiu,项目名称:gecko-dev,代码行数:30,代码来源:nsReadConfig.cpp

示例2: NS_ASSERTION

void
mozTXTToHTMLConv::CompleteAbbreviatedURL(const char16_t * aInString, int32_t aInLength, 
                                         const uint32_t pos, nsString& aOutString)
{
  NS_ASSERTION(int32_t(pos) < aInLength, "bad args to CompleteAbbreviatedURL, see bug #190851");
  if (int32_t(pos) >= aInLength)
    return;

  if (aInString[pos] == '@')
  {
    // only pre-pend a mailto url if the string contains a .domain in it..
    //i.e. we want to linkify [email protected] but not "let's meet @8pm"
    nsDependentString inString(aInString, aInLength);
    if (inString.FindChar('.', pos) != kNotFound) // if we have a '.' after the @ sign....
    {
      aOutString.AssignLiteral("mailto:");
      aOutString += aInString;
    }
  }
  else if (aInString[pos] == '.')
  {
    if (ItMatchesDelimited(aInString, aInLength,
                           MOZ_UTF16("www."), 4, LT_IGNORE, LT_IGNORE))
    {
      aOutString.AssignLiteral("http://");
      aOutString += aInString;
    }
    else if (ItMatchesDelimited(aInString,aInLength, MOZ_UTF16("ftp."), 4, LT_IGNORE, LT_IGNORE))
    { 
      aOutString.AssignLiteral("ftp://");
      aOutString += aInString;
    }
  }
}
开发者ID:MekliCZ,项目名称:positron,代码行数:34,代码来源:mozTXTToHTMLConv.cpp

示例3: NS_ABORT_IF_FALSE

nsresult
WebSocket::ConsoleError()
{
  NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");

  nsAutoCString targetSpec;
  nsresult rv = mURI->GetSpec(targetSpec);
  if (NS_FAILED(rv)) {
    NS_WARNING("Failed to get targetSpec");
  } else {
    NS_ConvertUTF8toUTF16 specUTF16(targetSpec);
    const char16_t* formatStrings[] = { specUTF16.get() };

    if (mReadyState < WebSocket::OPEN) {
      PrintErrorOnConsole("chrome://global/locale/appstrings.properties",
                          MOZ_UTF16("connectionFailure"),
                          formatStrings, ArrayLength(formatStrings));
    } else {
      PrintErrorOnConsole("chrome://global/locale/appstrings.properties",
                          MOZ_UTF16("netInterrupt"),
                          formatStrings, ArrayLength(formatStrings));
    }
  }
  /// todo some specific errors - like for message too large
  return rv;
}
开发者ID:aeddi,项目名称:gecko-dev,代码行数:26,代码来源:WebSocket.cpp

示例4: promptSvc

NS_IMETHODIMP 
nsNSSDialogs::NotifyCACertExists(nsIInterfaceRequestor *ctx)
{
  nsresult rv;

  nsCOMPtr<nsIPromptService> promptSvc(do_GetService(NS_PROMPTSERVICE_CONTRACTID));
  if (!promptSvc)
    return NS_ERROR_FAILURE;

  // Get the parent window for the dialog
  nsCOMPtr<nsIDOMWindow> parent = do_GetInterface(ctx);

  nsAutoString title;
  rv = mPIPStringBundle->GetStringFromName(MOZ_UTF16("caCertExistsTitle"),
                                           getter_Copies(title));
  NS_ENSURE_SUCCESS(rv, rv);

  nsAutoString msg;
  rv = mPIPStringBundle->GetStringFromName(MOZ_UTF16("caCertExistsMessage"),
                                           getter_Copies(msg));
  NS_ENSURE_SUCCESS(rv, rv);

  rv = promptSvc->Alert(parent, title.get(), msg.get());

  return rv;
}
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:26,代码来源:nsNSSDialogs.cpp

示例5: do_GetService

nsresult nsAutoConfig::PromptForEMailAddress(nsACString &emailAddress)
{
    nsresult rv;
    nsCOMPtr<nsIPromptService> promptService = do_GetService("@mozilla.org/embedcomp/prompt-service;1", &rv);
    NS_ENSURE_SUCCESS(rv, rv);
    nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv, rv);

    nsCOMPtr<nsIStringBundle> bundle;
    rv = bundleService->CreateBundle("chrome://autoconfig/locale/autoconfig.properties",
                                getter_AddRefs(bundle));
    NS_ENSURE_SUCCESS(rv, rv);

    nsXPIDLString title;
    rv = bundle->GetStringFromName(MOZ_UTF16("emailPromptTitle"), getter_Copies(title));
    NS_ENSURE_SUCCESS(rv, rv);

    nsXPIDLString err;
    rv = bundle->GetStringFromName(MOZ_UTF16("emailPromptMsg"), getter_Copies(err));
    NS_ENSURE_SUCCESS(rv, rv);
    bool check = false;
    nsXPIDLString emailResult;
    bool success;
    rv = promptService->Prompt(nullptr, title.get(), err.get(), getter_Copies(emailResult), nullptr, &check, &success);
    if (!success)
      return NS_ERROR_FAILURE;
    NS_ENSURE_SUCCESS(rv, rv);
    LossyCopyUTF16toASCII(emailResult, emailAddress);
    return NS_OK;
}
开发者ID:L2-D2,项目名称:gecko-dev,代码行数:30,代码来源:nsAutoConfig.cpp

示例6: getter_AddRefs

void
nsNNTPNewsgroupList::UpdateStatus(bool filtering, int32_t numDLed, int32_t totToDL)
{
  int32_t numerator = (filtering ? m_currentXHDRIndex + 1 : 1) * numDLed;
  int32_t denominator = (m_filterHeaders.Length() + 1) * totToDL;
  int32_t percent = numerator * 100 / denominator;
  
  nsAutoString numDownloadedStr;
  numDownloadedStr.AppendInt(numDLed);

  nsAutoString totalToDownloadStr;
  totalToDownloadStr.AppendInt(totToDL);

  nsAutoString newsgroupName;
  nsresult rv = m_newsFolder->GetUnicodeName(newsgroupName);
  if (!NS_SUCCEEDED(rv))
      return;

  nsString statusString;
  nsCOMPtr<nsIStringBundleService> bundleService =
    mozilla::services::GetStringBundleService();
  if (!bundleService)
    return;

  nsCOMPtr<nsIStringBundle> bundle;
  rv = bundleService->CreateBundle(NEWS_MSGS_URL, getter_AddRefs(bundle));
  if (!NS_SUCCEEDED(rv))
    return;

  if (filtering)
  {
    NS_ConvertUTF8toUTF16 header(m_filterHeaders[m_currentXHDRIndex]);
    const char16_t *formatStrings[4] = { header.get(),
      numDownloadedStr.get(), totalToDownloadStr.get(), newsgroupName.get() };
    rv = bundle->FormatStringFromName(MOZ_UTF16("newNewsgroupFilteringHeaders"),
      formatStrings, 4, getter_Copies(statusString));
  }
  else
  {
    const char16_t *formatStrings[3] = { numDownloadedStr.get(),
      totalToDownloadStr.get(), newsgroupName.get() };
    rv = bundle->FormatStringFromName(MOZ_UTF16("newNewsgroupHeaders"),
      formatStrings, 3, getter_Copies(statusString));
  }
  if (!NS_SUCCEEDED(rv))
    return;

  SetProgressStatus(statusString.get());
  m_lastStatusUpdate = PR_Now();

  // only update the progress meter if it has changed
  if (percent != m_lastPercent)
  {
    SetProgressBarPercent(percent);
    m_lastPercent = percent;
  }
}
开发者ID:MoonchildProductions,项目名称:FossaMail,代码行数:57,代码来源:nsNNTPNewsgroupList.cpp

示例7: switch

void
nsSVGTransform::GetValueAsString(nsAString& aValue) const
{
  char16_t buf[256];

  switch (mType) {
    case SVG_TRANSFORM_TRANSLATE:
      // The spec say that if Y is not provided, it is assumed to be zero.
      if (mMatrix.y0 != 0)
        nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
            MOZ_UTF16("translate(%g, %g)"),
            mMatrix.x0, mMatrix.y0);
      else
        nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
            MOZ_UTF16("translate(%g)"),
            mMatrix.x0);
      break;
    case SVG_TRANSFORM_ROTATE:
      if (mOriginX != 0.0f || mOriginY != 0.0f)
        nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
            MOZ_UTF16("rotate(%g, %g, %g)"),
            mAngle, mOriginX, mOriginY);
      else
        nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
            MOZ_UTF16("rotate(%g)"), mAngle);
      break;
    case SVG_TRANSFORM_SCALE:
      if (mMatrix.xx != mMatrix.yy)
        nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
            MOZ_UTF16("scale(%g, %g)"), mMatrix.xx, mMatrix.yy);
      else
        nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
            MOZ_UTF16("scale(%g)"), mMatrix.xx);
      break;
    case SVG_TRANSFORM_SKEWX:
      nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
                                MOZ_UTF16("skewX(%g)"), mAngle);
      break;
    case SVG_TRANSFORM_SKEWY:
      nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
                                MOZ_UTF16("skewY(%g)"), mAngle);
      break;
    case SVG_TRANSFORM_MATRIX:
      nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
          MOZ_UTF16("matrix(%g, %g, %g, %g, %g, %g)"),
                            mMatrix.xx, mMatrix.yx,
                            mMatrix.xy, mMatrix.yy,
                            mMatrix.x0, mMatrix.y0);
      break;
    default:
      buf[0] = '\0';
      NS_ERROR("unknown transformation type");
      break;
  }

  aValue.Assign(buf);
}
开发者ID:ConradIrwin,项目名称:gecko-dev,代码行数:57,代码来源:nsSVGTransform.cpp

示例8: PgpMimeGetNeedsAddonString

static void PgpMimeGetNeedsAddonString(nsCString &aResult)
{
  aResult.AssignLiteral("???");

  nsCOMPtr<nsIStringBundleService> stringBundleService =
    mozilla::services::GetStringBundleService();

  nsCOMPtr<nsIStringBundle> stringBundle;
  nsresult rv = stringBundleService->CreateBundle(PGPMIME_PROPERTIES_URL,
                                                  getter_AddRefs(stringBundle));
  if (NS_FAILED(rv))
    return;

  nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
  if (NS_FAILED(rv))
    return;

  nsCString url;
  if (NS_FAILED(prefs->GetCharPref("mail.pgpmime.addon_url",
                                   getter_Copies(url))))
    return;

  NS_ConvertUTF8toUTF16 url16(url);
  const char16_t *formatStrings[] = { url16.get() };

  nsString result;
  rv = stringBundle->FormatStringFromName(MOZ_UTF16(PGPMIME_STR_NOT_SUPPORTED_ID),
                                          formatStrings, 1, getter_Copies(result));
  if (NS_FAILED(rv))
    return;
  aResult = NS_ConvertUTF16toUTF8(result);
}
开发者ID:cmotc,项目名称:spacehamster,代码行数:32,代码来源:nsPgpMimeProxy.cpp

示例9: winMediator

nsresult
PluginHangUIParent::GetHangUIOwnerWindowHandle(NativeWindowHandle& windowHandle)
{
  windowHandle = nullptr;

  nsresult rv;
  nsCOMPtr<nsIWindowMediator> winMediator(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID,
                                                        &rv));
  NS_ENSURE_SUCCESS(rv, rv);

  nsCOMPtr<nsIDOMWindow> navWin;
  rv = winMediator->GetMostRecentWindow(MOZ_UTF16("navigator:browser"),
                                        getter_AddRefs(navWin));
  NS_ENSURE_SUCCESS(rv, rv);
  if (!navWin) {
    return NS_ERROR_FAILURE;
  }

  nsCOMPtr<nsIWidget> widget = WidgetUtils::DOMWindowToWidget(navWin);
  if (!widget) {
    return NS_ERROR_FAILURE;
  }

  windowHandle = reinterpret_cast<NativeWindowHandle>(widget->GetNativeData(NS_NATIVE_WINDOW));
  if (!windowHandle) {
    return NS_ERROR_FAILURE;
  }
  
  return NS_OK;
}
开发者ID:JaminLiu,项目名称:gecko-dev,代码行数:30,代码来源:PluginHangUIParent.cpp

示例10: NS_ENSURE_ARG_POINTER

NS_IMETHODIMP
nsBeckyFilters::AutoLocate(char16_t **aDescription,
                           nsIFile **aLocation,
                           bool *_retval)
{
  NS_ENSURE_ARG_POINTER(aLocation);
  NS_ENSURE_ARG_POINTER(_retval);

  if (aDescription) {
    *aDescription =
      nsBeckyStringBundle::GetStringByName(MOZ_UTF16("BeckyImportDescription"));
  }
  *aLocation = nullptr;
  *_retval = false;

  nsresult rv;
  nsCOMPtr<nsIFile> location;
  rv = GetDefaultFilterLocation(getter_AddRefs(location));
  if (NS_FAILED(rv))
    location = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
  else
    *_retval = true;

  location.forget(aLocation);
  return NS_OK;
}
开发者ID:SphereWeb,项目名称:releases-comm-central,代码行数:26,代码来源:nsBeckyFilters.cpp

示例11: MOZ_ASSERT

bool
RootList::init(HandleObject debuggees)
{
    MOZ_ASSERT(debuggees && JS::dbg::IsDebugger(ObjectValue(*debuggees)));
    js::Debugger *dbg = js::Debugger::fromJSObject(debuggees);

    ZoneSet debuggeeZones;
    if (!debuggeeZones.init())
        return false;

    for (js::WeakGlobalObjectSet::Range r = dbg->allDebuggees(); !r.empty(); r.popFront()) {
        if (!debuggeeZones.put(r.front()->zone()))
            return false;
    }

    if (!init(debuggeeZones))
        return false;

    // Ensure that each of our debuggee globals are in the root list.
    for (js::WeakGlobalObjectSet::Range r = dbg->allDebuggees(); !r.empty(); r.popFront()) {
        if (!addRoot(JS::ubi::Node(static_cast<JSObject *>(r.front())),
                     MOZ_UTF16("debuggee global")))
        {
            return false;
        }
    }

    return true;
}
开发者ID:mmatyas,项目名称:mozjs,代码行数:29,代码来源:UbiNode.cpp

示例12: Concrete

namespace ubi {

template<>
class Concrete<FakeNode> : public Base
{
  protected:
    explicit Concrete(FakeNode* ptr) : Base(ptr) { }
    FakeNode& get() const { return *static_cast<FakeNode*>(ptr); }

  public:
    static void construct(void* storage, FakeNode* ptr) { new (storage) Concrete(ptr); }

    UniquePtr<EdgeRange> edges(JSRuntime* rt, bool wantNames) const override {
        return UniquePtr<EdgeRange>(js_new<PreComputedEdgeRange>(get().edges));
    }

    Node::Size size(mozilla::MallocSizeOf) const override {
        return 1;
    }

    static const char16_t concreteTypeName[];
    const char16_t* typeName() const override { return concreteTypeName; }
};

const char16_t Concrete<FakeNode>::concreteTypeName[] = MOZ_UTF16("FakeNode");

} // namespace ubi
开发者ID:JefferyQ,项目名称:spidernode,代码行数:27,代码来源:testUbiNode.cpp

示例13: NS_ASSERTION

void
nsXREDirProvider::DoShutdown()
{
  if (mProfileNotified) {
    nsCOMPtr<nsIObserverService> obsSvc =
      mozilla::services::GetObserverService();
    NS_ASSERTION(obsSvc, "No observer service?");
    if (obsSvc) {
      static const char16_t kShutdownPersist[] = MOZ_UTF16("shutdown-persist");
      obsSvc->NotifyObservers(nullptr, "profile-change-net-teardown", kShutdownPersist);
      obsSvc->NotifyObservers(nullptr, "profile-change-teardown", kShutdownPersist);

      // Phase 2c: Now that things are torn down, force JS GC so that things which depend on
      // resources which are about to go away in "profile-before-change" are destroyed first.

      JSRuntime *rt = xpc::GetJSRuntime();
      if (rt) {
        JS_GC(rt);
      }

      // Phase 3: Notify observers of a profile change
      obsSvc->NotifyObservers(nullptr, "profile-before-change", kShutdownPersist);
      obsSvc->NotifyObservers(nullptr, "profile-before-change2", kShutdownPersist);
    }
    mProfileNotified = false;
  }
}
开发者ID:ChaOSChriS,项目名称:gecko-dev,代码行数:27,代码来源:nsXREDirProvider.cpp

示例14: NS_ENSURE_ARG_POINTER

NS_IMETHODIMP nsAppleMailImportModule::GetImportInterface(const char *aImportType, nsISupports **aInterface)
{
  NS_ENSURE_ARG_POINTER(aImportType);
  NS_ENSURE_ARG_POINTER(aInterface);
  *aInterface = nullptr;
  nsresult rv = NS_ERROR_NOT_AVAILABLE;

  if (!strcmp(aImportType, "mail")) {
    nsCOMPtr<nsIImportMail> mail(do_CreateInstance(NS_APPLEMAILIMPL_CONTRACTID, &rv));
    if (NS_SUCCEEDED(rv)) {
      nsCOMPtr<nsIImportService> impSvc(do_GetService(NS_IMPORTSERVICE_CONTRACTID, &rv));
      if (NS_SUCCEEDED(rv)) {
        nsCOMPtr<nsIImportGeneric> generic;
        rv = impSvc->CreateNewGenericMail(getter_AddRefs(generic));
        if (NS_SUCCEEDED(rv)) {
          nsAutoString name;
          rv = mBundle->GetStringFromName(MOZ_UTF16("ApplemailImportName"), getter_Copies(name));
          NS_ENSURE_SUCCESS(rv, rv);

          nsCOMPtr<nsISupportsString> nameString(do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv));
          NS_ENSURE_SUCCESS(rv, rv);
          nameString->SetData(name);

          generic->SetData("name", nameString);
          generic->SetData("mailInterface", mail);

          generic.forget(aInterface);
        }
      }
    }
  }

  return rv;
}
开发者ID:SphereWeb,项目名称:releases-comm-central,代码行数:34,代码来源:nsAppleMailImport.cpp

示例15: do_QueryInterface

void
nsNNTPNewsgroupList::SetProgressStatus(const char16_t *aMessage)
{
  if (!m_runningURL)
    return;

  nsCOMPtr <nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(m_runningURL);
  if (mailnewsUrl) {
    nsCOMPtr <nsIMsgStatusFeedback> feedback;
    mailnewsUrl->GetStatusFeedback(getter_AddRefs(feedback));

    if (feedback) {
      // prepending the account name to the status message.
      nsresult rv;
      nsCOMPtr <nsIMsgIncomingServer> server;
      rv = mailnewsUrl->GetServer(getter_AddRefs(server));
      NS_ENSURE_SUCCESS_VOID(rv);
      nsString accountName;
      server->GetPrettyName(accountName);
      nsString statusMessage;
      nsCOMPtr<nsIStringBundleService> sbs =
        mozilla::services::GetStringBundleService();
      nsCOMPtr<nsIStringBundle> bundle;
      rv = sbs->CreateBundle(MSGS_URL,
                             getter_AddRefs(bundle));
      NS_ENSURE_SUCCESS_VOID(rv);
      const char16_t *params[] = { accountName.get(), aMessage };
      bundle->FormatStringFromName(MOZ_UTF16("statusMessage"),
                                   params, 2, getter_Copies(statusMessage));

      feedback->ShowStatusString(statusMessage);
    }
  }
}
开发者ID:MoonchildProductions,项目名称:FossaMail,代码行数:34,代码来源:nsNNTPNewsgroupList.cpp


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