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

C++ resource函数代码示例

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

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



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

示例1: resource

void
MP4Reader::UpdateIndex()
{
  if (!mIndexReady) {
    return;
  }

  AutoPinned<MediaResource> resource(mDecoder->GetResource());
  nsTArray<MediaByteRange> ranges;
  if (NS_SUCCEEDED(resource->GetCachedRanges(ranges))) {
    mDemuxer->UpdateIndex(ranges);
  }
}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:13,代码来源:MP4Reader.cpp


示例2: EnsureUpToDateIndex

media::TimeIntervals
MP4TrackDemuxer::GetBuffered()
{
  EnsureUpToDateIndex();
  AutoPinned<MediaResource> resource(mParent->mResource);
  MediaByteRangeSet byteRanges;
  nsresult rv = resource->GetCachedRanges(byteRanges);

  if (NS_FAILED(rv)) {
    return media::TimeIntervals();
  }

  return mIndex->ConvertByteRangesToTimeRanges(byteRanges);
}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:14,代码来源:MP4Demuxer.cpp


示例3: resource

TiXmlElement* XMLResourceLoader::LoadAndReturnRootXmlElement(const char* ResourceString)
{

	 Resource resource(ResourceString);
    shared_ptr<ResHandle> pResourceHandle = g_pApp->m_ResCache->GetHandle(&resource);  // this actually loads the XML file from the zip file
	if (pResourceHandle == NULL)
		{
			LOG("XML Resource not found, actor creation aborted:");
			LOG(ResourceString);
			return NULL;
		}
	shared_ptr<XMLResourceExtraData> pExtraData = static_pointer_cast<XMLResourceExtraData>(pResourceHandle->GetExtra());
    return pExtraData->GetRoot();
}
开发者ID:Ubuska,项目名称:WarpEngine,代码行数:14,代码来源:XmlResource.cpp


示例4: resource

void tst_QMediaResource::setResolution()
{
    QMediaResource resource(
            QUrl(QString::fromLatin1("file::///thumbs/test.png")),
            QString::fromLatin1("image/png"));

    QCOMPARE(resource.resolution(), QSize());

    resource.setResolution(QSize(120, 80));
    QCOMPARE(resource.resolution(), QSize(120, 80));

    resource.setResolution(QSize(-1, 23));
    QCOMPARE(resource.resolution(), QSize(-1, 23));

    resource.setResolution(QSize(-43, 34));
    QCOMPARE(resource.resolution(), QSize(-43, 34));

    resource.setResolution(QSize(64, -1));
    QCOMPARE(resource.resolution(), QSize(64, -1));

    resource.setResolution(QSize(64, -83));
    QCOMPARE(resource.resolution(), QSize(64, -83));

    resource.setResolution(QSize(-12, -83));
    QCOMPARE(resource.resolution(), QSize(-12, -83));

    resource.setResolution(QSize());
    QCOMPARE(resource.resolution(), QSize(-1, -1));

    resource.setResolution(120, 80);
    QCOMPARE(resource.resolution(), QSize(120, 80));

    resource.setResolution(-1, 23);
    QCOMPARE(resource.resolution(), QSize(-1, 23));

    resource.setResolution(-43, 34);
    QCOMPARE(resource.resolution(), QSize(-43, 34));

    resource.setResolution(64, -1);
    QCOMPARE(resource.resolution(), QSize(64, -1));

    resource.setResolution(64, -83);
    QCOMPARE(resource.resolution(), QSize(64, -83));

    resource.setResolution(-12, -83);
    QCOMPARE(resource.resolution(), QSize(-12, -83));

    resource.setResolution(-1, -1);
    QCOMPARE(resource.resolution(), QSize());
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:50,代码来源:tst_qmediaresource.cpp


示例5: SAFE_RELEASE

//
// Alpha_D3D11NormalTexturePixelShader::OnRestore()
//
HRESULT Alpha_D3D11NormalTexturePixelShader::OnRestore(Scene *pScene)
{
	HRESULT hr = S_OK;

    SAFE_RELEASE(m_pPixelShader);
	SAFE_RELEASE(m_pcbPSLighting);
	SAFE_RELEASE(m_pcbPSMaterial);

    shared_ptr<D3DRenderer11> d3dRenderer11 = static_pointer_cast<D3DRenderer11>(pScene->GetRenderer());

	//========================================================
    // Set up the pixel shader and related constant buffers
    ID3DBlob* pPixelShaderBuffer = NULL;

	// Load the file via the Resource controller
    std::string hlslFileName = "Effects\\Alpha_D3D11VertexPosNormalTexture.fx";
    Resource resource(hlslFileName.c_str());
    shared_ptr<ResHandle> pResourceHandle = g_pApp->m_ResCache->GetHandle(&resource);

	// Compile the shader
    if(FAILED(d3dRenderer11->CompileShader(pResourceHandle->Buffer(), pResourceHandle->Size(), hlslFileName.c_str(), "Alpha_PS", "ps_5_0", &pPixelShaderBuffer)))
    {
        SAFE_RELEASE (pPixelShaderBuffer);
        return hr;
    }

	// Create the shader
    if(SUCCEEDED(g_pDX11W->GetD3D11Device()->CreatePixelShader(pPixelShaderBuffer->GetBufferPointer(),
        pPixelShaderBuffer->GetBufferSize(), NULL, &m_pPixelShader)))
    {
        // Setup constant buffers
        D3D11_BUFFER_DESC constantBufferDesc;
		ZeroMemory(&constantBufferDesc, sizeof(constantBufferDesc));
        constantBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
        constantBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
        constantBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
        constantBufferDesc.MiscFlags = 0;

		// Create lighting constant buffer 
		constantBufferDesc.ByteWidth = sizeof(ConstantBuffer_Lighting);
		V_RETURN(g_pDX11W->GetD3D11Device()->CreateBuffer(&constantBufferDesc, NULL, &m_pcbPSLighting));

		// Create material constant buffer 
		constantBufferDesc.ByteWidth = sizeof(ConstantBuffer_Material);
		V_RETURN(g_pDX11W->GetD3D11Device()->CreateBuffer(&constantBufferDesc, NULL, &m_pcbPSMaterial));
    }

    SAFE_RELEASE(pPixelShaderBuffer);
    return hr;
}
开发者ID:JDHDEV,项目名称:AlphaEngine,代码行数:53,代码来源:DirectX11Pixel.cpp


示例6: resource

//! Instructs the content of the latest version to be cached.
void ObjectCore::requestLatestVersion()
{
	// Start caching the latest version.
	ObjectVersionCore* latest = this->latest();
	if( latest == 0 )
	{
		// Fetch information about the latest version.
		QString resource("/objects/%1/%2/latest?include=properties,propertiesForDisplay");
		QString args = resource.arg( m_id.type() ).arg( m_id.id() );
		QNetworkReply* reply = this->rest()->getJson( args );
		QObject::connect( reply, &QNetworkReply::finished,  [=]() {
			this->versionAvailable( reply, true ); } );
	}	
}
开发者ID:Fluxie,项目名称:MFiles-Sailfish,代码行数:15,代码来源:objectcore.cpp


示例7: NS_ENSURE_ARG_POINTER

NS_IMETHODIMP nsAbBSDirectory::DeleteDirectory(nsIAbDirectory *directory)
{
  NS_ENSURE_ARG_POINTER(directory);

  nsresult rv = EnsureInitialized();
  NS_ENSURE_SUCCESS(rv, rv);

  DIR_Server *server = nsnull;
  mServers.Get(directory, &server);

  if (!server)
    return NS_ERROR_FAILURE;

  GetDirectories getDirectories(server);
  mServers.EnumerateRead(GetDirectories_getDirectory,
                         (void*)&getDirectories);

  DIR_DeleteServerFromList(server);

  nsCOMPtr<nsIAbDirFactoryService> dirFactoryService = 
    do_GetService(NS_ABDIRFACTORYSERVICE_CONTRACTID,&rv);
  NS_ENSURE_SUCCESS (rv, rv);

  PRUint32 count = getDirectories.directories.Count();

  nsCOMPtr<nsIAbManager> abManager = do_GetService(NS_ABMANAGER_CONTRACTID);

  for (PRUint32 i = 0; i < count; i++) {
    nsCOMPtr<nsIAbDirectory> d = getDirectories.directories[i];

    mServers.Remove(d);
    rv = mSubDirectories.RemoveObject(d);

    if (abManager)
      abManager->NotifyDirectoryDeleted(this, d);

    nsCOMPtr<nsIRDFResource> resource(do_QueryInterface (d, &rv));
    nsCString uri;
    resource->GetValueUTF8(uri);

    nsCOMPtr<nsIAbDirFactory> dirFactory;
    rv = dirFactoryService->GetDirFactory(uri, getter_AddRefs(dirFactory));
    if (NS_FAILED(rv))
      continue;

    rv = dirFactory->DeleteDirectory(d);
  }

  return rv;
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:50,代码来源:nsAbBSDirectory.cpp


示例8: pref

http::doc pref()
{
	http::doc ret = resource("html/pref.html");
	std::vector<std::string> sects = templ::split(ret.content(), 3, "pref.html");
	std::stringstream buf{};
	buf << sects[0];
	for (const std::string &prefname : prefs::list())
	{
		buf << templ::render(sects[1], {{"name", prefs::desc(prefname)}, {"key", prefname}, {"value", prefs::getstr(prefname)}, {"type", prefs::type(prefname)}});
	}
	buf << sects[2];
	ret.content(buf.str());
	return ret;
}
开发者ID:showermat,项目名称:zsr-utils,代码行数:14,代码来源:zsrsrv.cpp


示例9: ASSERT

void PendingScript::watchForLoad(ScriptResourceClient* client)
{
    ASSERT(!m_watchingForLoad);
    // addClient() will call notifyFinished() if the load is complete. Callers
    // who do not expect to be re-entered from this call should not call
    // watchForLoad for a PendingScript which isReady. We also need to set
    // m_watchingForLoad early, since addClient() can result in calling
    // notifyFinished and further stopWatchingForLoad().
    m_watchingForLoad = true;
    if (m_streamer) {
        m_streamer->addClient(client);
    } else {
        resource()->addClient(client);
    }
}
开发者ID:dstockwell,项目名称:blink,代码行数:15,代码来源:PendingScript.cpp


示例10: resource

MaterialNode::MaterialNode(std::string sMaterialResourceName, WeakBaseRenderComponentPtr renderComponent)
{
	Resource resource(sMaterialResourceName);
	shared_ptr<ResHandle> handle = g_pApp->m_ResCache->GetHandle(&resource);

	if (handle.get() == NULL)
	{
		CHG_ERROR("Not found material resource: " + sMaterialResourceName);
	}

	m_pMaterial = ((MaterialResourceExtraData*)handle->GetExtra().get())->GetMaterial();

	m_pRenderComponent = renderComponent;
	m_bActivePOM = false;
}
开发者ID:ClowReed32,项目名称:Cthugha-Engine-Demos,代码行数:15,代码来源:Material.cpp


示例11: onDraw

 void onDraw(const int loops, SkCanvas* canvas) override {
     if (!fContext) {
         return;
     }
     GrResourceCache* cache = fContext->getResourceCache();
     SkASSERT(CACHE_SIZE_COUNT == cache->getResourceCount());
     for (int i = 0; i < loops; ++i) {
         for (int k = 0; k < CACHE_SIZE_COUNT; ++k) {
             GrUniqueKey key;
             BenchResource::ComputeKey(k, fKeyData32Count, &key);
             SkAutoTUnref<GrGpuResource> resource(cache->findAndRefUniqueResource(key));
             SkASSERT(resource);
         }
     }
 }
开发者ID:mariospr,项目名称:chromium-browser,代码行数:15,代码来源:GrResourceCacheBench.cpp


示例12: if

void EncodeDock::onProducerOpened()
{
    if (MLT.isSeekable())
        ui->encodeButton->setText(tr("Export File"));
    else
        ui->encodeButton->setText(tr("Capture File"));

    ui->fromCombo->blockSignals(true);
    ui->fromCombo->clear();
    if (MAIN.multitrack())
        ui->fromCombo->addItem(tr("Timeline"), "timeline");
    if (MAIN.playlist() && MAIN.playlist()->count() > 0)
        ui->fromCombo->addItem(tr("Playlist"), "playlist");
    if (MAIN.playlist() && MAIN.playlist()->count() > 1)
        ui->fromCombo->addItem(tr("Each Playlist Item"), "batch");
    if (MLT.isClip() && MLT.producer() && MLT.producer()->is_valid()) {
        if (MLT.producer()->get(kShotcutCaptionProperty)) {
            ui->fromCombo->addItem(MLT.producer()->get(kShotcutCaptionProperty), "clip");
        } else if (MLT.producer()->get("resource")) {
            QFileInfo resource(MLT.producer()->get("resource"));
            ui->fromCombo->addItem(resource.completeBaseName(), "clip");
        } else {
            ui->fromCombo->addItem(tr("Source"), "clip");
        }
    } else if (MLT.savedProducer() && MLT.savedProducer()->is_valid()) {
        if (MLT.savedProducer()->get(kShotcutCaptionProperty)) {
            ui->fromCombo->addItem(MLT.savedProducer()->get(kShotcutCaptionProperty), "clip");
        } else if (MLT.savedProducer()->get("resource")) {
            QFileInfo resource(MLT.savedProducer()->get("resource"));
            ui->fromCombo->addItem(resource.completeBaseName(), "clip");
        } else {
            ui->fromCombo->addItem(tr("Source"), "clip");
        }
    }
    ui->fromCombo->blockSignals(false);
}
开发者ID:UriChan,项目名称:shotcut,代码行数:36,代码来源:encodedock.cpp


示例13: resource

bool QResourceFileEngineIterator::hasNext() const
{
    if (index == -1) {
        // Lazy initialization of the iterator
        QResource resource(path());
        if (!resource.isValid())
            return false;

        // Initialize and move to the next entry.
        entries = resource.children();
        index = 0;
    }

    return index < entries.size();
}
开发者ID:phanimohan,项目名称:phantomjs,代码行数:15,代码来源:qresource_iterator.cpp


示例14: resource

//
// Alpha_Hlsl_LineShader::SetTexture                               - Chapter 15, page 519
//
HRESULT Alpha_Hlsl_LineShader::SetTexture(const std::string& textureName)
{
    m_textureResource = textureName;
    if (m_textureResource.length() > 0)
    {
        Resource resource(m_textureResource);
        shared_ptr<ResHandle> texture = g_pApp->m_ResCache->GetHandle(&resource);
        if (texture)
        {
            shared_ptr<D3DTextureResourceExtraData11> extra = static_pointer_cast<D3DTextureResourceExtraData11>(texture->GetExtra());
            SetTexture(extra->GetTexture(), extra->GetSampler());
        }
    }
    return S_OK;
}
开发者ID:JDHDEV,项目名称:AlphaEngine,代码行数:18,代码来源:Shaders.cpp


示例15: resource

SkinsPlugIn::~SkinsPlugIn()
{
   if (mpSkinsMenu != NULL)
   {
      qApp->setStyleSheet(mDefaultStyleSheet);
      QMapIterator<QString, QString> resource(mRegisteredResources);
      while (resource.hasNext())
      {
         resource.next();
         QResource::unregisterResource(resource.value(), resource.key());
      }
      Service<DesktopServices>()->getMainMenuBar()->removeMenu(mpSkinsMenu);
   }
   delete mpSkinsMenu;
}
开发者ID:Siddharthk,项目名称:coan,代码行数:15,代码来源:SkinsPlugIn.cpp


示例16: handleNormalReceivedMessage

Message JabberChatService::handleNormalReceivedMessage(const QXmppMessage &xmppMessage)
{
	auto jid = Jid::parse(xmppMessage.from());

	auto contact = ContactManager::instance()->byId(account(), jid.bare(), ActionCreateAndAdd);
	auto chat = ChatTypeContact::findChat(contact, ActionCreateAndAdd);

	contact.addProperty("jabber:chat-resource", jid.resource(), CustomProperties::NonStorable);

	auto message = Message::create();
	message.setMessageChat(chat);
	message.setMessageSender(contact);

	return message;
}
开发者ID:leewood,项目名称:kadu,代码行数:15,代码来源:jabber-chat-service.cpp


示例17: resource

void
MP4TrackDemuxer::EnsureUpToDateIndex()
{
  if (!mNeedReIndex) {
    return;
  }
  AutoPinned<MediaResource> resource(mParent->mResource);
  MediaByteRangeSet byteRanges;
  nsresult rv = resource->GetCachedRanges(byteRanges);
  if (NS_FAILED(rv)) {
    return;
  }
  mIndex->UpdateMoofIndex(byteRanges);
  mNeedReIndex = false;
}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:15,代码来源:MP4Demuxer.cpp


示例18: MG_SITE_SERVICE_TRY

void MgServerSiteService::DestroySession(CREFSTRING session)
{
    MG_SITE_SERVICE_TRY()

    MG_LOG_TRACE_ENTRY(L"MgServerSiteService::DestroySession()");

    MgResourceIdentifier resource(MgRepositoryType::Session, session,
        L"", L"", MgResourceType::Folder);

    GetResourceService().DeleteRepository(&resource);
    MgLongTransactionManager::RemoveLongTransactionNames(session);
    MgSessionManager::RemoveSession(session);

    MG_SITE_SERVICE_CATCH_AND_THROW(L"MgServerSiteService.DestroySession")
}
开发者ID:kanbang,项目名称:Colt,代码行数:15,代码来源:ServerSiteService.cpp


示例19: resource

  bool BaseGameLogic::loadGame(const std::string& resource_name)
  {
    LOGI << "Loading game from resource '" << resource_name << "'." << endl;
    LOGINC;

    // Load the resource.
    LOGI << "Loading the resource." << endl;
    Resource resource(resource_name);
    StrongResourceHandlePtr resource_handle = res_cache_->getHandle(resource);

    // Parse the resource.
    LOGI << "Parsing the resource." << endl;
    rapidxml::xml_document<> xml_doc;
    xml_doc.parse<0>(reinterpret_cast<char*>(resource_handle->getBuffer()));

    // Get the root node (Should normally be <World>).
    rapidxml::xml_node<>* xml_root = xml_doc.first_node();
    if (!xml_root)
    {
      LOGE << "No root node in game resource '" << resource_name << "'."
           << endl;
      return false;
    }
    LOG(LOGDEBUG) << "Root node: '" << xml_root->name() << "'." << endl;

    // Iterate over all actor nodes and create the actors.
    rapidxml::xml_node<>* xml_actor = xml_root->first_node("Actor");
    while (xml_actor)
    {
      std::string actor_resource =
          xml_actor->first_attribute("resource")->value();
      LOG(LOGDEBUG) << "Actor node resource attribute: '" << actor_resource
                    << "'." << endl;

      if (!createActor(actor_resource))
      {
        LOGE << "Creation of actor from resource '" << actor_resource
             << "' failed." << endl;
        return false;
      }

      xml_actor = xml_actor->next_sibling();
    }

    LOGDEC;

    return true;
  }
开发者ID:knuke,项目名称:GEngine,代码行数:48,代码来源:BaseGameLogic.cpp


示例20: content

http::doc content(Volume &vol, const std::string &path, bool toolbar = false)
{
	if (! path.size()) return http::redirect(http::mkpath({"content", vol.id(), vol.info("home")}));
	try
	{
		std::pair<std::string, std::string> contpair = vol.get(path);
		if (toolbar && contpair.first == "text/html")
		{
			http::doc toolbar = resource("html/toolbar.html");
			toolbar.content(templ::render(toolbar.content(), vol.tokens(path)));
			contpair.second = inject(contpair.second, toolbar.content());
		}
		return http::doc{contpair.first, contpair.second};
	}
	catch (Volume::error &e) { return error(e.header(), e.body()); }
}
开发者ID:showermat,项目名称:zsr-utils,代码行数:16,代码来源:zsrsrv.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ resourceOffers函数代码示例发布时间:2022-05-30
下一篇:
C++ resolver函数代码示例发布时间: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