• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ NS_ConvertASCIItoUTF16函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: FinishInternal

void
Decoder::Finish()
{
  // Implementation-specific finalization
  if (!HasError())
    FinishInternal();

  // If the implementation left us mid-frame, finish that up.
  if (mInFrame && !HasDecoderError())
    PostFrameStop();

  // If PostDecodeDone() has not been called, we need to sent teardown
  // notifications.
  if (!IsSizeDecode() && !mDecodeDone) {

    // Log data errors to the error console
    nsCOMPtr<nsIConsoleService> consoleService =
      do_GetService(NS_CONSOLESERVICE_CONTRACTID);
    nsCOMPtr<nsIScriptError> errorObject =
      do_CreateInstance(NS_SCRIPTERROR_CONTRACTID);

    if (consoleService && errorObject && !HasDecoderError()) {
      nsAutoString msg(NS_LITERAL_STRING("Image corrupt or truncated: ") +
                       NS_ConvertASCIItoUTF16(mImage.GetURIString()));

      if (NS_SUCCEEDED(errorObject->InitWithWindowID(
                         msg.get(),
                         NS_ConvertUTF8toUTF16(mImage.GetURIString()).get(),
                         nsnull, 0, 0, nsIScriptError::errorFlag,
                         "Image", mImage.InnerWindowID()
                       ))) {
        consoleService->LogMessage(errorObject);
      }
    }

    // If we only have a data error, see if things are worth salvaging
    bool salvage = !HasDecoderError() && mImage.GetNumFrames();

    // If we're salvaging, say we finished decoding
    if (salvage)
      mImage.DecodingComplete();

    // Fire teardown notifications
    if (mObserver) {
      mObserver->OnStopContainer(nsnull, &mImage);
      mObserver->OnStopDecode(nsnull, salvage ? NS_OK : NS_ERROR_FAILURE, nsnull);
    }
  }
}
开发者ID:ThinkerYzu,项目名称:mozilla-central,代码行数:49,代码来源:Decoder.cpp


示例2: ArrayLength

void
ErrorReporter::ReportUnexpected(const char *aMessage,
                                const nsCSSToken &aToken)
{
  if (!ShouldReportErrors()) return;

  nsAutoString tokenString;
  aToken.AppendToString(tokenString);
  const PRUnichar *params[1] = { tokenString.get() };

  nsAutoString str;
  sStringBundle->FormatStringFromName(NS_ConvertASCIItoUTF16(aMessage).get(),
                                      params, ArrayLength(params),
                                      getter_Copies(str));
  AddToError(str);
}
开发者ID:multi-sim,项目名称:releases-mozilla-central,代码行数:16,代码来源:ErrorReporter.cpp


示例3: memset

void
MediaEngineWebrtcAudioSource::GetUUID(nsAString& aUUID)
{
  char deviceName[KMaxDeviceNameLength];
  memset(deviceName, 0, KMaxDeviceNameLength);
  char uniqueId[KMaxUniqueIdLength];
  memset(uniqueId, 0, KMaxUniqueIdLength);
  if(true == mInitDone )
  {
    mVoEHw->GetRecordingDeviceName(
        			mCapIndex, deviceName,  uniqueId );
   aUUID.Assign(NS_ConvertASCIItoUTF16(uniqueId));
  }

  return;
}
开发者ID:aftabmd,项目名称:GetUserMedia-Webrtc,代码行数:16,代码来源:MediaEngineWebrtc.cpp


示例4: memset

void
MediaEngineWebRTCVideoSource::GetUUID(nsAString& aUUID)
{
  char deviceName[KMaxDeviceNameLength];
  memset(deviceName, 0, KMaxDeviceNameLength);

  char uniqueId[KMaxUniqueIdLength];
  memset(uniqueId, 0, KMaxUniqueIdLength);

  if (mInitDone) {
    mViECapture->GetCaptureDevice(
      mCapIndex, deviceName, KMaxDeviceNameLength, uniqueId, KMaxUniqueIdLength
    );
    aUUID.Assign(NS_ConvertASCIItoUTF16(uniqueId));
  }
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:16,代码来源:MediaEngineWebRTCVideo.cpp


示例5: NS_NewISupportsArray

/* void openProgressDialog (in nsIDOMWindow parent, in string dialogURL, in nsISupports parameters); */
NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindow *parent,
                                                  const char *dialogURL,
                                                  nsISupports *parameters, 
                                                  nsIObserver *openDialogObserver,
                                                  bool *notifyOnOpen)
{
  m_observer = openDialogObserver;

  nsresult rv = NS_ERROR_FAILURE;
  
  if (m_dialog)
    return NS_ERROR_ALREADY_INITIALIZED;
  
  if (!dialogURL || !*dialogURL)
    return NS_ERROR_INVALID_ARG;

  if (parent)
  {
    // Set up window.arguments[0]...
    nsCOMPtr<nsISupportsArray> array;
    rv = NS_NewISupportsArray(getter_AddRefs(array));
    NS_ENSURE_SUCCESS(rv, rv);

    nsCOMPtr<nsISupportsInterfacePointer> ifptr =
      do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv, rv);
    
    ifptr->SetData(static_cast<nsIPrintProgress*>(this));
    ifptr->SetDataIID(&NS_GET_IID(nsIPrintProgress));

    array->AppendElement(ifptr);

    array->AppendElement(parameters);

    // Open the dialog.
    nsCOMPtr<nsIDOMWindow> newWindow;
    rv = parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL),
                            NS_LITERAL_STRING("_blank"),
                            NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"),
                            array, getter_AddRefs(newWindow));
    if (NS_SUCCEEDED(rv)) {
      *notifyOnOpen = true;
    }
  }

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


示例6: parentWindow

NS_IMETHODIMP
nsXPInstallManager::ConfirmInstall(nsIDOMWindow *aParent, const PRUnichar **aPackageList, PRUint32 aCount, PRBool *aRetval)
{
    *aRetval = PR_FALSE;

    nsCOMPtr<nsIDOMWindowInternal> parentWindow( do_QueryInterface(aParent) );
    nsCOMPtr<nsIDialogParamBlock> params;
    nsresult rv = LoadParams( aCount, aPackageList, getter_AddRefs(params) );

    if ( NS_SUCCEEDED(rv) && parentWindow && params)
    {
        nsCOMPtr<nsIDOMWindow> newWindow;

        nsCOMPtr<nsISupportsInterfacePointer> ifptr =
            do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID, &rv);
        NS_ENSURE_SUCCESS(rv, rv);

        ifptr->SetData(params);
        ifptr->SetDataIID(&NS_GET_IID(nsIDialogParamBlock));

        char* confirmDialogURL;
        nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
        if (!pref)
          return rv;

        rv = pref->GetCharPref(PREF_XPINSTALL_CONFIRM_DLG, &confirmDialogURL);
        NS_ASSERTION(NS_SUCCEEDED(rv), "Can't invoke XPInstall FE without a FE URL! Set xpinstall.dialog.confirm");
        if (NS_FAILED(rv))
          return rv;

        rv = parentWindow->OpenDialog(NS_ConvertASCIItoUTF16(confirmDialogURL),
                                      NS_LITERAL_STRING("_blank"),
                                      NS_LITERAL_STRING("chrome,centerscreen,modal,titlebar"),
                                      ifptr,
                                      getter_AddRefs(newWindow));

        if (NS_SUCCEEDED(rv))
        {
            //Now get which button was pressed from the ParamBlock
            PRInt32 buttonPressed = 0;
            params->GetInt( 0, &buttonPressed );
            *aRetval = buttonPressed ? PR_FALSE : PR_TRUE;
        }
    }

    return rv;
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:47,代码来源:nsXPInstallManager.cpp


示例7: Validate

  nsresult Validate()
  {
    // Verify cert is self-signed
    bool selfSigned;
    nsresult rv = mCert->GetIsSelfSigned(&selfSigned);
    if (NS_FAILED(rv)) {
      return rv;
    }
    if (!selfSigned) {
      return NS_ERROR_FAILURE;
    }

    // Check that subject and issuer match nickname
    nsXPIDLString subjectName;
    nsXPIDLString issuerName;
    mCert->GetSubjectName(subjectName);
    mCert->GetIssuerName(issuerName);
    if (!subjectName.Equals(issuerName)) {
      return NS_ERROR_FAILURE;
    }
    NS_NAMED_LITERAL_STRING(commonNamePrefix, "CN=");
    nsAutoString subjectNameFromNickname(
      commonNamePrefix + NS_ConvertASCIItoUTF16(mNickname));
    if (!subjectName.Equals(subjectNameFromNickname)) {
      return NS_ERROR_FAILURE;
    }

    nsCOMPtr<nsIX509CertValidity> validity;
    mCert->GetValidity(getter_AddRefs(validity));

    PRTime notBefore, notAfter;
    validity->GetNotBefore(&notBefore);
    validity->GetNotAfter(&notAfter);

    // Ensure cert will last at least one more day
    static const PRTime oneDay = PRTime(PR_USEC_PER_SEC)
                               * PRTime(60)  // sec
                               * PRTime(60)  // min
                               * PRTime(24); // hours
    PRTime now = PR_Now();
    if (notBefore > now ||
        notAfter < (now - oneDay)) {
      return NS_ERROR_FAILURE;
    }

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


示例8: NS_ENSURE_TRUE

bool
nsXHTMLContentSerializer::AfterElementStart(nsIContent* aContent,
                                            nsIContent* aOriginalElement,
                                            nsAString& aStr)
{
  nsIAtom *name = aContent->Tag();
  if (aContent->GetNameSpaceID() == kNameSpaceID_XHTML &&
      mRewriteEncodingDeclaration &&
      name == nsGkAtoms::head) {

    // Check if there already are any content-type meta children.
    // If there are, they will be modified to use the correct charset.
    // If there aren't, we'll insert one here.
    bool hasMeta = false;
    for (nsIContent* child = aContent->GetFirstChild();
         child;
         child = child->GetNextSibling()) {
      if (child->IsHTML(nsGkAtoms::meta) &&
          child->HasAttr(kNameSpaceID_None, nsGkAtoms::content)) {
        nsAutoString header;
        child->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv, header);

        if (header.LowerCaseEqualsLiteral("content-type")) {
          hasMeta = true;
          break;
        }
      }
    }

    if (!hasMeta) {
      NS_ENSURE_TRUE(AppendNewLineToString(aStr), false);
      if (mDoFormat) {
        NS_ENSURE_TRUE(AppendIndentation(aStr), false);
      }
      NS_ENSURE_TRUE(AppendToString(NS_LITERAL_STRING("<meta http-equiv=\"content-type\""), aStr), false);
      NS_ENSURE_TRUE(AppendToString(NS_LITERAL_STRING(" content=\"text/html; charset="), aStr), false);
      NS_ENSURE_TRUE(AppendToString(NS_ConvertASCIItoUTF16(mCharset), aStr), false);
      if (mIsHTMLSerializer) {
        NS_ENSURE_TRUE(AppendToString(NS_LITERAL_STRING("\">"), aStr), false);
      } else {
        NS_ENSURE_TRUE(AppendToString(NS_LITERAL_STRING("\" />"), aStr), false);
      }
    }
  }

  return true;
}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:47,代码来源:nsXHTMLContentSerializer.cpp


示例9: ReportUnexpectedEOF

// aMessage must take no parameters
void nsCSSScanner::ReportUnexpectedEOF(const char* aLookingFor)
{
  ENSURE_STRINGBUNDLE;

  nsXPIDLString innerStr;
  gStringBundle->GetStringFromName(NS_ConvertASCIItoUTF16(aLookingFor).get(),
                                   getter_Copies(innerStr));

  const PRUnichar *params[] = {
    innerStr.get()
  };
  nsXPIDLString str;
  gStringBundle->FormatStringFromName(NS_LITERAL_STRING("PEUnexpEOF").get(),
                                      params, NS_ARRAY_LENGTH(params),
                                      getter_Copies(str));
  AddToError(str);
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:18,代码来源:nsCSSScanner.cpp


示例10: strWrapper

NS_IMETHODIMP
nsCategoryObserver::Observe(nsISupports* aSubject, const char* aTopic,
                            const PRUnichar* aData) {
  if (!mListener)
    return NS_OK;

  if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) {
    mHash.Clear();
    mListener->CategoryCleared();
    return NS_OK;
  }

  if (!aData ||
      !nsDependentString(aData).Equals(NS_ConvertASCIItoUTF16(mCategory)))
    return NS_OK;

  nsCAutoString str;
  nsCOMPtr<nsISupportsCString> strWrapper(do_QueryInterface(aSubject));
  if (strWrapper)
    strWrapper->GetData(str);

  if (strcmp(aTopic, NS_XPCOM_CATEGORY_ENTRY_ADDED_OBSERVER_ID) == 0) {
    nsCOMPtr<nsICategoryManager> catMan =
      do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
    if (!catMan)
      return NS_OK;

    nsCString entryValue;
    catMan->GetCategoryEntry(mCategory.get(),
                             str.get(),
                             getter_Copies(entryValue));

    mHash.Put(str, entryValue);
    mListener->EntryAdded(entryValue);
  } else if (strcmp(aTopic, NS_XPCOM_CATEGORY_ENTRY_REMOVED_OBSERVER_ID) == 0) {
    nsCAutoString val;
    if (mHash.Get(str, &val)) {
      mHash.Remove(str);
      mListener->EntryRemoved(val);
    }
  } else if (strcmp(aTopic, NS_XPCOM_CATEGORY_CLEARED_OBSERVER_ID) == 0) {
    mHash.Clear();
    mListener->CategoryCleared();
  }
  return NS_OK;
}
开发者ID:fortunto2,项目名称:celtx,代码行数:46,代码来源:nsCategoryCache.cpp


示例11: NS_TIMELINE_START_TIMER

//--------------------------------------------------------------
NS_IMETHODIMP nsCharsetAlias2::GetPreferred(const nsACString& aAlias,
                                            nsACString& oResult)
{
   if (aAlias.IsEmpty()) return NS_ERROR_NULL_POINTER;
   NS_TIMELINE_START_TIMER("nsCharsetAlias2:GetPreferred");


   // Delay loading charsetalias.properties by hardcoding the most
   // frequent aliases.  Note that it's possible to recur in to this
   // function *while loading* charsetalias.properties (see bug 190951),
   // so we might have an |mDelegate| already that isn't valid yet, but
   // the load is guaranteed to be "UTF-8" so things will be OK.
   for (PRUint32 index = 0; index < NS_ARRAY_LENGTH(kAliases); index++) {
     if (aAlias.LowerCaseEqualsASCII(kAliases[index][0])) {
       oResult.Assign(nsDependentCString(kAliases[index][1],
                                         NS_PTR_TO_UINT32(kAliases[index][2])));
       NS_TIMELINE_STOP_TIMER("nsCharsetAlias2:GetPreferred");
       return NS_OK;
     }
   }

   oResult.Truncate();

   if(!mDelegate) {
     //load charsetalias.properties string bundle with all remaining aliases
     // we may need to protect the following section with a lock so we won't call the
     // 'new nsGREResProperties' from two different threads
     mDelegate = new nsGREResProperties( NS_LITERAL_CSTRING("charsetalias.properties") );
     NS_ASSERTION(mDelegate, "cannot create nsGREResProperties");
     if(nsnull == mDelegate)
       return NS_ERROR_OUT_OF_MEMORY;
   }

   NS_TIMELINE_STOP_TIMER("nsCharsetAlias2:GetPreferred");
   NS_TIMELINE_MARK_TIMER("nsCharsetAlias2:GetPreferred");

   nsCAutoString key(aAlias);
   ToLowerCase(key);

   // hack for now, have to fix nsGREResProperties, but we can't until
   // string bundles use UTF8 keys
   nsAutoString result;
   nsresult rv = mDelegate->Get(NS_ConvertASCIItoUTF16(key), result);
   LossyAppendUTF16toASCII(result, oResult);
   return rv;
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:47,代码来源:nsCharsetAliasImp.cpp


示例12: NS_ENSURE_ARG_POINTER

nsresult
sbSecurityMixin::DispatchNotificationEvent(const char* aNotificationType,
        const Scope* aScope,
        bool aHasAccess)
{
    // NOTE: This method only /tries/ to dispatch the notification event.
    // If there's no notification document then it fails mostly silently.
    // This is intentional since there might be cases where this mixin is
    // used when no notification document is available.

    NS_ENSURE_ARG_POINTER(aNotificationType);
    NS_ENSURE_ARG_POINTER(aScope);

    // TODO: we need to add the notification type to the event eventually
    // get it? event eventually...

    LOG(( "sbSecurityMixin::DispatchNotificationEvent(%s)", aNotificationType ));

    // see if we've got a document to dispatch events to
    if ( mNotificationDocument ) {
        LOG(( "sbSecurityMixin::DispatchNotificationEvent - dispatching event" ));

        nsCOMPtr<sbIRemotePlayer> remotePlayer;
        nsresult rv = mOuter->GetRemotePlayer(getter_AddRefs(remotePlayer));

        // objects that do not return a remote player do not want to trigger notifications because
        // they are owned by other objects that supercede them in the security hierarchy.
        if(NS_SUCCEEDED(rv)) {

            return sbRemotePlayer::DispatchSecurityEvent( mNotificationDocument,
                    remotePlayer,
                    RAPI_EVENT_CLASS,
                    RAPI_EVENT_TYPE,
                    NS_ConvertASCIItoUTF16(aScope->name),
                    aHasAccess,
                    PR_TRUE );

        }

    } else {
        LOG(( "sbSecurityMixin::DispatchNotificationEvent - not dispatching event" ));
        NS_WARNING( "sbSecurityMixin::DispatchNotificationEvent didn't have a notification document to dispatch to" );
    }

    return NS_OK;
}
开发者ID:schorij23,项目名称:nightingale-hacking,代码行数:46,代码来源:sbSecurityMixin.cpp


示例13: AppendNewLineToString

void
nsXHTMLContentSerializer::AfterElementStart(nsIContent * aContent,
                                            nsIDOMElement *aOriginalElement,
                                            nsAString& aStr)
{
  nsIAtom *name = aContent->Tag();
  if (aContent->GetNameSpaceID() == kNameSpaceID_XHTML &&
      mRewriteEncodingDeclaration &&
      name == nsGkAtoms::head) {

    // Check if there already are any content-type meta children.
    // If there are, they will be modified to use the correct charset.
    // If there aren't, we'll insert one here.
    PRBool hasMeta = PR_FALSE;
    PRUint32 i, childCount = aContent->GetChildCount();
    for (i = 0; i < childCount; ++i) {
      nsIContent* child = aContent->GetChildAt(i);
      if (child->IsHTML() &&
          child->Tag() == nsGkAtoms::meta &&
          child->HasAttr(kNameSpaceID_None, nsGkAtoms::content)) {
        nsAutoString header;
        child->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv, header);

        if (header.LowerCaseEqualsLiteral("content-type")) {
          hasMeta = PR_TRUE;
          break;
        }
      }
    }

    if (!hasMeta) {
      AppendNewLineToString(aStr);
      if (mDoFormat) {
        AppendIndentation(aStr);
      }
      AppendToString(NS_LITERAL_STRING("<meta http-equiv=\"content-type\""),
                    aStr);
      AppendToString(NS_LITERAL_STRING(" content=\"text/html; charset="), aStr);
      AppendToString(NS_ConvertASCIItoUTF16(mCharset), aStr);
      if (mIsHTMLSerializer)
        AppendToString(NS_LITERAL_STRING("\">"), aStr);
      else
        AppendToString(NS_LITERAL_STRING("\" />"), aStr);
    }
  }
}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:46,代码来源:nsXHTMLContentSerializer.cpp


示例14: subImpls

already_AddRefed<Blob>
BlobSet::GetBlobInternal(nsISupports* aParent,
                         const nsACString& aContentType,
                         ErrorResult& aRv)
{
  nsTArray<RefPtr<BlobImpl>> subImpls(GetBlobImpls());
  RefPtr<BlobImpl> blobImpl =
    MultipartBlobImpl::Create(Move(subImpls),
                              NS_ConvertASCIItoUTF16(aContentType),
                              aRv);
  if (NS_WARN_IF(aRv.Failed())) {
    return nullptr;
  }

  RefPtr<Blob> blob = Blob::Create(aParent, blobImpl);
  return blob.forget();
}
开发者ID:ivaylo5ev,项目名称:gecko-dev,代码行数:17,代码来源:BlobSet.cpp


示例15: SetMsgWindow

NS_IMETHODIMP nsMsgProgress::OpenProgressDialog(nsIDOMWindowInternal *parent, 
                                                nsIMsgWindow *aMsgWindow, 
                                                const char *dialogURL, 
                                                PRBool inDisplayModal, 
                                                nsISupports *parameters)
{
  nsresult rv;
  
  if (aMsgWindow)
  {
    SetMsgWindow(aMsgWindow);
    aMsgWindow->SetStatusFeedback(this);
  }
  
  NS_ENSURE_TRUE(!m_dialog, NS_ERROR_ALREADY_INITIALIZED);
  NS_ENSURE_ARG_POINTER(dialogURL);
  NS_ENSURE_ARG_POINTER(parent);
  
  // Set up window.arguments[0]...
  nsCOMPtr<nsISupportsArray> array;
  rv = NS_NewISupportsArray(getter_AddRefs(array));
  NS_ENSURE_SUCCESS(rv, rv);
  
  nsCOMPtr<nsISupportsInterfacePointer> ifptr =
    do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID, &rv);
  NS_ENSURE_SUCCESS(rv, rv);
  
  ifptr->SetData(static_cast<nsIMsgProgress*>(this));
  ifptr->SetDataIID(&NS_GET_IID(nsIMsgProgress));
  
  array->AppendElement(ifptr);
  array->AppendElement(parameters);
  
  // Open the dialog.
  nsCOMPtr<nsIDOMWindow> newWindow;
  
  nsString chromeOptions(NS_LITERAL_STRING("chrome,titlebar,dependent"));
  if (inDisplayModal)
    chromeOptions.AppendLiteral(",modal");
  
  return parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL),
                            NS_LITERAL_STRING("_blank"),
                            chromeOptions,
                            array, getter_AddRefs(newWindow));
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:45,代码来源:nsMsgProgress.cpp


示例16: NS_ENSURE_ARG

nsresult
nsSceneTracker::AssignDefaultSceneNumber(nsIDOMHTMLParagraphElement* aScene,
                                         PRBool* outPropagateChanges) {
  NS_ENSURE_ARG(aScene);

  nsAutoString className;
  aScene->GetClassName(className);
  if (! className.Equals(NS_LITERAL_STRING("sceneheading")))
    return NS_ERROR_INVALID_ARG;

  nsresult rv;

  PRInt32 scriptRevision = 0;
  rv = mEditor->GetRevisionNumber(&scriptRevision);
  if (NS_FAILED(rv))
    return rv;

  PRUint32 sceneNumber[DEFAULT_MAX_SCENE_DEPTH];
  PRUint32 sceneNumberLength = DEFAULT_MAX_SCENE_DEPTH;

  nsCOMPtr<nsIDOMHTMLParagraphElement> prevScene;
  nsCOMPtr<nsIDOMHTMLParagraphElement> nextScene;

  rv = GetPriorNumberedScene(aScene, getter_AddRefs(prevScene));
  if (NS_FAILED(rv))
    return rv;

  rv = GetNextNumberedScene(aScene, getter_AddRefs(nextScene));
  if (NS_FAILED(rv))
    return rv;

  rv = SceneNumberBetweenScenes(prevScene, nextScene, &sceneNumberLength,
    sceneNumber, outPropagateChanges);
  if (NS_FAILED(rv))
    return rv;

  nsCAutoString sceneNumberCStr;
  sceneNumberCStr.Assign(nsPrintfCString("%u", sceneNumber[0]));
  for (PRUint32 i = 1; i < sceneNumberLength; ++i)
    sceneNumberCStr.Append(nsPrintfCString(".%u", sceneNumber[i]));
  aScene->SetAttribute(NS_LITERAL_STRING("scenenumber"),
    NS_ConvertASCIItoUTF16(sceneNumberCStr));

  return NS_OK;
}
开发者ID:VividOperatingSystem,项目名称:celtx,代码行数:45,代码来源:nsSceneTracker.cpp


示例17:

void
nsUICommandCollector::AddEventListeners(nsIDOMEventTarget *window)
{
  for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(kEvents); ++i) {
    // Attach a capturing event listener to the window.
    // Use capturing instead of bubbling so that we still record
    // the event even if propagation is canceled for some reason.

    // Using NS_LITERAL_STRING in const data is not allowed, so convert here.
    // This is not performance-sensitive.
    nsresult rv;
    rv = window->AddEventListener(NS_ConvertASCIItoUTF16(kEvents[i].event),
                                  this, PR_TRUE);
    if (NS_FAILED(rv)) {
      MS_LOG(("Couldn't add event listener %s", kEvents[i]));
    }
  }
}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:18,代码来源:nsUICommandCollector.cpp


示例18: SetMsgWindow

NS_IMETHODIMP nsMsgProgress::OpenProgressDialog(nsIDOMWindow *parentDOMWindow, 
                                                nsIMsgWindow *aMsgWindow, 
                                                const char *dialogURL, 
                                                bool inDisplayModal, 
                                                nsISupports *parameters)
{
  nsresult rv;

  if (aMsgWindow)
  {
    SetMsgWindow(aMsgWindow);
    aMsgWindow->SetStatusFeedback(this);
  }

  NS_ENSURE_ARG_POINTER(dialogURL);
  nsCOMPtr<nsPIDOMWindow> parent(do_QueryInterface(parentDOMWindow));
  NS_ENSURE_ARG_POINTER(parent);

  // Set up window.arguments[0]...
  nsCOMPtr<nsIMutableArray> array(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
  NS_ENSURE_SUCCESS(rv, rv);

  nsCOMPtr<nsISupportsInterfacePointer> ifptr =
    do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID, &rv);
  NS_ENSURE_SUCCESS(rv, rv);

  ifptr->SetData(static_cast<nsIMsgProgress*>(this));
  ifptr->SetDataIID(&NS_GET_IID(nsIMsgProgress));

  array->AppendElement(ifptr, false);
  array->AppendElement(parameters, false);

  // Open the dialog.
  nsCOMPtr<nsIDOMWindow> newWindow;

  nsString chromeOptions(NS_LITERAL_STRING("chrome,dependent,centerscreen"));
  if (inDisplayModal)
    chromeOptions.AppendLiteral(",modal");

  return parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL),
                            NS_LITERAL_STRING("_blank"),
                            chromeOptions,
                            array, getter_AddRefs(newWindow));
}
开发者ID:cmotc,项目名称:spacehamster,代码行数:44,代码来源:nsMsgProgress.cpp


示例19: NS_ENSURE_SUCCESS

// nsIDOMEventListener
NS_IMETHODIMP
nsUICommandCollector::HandleEvent(nsIDOMEvent* event)
{
  // First check that this is an event type that we expect.
  // If so, call the appropriate handler method.
  nsString type;
  nsresult rv = event->GetType(type);
  NS_ENSURE_SUCCESS(rv, rv);

  for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(kEvents); ++i) {
    if (NS_ConvertASCIItoUTF16(kEvents[i].event).Equals(type)) {
      return (this->*(kEvents[i].handler))(event);
    }
  }

  MS_LOG(("UICommandCollector: Unexpected event type %s received",
          NS_ConvertUTF16toUTF8(type).get()));
  return NS_ERROR_UNEXPECTED;
}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:20,代码来源:nsUICommandCollector.cpp


示例20: LinkInfo

void
WebGLProgram::GetActiveUniformBlockName(GLuint uniformBlockIndex, nsAString& retval) const
{
    if (!IsLinked()) {
        mContext->ErrorInvalidOperation("getActiveUniformBlockName: `program` must be linked.");
        return;
    }

    const webgl::LinkedProgramInfo* linkInfo = LinkInfo();
    GLuint uniformBlockCount = (GLuint) linkInfo->uniformBlocks.size();
    if (uniformBlockIndex >= uniformBlockCount) {
        mContext->ErrorInvalidValue("getActiveUniformBlockName: index %u invalid.", uniformBlockIndex);
        return;
    }

    const webgl::UniformBlockInfo* blockInfo = linkInfo->uniformBlocks[uniformBlockIndex];

    retval.Assign(NS_ConvertASCIItoUTF16(blockInfo->mBaseUserName));
}
开发者ID:Danielzac,项目名称:gecko-dev,代码行数:19,代码来源:WebGLProgram.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ NS_ConvertUTF16toUTF8函数代码示例发布时间:2022-05-30
下一篇:
C++ NS_CStringGetData函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap