本文整理汇总了C++中std::shared_ptr::Create方法的典型用法代码示例。如果您正苦于以下问题:C++ shared_ptr::Create方法的具体用法?C++ shared_ptr::Create怎么用?C++ shared_ptr::Create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::shared_ptr
的用法示例。
在下文中一共展示了shared_ptr::Create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddDialogToTree
HTREEITEM DlgSettingsMain::AddDialogToTree(const wstring& strName, const std::shared_ptr<DlgSettingsBase>& newDlg, CRect& rect, HTREEITEM htiParent /*= NULL*/)
{
newDlg->Create(m_hWnd, rect);
newDlg->SetWindowPos(HWND_TOP, rect.left, rect.top, 0, 0, SWP_NOSIZE);
HTREEITEM hItem = m_treeCtrl.InsertItem(strName.c_str(), htiParent, NULL);
if (hItem != NULL) m_settingsDlgMap.insert(SettingsDlgsMap::value_type(hItem, newDlg));
return hItem;
}
示例2: CreateTmpDir
TError TTask::CreateTmpDir(const TPath &path, std::shared_ptr<TFolder> &dir) const {
bool cleanup = path.ToString().find(config().container().tmp_dir()) == 0;
dir = std::make_shared<TFolder>(path, cleanup);
if (!dir->Exists()) {
TError error = dir->Create(0755, true);
if (error)
return error;
error = path.Chown(Env->Cred.Uid, Env->Cred.Gid);
if (error)
return error;
}
return TError::Success();
}
示例3: Create
cmd::CommandPtr Create(ftp::Client& client, const std::string& argStr,
const Args& args) const
{
if (!creator) return nullptr;
return cmd::CommandPtr(creator->Create(client, argStr, args));
}
示例4: VerifyEffectRealizationInputs
void VerifyEffectRealizationInputs(
std::shared_ptr<CanvasDrawingSessionManager> const& drawingSessionManager,
TestEffect* testEffect)
{
ComPtr<StubD2DDevice> stubDevice = Make<StubD2DDevice>();
ComPtr<StubD2DDeviceContextWithGetFactory> deviceContext = Make<StubD2DDeviceContextWithGetFactory>();
deviceContext->GetDeviceMethod.AllowAnyCallAlwaysCopyValueToParam(stubDevice);
deviceContext->DrawImageMethod.AllowAnyCall();
bool setInputCalled = false;
bool setInputCountCalled = false;
bool setValueCalled = false;
deviceContext->CreateEffectMethod.SetExpectedCalls(1,
[&](IID const&, ID2D1Effect** effect)
{
ComPtr<MockD2DEffect> mockEffect = Make<MockD2DEffect>();
mockEffect.CopyTo(effect);
mockEffect->MockSetInput =
[&]
{
Assert::IsFalse(setInputCalled);
setInputCalled = true;
};
mockEffect->MockSetInputCount =
[&]
{
Assert::IsFalse(setInputCountCalled);
setInputCountCalled = true;
return S_OK;
};
mockEffect->MockSetValue =
[&]
{
Assert::IsFalse(setValueCalled);
setValueCalled = true;
return S_OK;
};
return S_OK;
});
auto drawingSession = drawingSessionManager->Create(deviceContext.Get(), std::make_shared<StubCanvasDrawingSessionAdapter>());
Vector2 position = { 0, 0 };
drawingSession->DrawImage(testEffect, position);
Assert::IsTrue(setInputCalled);
Assert::IsTrue(setInputCountCalled);
Assert::IsTrue(setValueCalled);
// Drawing on a second device context that shares the same device should NOT rerealize the effect.
ComPtr<StubD2DDeviceContextWithGetFactory> deviceContext2 = Make<StubD2DDeviceContextWithGetFactory>();
deviceContext2->GetDeviceMethod.AllowAnyCallAlwaysCopyValueToParam(stubDevice);
deviceContext2->DrawImageMethod.AllowAnyCall();
deviceContext2->CreateEffectMethod.SetExpectedCalls(0);
auto drawingSession2 = drawingSessionManager->Create(deviceContext2.Get(), std::make_shared<StubCanvasDrawingSessionAdapter>());
drawingSession2->DrawImage(testEffect, position);
}