本文整理汇总了C++中resource函数的典型用法代码示例。如果您正苦于以下问题:C++ resource函数的具体用法?C++ resource怎么用?C++ resource使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了resource函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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);
}
示例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();
}
示例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());
}
示例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;
}
示例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 ); } );
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}
}
}
示例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);
}
示例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();
}
示例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;
}
示例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;
}