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


C++ GetURI函数代码示例

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


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

示例1: do_GetService

void
RasterImage::ReportDecoderError()
{
  nsCOMPtr<nsIConsoleService> consoleService =
    do_GetService(NS_CONSOLESERVICE_CONTRACTID);
  nsCOMPtr<nsIScriptError> errorObject =
    do_CreateInstance(NS_SCRIPTERROR_CONTRACTID);

  if (consoleService && errorObject) {
    nsAutoString msg(NS_LITERAL_STRING("Image corrupt or truncated."));
    nsAutoString src;
    if (GetURI()) {
      nsCString uri;
      if (GetURI()->GetSpecTruncatedTo1k(uri) == ImageURL::TruncatedTo1k) {
        msg += NS_LITERAL_STRING(" URI in this note truncated due to length.");
      }
      src = NS_ConvertUTF8toUTF16(uri);
    }
    if (NS_SUCCEEDED(errorObject->InitWithWindowID(
                       msg,
                       src,
                       EmptyString(), 0, 0, nsIScriptError::errorFlag,
                       "Image", InnerWindowID()
                     ))) {
      consoleService->LogMessage(errorObject);
    }
  }
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:28,代码来源:RasterImage.cpp

示例2: GetURI

void
Location::SetSearch(const nsAString& aSearch,
                    nsIPrincipal& aSubjectPrincipal,
                    ErrorResult& aRv)
{
  if (!CallerSubsumes(&aSubjectPrincipal)) {
    aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
    return;
  }

  nsCOMPtr<nsIURI> uri;
  aRv = GetURI(getter_AddRefs(uri));
  nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
  if (NS_WARN_IF(aRv.Failed()) || !url) {
    return;
  }

  if (nsIDocument* doc = GetEntryDocument()) {
    aRv = NS_MutateURI(uri)
            .SetQueryWithEncoding(NS_ConvertUTF16toUTF8(aSearch),
                                    doc->GetDocumentCharacterSet())
            .Finalize(uri);
  } else {
    aRv = NS_MutateURI(uri)
            .SetQuery(NS_ConvertUTF16toUTF8(aSearch))
            .Finalize(uri);
  }
  if (NS_WARN_IF(aRv.Failed())) {
    return;
  }

  aRv = SetURI(uri);
}
开发者ID:marcoscaceres,项目名称:gecko-dev,代码行数:33,代码来源:Location.cpp

示例3: hash

void
Location::SetHash(const nsAString& aHash,
                  nsIPrincipal& aSubjectPrincipal,
                  ErrorResult& aRv)
{
  if (!CallerSubsumes(&aSubjectPrincipal)) {
    aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
    return;
  }

  NS_ConvertUTF16toUTF8 hash(aHash);
  if (hash.IsEmpty() || hash.First() != char16_t('#')) {
    hash.Insert(char16_t('#'), 0);
  }

  nsCOMPtr<nsIURI> uri;
  aRv = GetURI(getter_AddRefs(uri));
  if (NS_WARN_IF(aRv.Failed()) || !uri) {
    return;
  }

  aRv = NS_MutateURI(uri)
          .SetRef(hash)
          .Finalize(uri);
  if (NS_WARN_IF(aRv.Failed()) || !uri) {
    return;
  }

  aRv = SetURI(uri);
}
开发者ID:marcoscaceres,项目名称:gecko-dev,代码行数:30,代码来源:Location.cpp

示例4: GetURI

NS_IMETHODIMP
Location::GetPort(nsAString& aPort)
{
  aPort.SetLength(0);

  nsCOMPtr<nsIURI> uri;
  nsresult result = NS_OK;

  result = GetURI(getter_AddRefs(uri), true);

  if (uri) {
    int32_t port;
    result = uri->GetPort(&port);

    if (NS_SUCCEEDED(result) && -1 != port) {
      nsAutoString portStr;
      portStr.AppendInt(port);
      aPort.Append(portStr);
    }

    // Don't propagate this exception to caller
    result = NS_OK;
  }

  return result;
}
开发者ID:OS2World,项目名称:APP-INTERNET-mozilla-os2,代码行数:26,代码来源:Location.cpp

示例5: iter

void URLMainThread::SetProtocol(const nsAString& aProtocol, ErrorResult& aRv) {
  nsAString::const_iterator start, end;
  aProtocol.BeginReading(start);
  aProtocol.EndReading(end);
  nsAString::const_iterator iter(start);

  FindCharInReadable(':', iter, end);

  // Changing the protocol of a URL, changes the "nature" of the URI
  // implementation. In order to do this properly, we have to serialize the
  // existing URL and reparse it in a new object.
  nsCOMPtr<nsIURI> clone;
  nsresult rv = NS_MutateURI(GetURI())
                    .SetScheme(NS_ConvertUTF16toUTF8(Substring(start, iter)))
                    .Finalize(clone);
  if (NS_WARN_IF(NS_FAILED(rv))) {
    return;
  }

  nsAutoCString href;
  rv = clone->GetSpec(href);
  if (NS_WARN_IF(NS_FAILED(rv))) {
    return;
  }

  nsCOMPtr<nsIURI> uri;
  rv = NS_NewURI(getter_AddRefs(uri), href);
  if (NS_WARN_IF(NS_FAILED(rv))) {
    return;
  }

  SetURI(uri.forget());
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:33,代码来源:URLMainThread.cpp

示例6: DownloadImage

	string DownloadImage(ThreadInfo* t, ImgMeta* Img){
		//creating temp file
		string FileName; 
		
		if(t->WorkDir != "")
			FileName = t->WorkDir + "\\" + Img->id + ".jpg";
		else
			FileName = (string)Img->id + ".jpg";

		FILE* f = fopen(FileName.c_str(), "wb");

		//setting up big file buffer
		if(f)
			setvbuf(f, 0, _IOFBF, FILE_BUFFER_SIZE);
		else
			return "";

		//retrieving url
		string URI = GetURI(Img, t->WantSize);

		//downloading file
		curl_easy_setopt(t->Curl, CURLOPT_URL, URI.c_str());
		curl_easy_setopt(t->Curl, CURLOPT_WRITEDATA, f);
		curl_easy_perform(t->Curl);

		fclose(f);

		return FileName;
	};
开发者ID:szavalishin,项目名称:FlickStat,代码行数:29,代码来源:WebThread_SP.cpp

示例7: GetURI

NS_IMETHODIMP
nsLocation::GetProtocol(nsAString& aProtocol)
{
  if (!CallerSubsumes())
    return NS_ERROR_DOM_SECURITY_ERR;

  aProtocol.SetLength(0);

  nsCOMPtr<nsIURI> uri;
  nsresult result = NS_OK;

  result = GetURI(getter_AddRefs(uri));

  if (uri) {
    nsAutoCString protocol;

    result = uri->GetScheme(protocol);

    if (NS_SUCCEEDED(result)) {
      CopyASCIItoUTF16(protocol, aProtocol);
      aProtocol.Append(PRUnichar(':'));
    }
  }

  return result;
}
开发者ID:kusl,项目名称:releases-mozilla-release,代码行数:26,代码来源:nsLocation.cpp

示例8: deserializeDataSource

lunchbox::URI deserializeDataSource( const ::zeq::Event& event )
{
    if( event.getType() != EVENT_DATASOURCE )
        return lunchbox::URI();

    auto data = GetURI( event.getData( ));
    return lunchbox::URI( data->uri()->c_str( ));
}
开发者ID:hernando,项目名称:Livre,代码行数:8,代码来源:events.cpp

示例9: GetURI

void nsPartChannel::SetContentDisposition(const nsACString& aContentDispositionHeader)
{
    mContentDispositionHeader = aContentDispositionHeader;
    nsCOMPtr<nsIURI> uri;
    GetURI(getter_AddRefs(uri));
    NS_GetFilenameFromDisposition(mContentDispositionFilename,
                                  mContentDispositionHeader, uri);
    mContentDisposition = NS_GetContentDispositionFromHeader(mContentDispositionHeader, this);
}
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:9,代码来源:nsMultiMixedConv.cpp

示例10: NS_ENSURE_ARG_POINTER

NS_IMETHODIMP
nsGeolocationRequest::GetRequestingURI(nsIURI * *aRequestingURI)
{
  NS_ENSURE_ARG_POINTER(aRequestingURI);

  nsCOMPtr<nsIURI> uri = mLocator->GetURI();
  uri.forget(aRequestingURI);

  return NS_OK;
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:10,代码来源:nsGeolocation.cpp

示例11: uri

already_AddRefed<nsIURI>
Link::GetURIToMutate()
{
  nsCOMPtr<nsIURI> uri(GetURI());
  if (!uri) {
    return nullptr;
  }
  nsCOMPtr<nsIURI> clone;
  (void)uri->Clone(getter_AddRefs(clone));
  return clone.forget();
}
开发者ID:alex-tifrea,项目名称:gecko-dev,代码行数:11,代码来源:Link.cpp

示例12: GetURI

NS_IMETHODIMP
nsLocation::GetHash(nsAString& aHash)
{
  if (!CallerSubsumes())
    return NS_ERROR_DOM_SECURITY_ERR;

  aHash.SetLength(0);

  nsCOMPtr<nsIURI> uri;
  nsresult rv = GetURI(getter_AddRefs(uri));
  if (NS_FAILED(rv) || !uri) {
    return rv;
  }

  nsCAutoString ref;
  nsAutoString unicodeRef;

  rv = uri->GetRef(ref);
  if (NS_SUCCEEDED(rv)) {
    nsCOMPtr<nsITextToSubURI> textToSubURI(
        do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv));

    if (NS_SUCCEEDED(rv)) {
      nsCAutoString charset;
      uri->GetOriginCharset(charset);
        
      rv = textToSubURI->UnEscapeURIForUI(charset, ref, unicodeRef);
    }
      
    if (NS_FAILED(rv)) {
      // Oh, well.  No intl here!
      NS_UnescapeURL(ref);
      CopyASCIItoUTF16(ref, unicodeRef);
      rv = NS_OK;
    }
  }

  if (NS_SUCCEEDED(rv) && !unicodeRef.IsEmpty()) {
    aHash.Assign(PRUnichar('#'));
    aHash.Append(unicodeRef);
  }

  if (aHash == mCachedHash) {
    // Work around ShareThis stupidly polling location.hash every
    // 5ms all the time by handing out the same exact string buffer
    // we handed out last time.
    aHash = mCachedHash;
  } else {
    mCachedHash = aHash;
  }

  return rv;
}
开发者ID:Ajunboys,项目名称:mozilla-os2,代码行数:53,代码来源:nsLocation.cpp

示例13: hrefURI

nsEventStates
Link::LinkState() const
{
  // We are a constant method, but we are just lazily doing things and have to
  // track that state.  Cast away that constness!
  Link *self = const_cast<Link *>(this);

  // If we are not in the document, default to not visited.
  Element *element = self->mElement;
  if (!element->IsInDoc()) {
    self->mLinkState = eLinkState_Unvisited;
  }

  // If we have not yet registered for notifications and are in an unknown
  // state, register now!
  if (!mRegistered && mLinkState == eLinkState_Unknown) {
    // First, make sure the href attribute has a valid link (bug 23209).
    nsCOMPtr<nsIURI> hrefURI(GetURI());
    if (!hrefURI) {
      self->mLinkState = eLinkState_NotLink;
      return nsEventStates();
    }

    // Assume that we are not visited until we are told otherwise.
    self->mLinkState = eLinkState_Unvisited;

    // We have a good href, so register with History.
    if (mHistory) {
      nsresult rv = mHistory->RegisterVisitedCallback(hrefURI, self);
      if (NS_SUCCEEDED(rv)) {
        self->mRegistered = true;

        // And make sure we are in the document's link map.
        nsIDocument *doc = element->GetCurrentDoc();
        if (doc) {
          doc->AddStyleRelevantLink(self);
        }
      }
    }
  }

  // Otherwise, return our known state.
  if (mLinkState == eLinkState_Visited) {
    return NS_EVENT_STATE_VISITED;
  }

  if (mLinkState == eLinkState_Unvisited) {
    return NS_EVENT_STATE_UNVISITED;
  }

  return nsEventStates();
}
开发者ID:gdestuynder,项目名称:releases-mozilla-central,代码行数:52,代码来源:Link.cpp

示例14: GetURI

void URL::UpdateURLSearchParams() {
  if (!mSearchParams) {
    return;
  }

  nsAutoCString search;
  nsresult rv = GetURI()->GetQuery(search);
  if (NS_WARN_IF(NS_FAILED(rv))) {
    search.Truncate();
  }

  mSearchParams->ParseInput(search);
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:13,代码来源:URL.cpp


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