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


C++ shared_ptr::Create方法代码示例

本文整理汇总了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;
}
开发者ID:F2EVarMan,项目名称:console,代码行数:11,代码来源:DlgSettingsMain.cpp

示例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();
}
开发者ID:presto53,项目名称:porto,代码行数:15,代码来源:task.cpp

示例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));
 }
开发者ID:arrrrrrr,项目名称:ebftpd,代码行数:6,代码来源:factory.hpp

示例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);
    }
开发者ID:davidni,项目名称:Win2D,代码行数:66,代码来源:CanvasEffectUnitTest.cpp


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