Skip to content

Commit

Permalink
Replace shared_ptr<Error> with unique_ptr<Error> in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mogemimi committed Dec 15, 2020
1 parent 1c50d81 commit c733c9d
Show file tree
Hide file tree
Showing 71 changed files with 102 additions and 102 deletions.
2 changes: 1 addition & 1 deletion examples/FeatureShowcase/Platform.Cocoa/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ - (void)applicationDidFinishLaunching:(NSNotification*)aNotification
bootstrap.SetWindow(self.window);
bootstrap.SetOpenGLEnabled(false);

bootstrap.OnError([](std::shared_ptr<Error>&& err) {
bootstrap.OnError([](std::unique_ptr<Error>&& err) {
Log::Critical("Pomdog", err->ToString());
});

Expand Down
2 changes: 1 addition & 1 deletion examples/FeatureShowcase/Platform.Win32/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int APIENTRY _tWinMain(
bootstrap.SetBackBufferSize(800, 480);
bootstrap.SetOpenGLEnabled(false);

bootstrap.OnError([](std::shared_ptr<Error>&& err) {
bootstrap.OnError([](std::unique_ptr<Error>&& err) {
Log::Critical("Pomdog", err->ToString());
#if defined(POMDOG_CRTDEBUG)
_CrtDbgBreak();
Expand Down
2 changes: 1 addition & 1 deletion examples/FeatureShowcase/Platform.X11/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int main(int argc, char** argv)
Pomdog::X11::Bootstrap bootstrap;
bootstrap.SetBackBufferSize(800, 480);

bootstrap.OnError([](std::shared_ptr<Error>&& err) {
bootstrap.OnError([](std::unique_ptr<Error>&& err) {
Log::Critical("Pomdog", err->ToString());
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ AnimationGraphTest::AnimationGraphTest(const std::shared_ptr<GameHost>& gameHost
{
}

std::shared_ptr<Error> AnimationGraphTest::Initialize()
std::unique_ptr<Error> AnimationGraphTest::Initialize()
{
auto assets = gameHost->GetAssetManager();
auto clock = gameHost->GetClock();

std::shared_ptr<Error> err;
std::unique_ptr<Error> err;

// NOTE: Create graphics command list
std::tie(commandList, err) = graphicsDevice->CreateGraphicsCommandList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AnimationGraphTest final : public Game {
public:
explicit AnimationGraphTest(const std::shared_ptr<GameHost>& gameHost);

[[nodiscard]] std::shared_ptr<Error>
[[nodiscard]] std::unique_ptr<Error>
Initialize() override;

void Update() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ AudioClipTest::AudioClipTest(const std::shared_ptr<GameHost>& gameHostIn)
{
}

std::shared_ptr<Error> AudioClipTest::Initialize()
std::unique_ptr<Error> AudioClipTest::Initialize()
{
auto assets = gameHost->GetAssetManager();
auto clock = gameHost->GetClock();

std::shared_ptr<Error> err;
std::unique_ptr<Error> err;

// NOTE: Create graphics command list
std::tie(commandList, err) = graphicsDevice->CreateGraphicsCommandList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class AudioClipTest final : public Game {
public:
explicit AudioClipTest(const std::shared_ptr<GameHost>& gameHost);

[[nodiscard]] std::shared_ptr<Error>
[[nodiscard]] std::unique_ptr<Error>
Initialize() override;

void Update() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ BasicEffectTest::BasicEffectTest(const std::shared_ptr<GameHost>& gameHostIn)
{
}

std::shared_ptr<Error> BasicEffectTest::Initialize()
std::unique_ptr<Error> BasicEffectTest::Initialize()
{
auto assets = gameHost->GetAssetManager();
auto clock = gameHost->GetClock();

std::shared_ptr<Error> err;
std::unique_ptr<Error> err;

// NOTE: Create graphics command list
std::tie(commandList, err) = graphicsDevice->CreateGraphicsCommandList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class BasicEffectTest final : public Game {
public:
explicit BasicEffectTest(const std::shared_ptr<GameHost>& gameHost);

[[nodiscard]] std::shared_ptr<Error>
[[nodiscard]] std::unique_ptr<Error>
Initialize() override;

void Update() override;
Expand Down
4 changes: 2 additions & 2 deletions examples/FeatureShowcase/Source/Beam2DTest/Beam2DTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ Beam2DTest::Beam2DTest(const std::shared_ptr<GameHost>& gameHostIn)
{
}

std::shared_ptr<Error> Beam2DTest::Initialize()
std::unique_ptr<Error> Beam2DTest::Initialize()
{
auto assets = gameHost->GetAssetManager();
auto clock = gameHost->GetClock();

std::shared_ptr<Error> err;
std::unique_ptr<Error> err;

// NOTE: Create graphics command list
std::tie(commandList, err) = graphicsDevice->CreateGraphicsCommandList();
Expand Down
2 changes: 1 addition & 1 deletion examples/FeatureShowcase/Source/Beam2DTest/Beam2DTest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Beam2DTest final : public Game {
public:
explicit Beam2DTest(const std::shared_ptr<GameHost>& gameHost);

[[nodiscard]] std::shared_ptr<Error>
[[nodiscard]] std::unique_ptr<Error>
Initialize() override;

void Update() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ BillboardBatchTest::BillboardBatchTest(const std::shared_ptr<GameHost>& gameHost
{
}

std::shared_ptr<Error> BillboardBatchTest::Initialize()
std::unique_ptr<Error> BillboardBatchTest::Initialize()
{
auto assets = gameHost->GetAssetManager();
auto clock = gameHost->GetClock();

std::shared_ptr<Error> err;
std::unique_ptr<Error> err;

// NOTE: Create graphics command list
std::tie(commandList, err) = graphicsDevice->CreateGraphicsCommandList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BillboardBatchTest final : public Game {
public:
explicit BillboardBatchTest(const std::shared_ptr<GameHost>& gameHost);

[[nodiscard]] std::shared_ptr<Error>
[[nodiscard]] std::unique_ptr<Error>
Initialize() override;

void Update() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ DistanceFieldFontTest::DistanceFieldFontTest(const std::shared_ptr<GameHost>& ga
{
}

std::shared_ptr<Error> DistanceFieldFontTest::Initialize()
std::unique_ptr<Error> DistanceFieldFontTest::Initialize()
{
auto assets = gameHost->GetAssetManager();
auto clock = gameHost->GetClock();

std::shared_ptr<Error> err;
std::unique_ptr<Error> err;

// NOTE: Create graphics command list
std::tie(commandList, err) = graphicsDevice->CreateGraphicsCommandList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class DistanceFieldFontTest final : public Game {
public:
explicit DistanceFieldFontTest(const std::shared_ptr<GameHost>& gameHost);

[[nodiscard]] std::shared_ptr<Error>
[[nodiscard]] std::unique_ptr<Error>
Initialize() override;

void Update() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ EditorGUITest::EditorGUITest(const std::shared_ptr<GameHost>& gameHostIn)
{
}

std::shared_ptr<Error> EditorGUITest::Initialize()
std::unique_ptr<Error> EditorGUITest::Initialize()
{
auto assets = gameHost->GetAssetManager();
auto clock = gameHost->GetClock();

std::shared_ptr<Error> err;
std::unique_ptr<Error> err;

// NOTE: Create graphics command list
std::tie(commandList, err) = graphicsDevice->CreateGraphicsCommandList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class EditorGUITest final : public Game {
public:
explicit EditorGUITest(const std::shared_ptr<GameHost>& gameHost);

[[nodiscard]] std::shared_ptr<Error>
[[nodiscard]] std::unique_ptr<Error>
Initialize() override;

void Update() override;
Expand Down
2 changes: 1 addition & 1 deletion examples/FeatureShowcase/Source/FeatureShowcaseGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ FeatureShowcaseGame::FeatureShowcaseGame(const std::shared_ptr<GameHost>& gameHo
{
}

std::shared_ptr<Error>
std::unique_ptr<Error>
FeatureShowcaseGame::Initialize()
{
window->SetTitle("Feature Showcase");
Expand Down
2 changes: 1 addition & 1 deletion examples/FeatureShowcase/Source/FeatureShowcaseGame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class FeatureShowcaseGame final : public Game {
public:
explicit FeatureShowcaseGame(const std::shared_ptr<GameHost>& gameHost);

[[nodiscard]] std::shared_ptr<Error>
[[nodiscard]] std::unique_ptr<Error>
Initialize() override;

void Update() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ GIFDecodeTest::GIFDecodeTest(const std::shared_ptr<GameHost>& gameHostIn)
{
}

std::shared_ptr<Error> GIFDecodeTest::Initialize()
std::unique_ptr<Error> GIFDecodeTest::Initialize()
{
auto assets = gameHost->GetAssetManager();
auto clock = gameHost->GetClock();

std::shared_ptr<Error> err;
std::unique_ptr<Error> err;

// NOTE: Create graphics command list
std::tie(commandList, err) = graphicsDevice->CreateGraphicsCommandList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class GIFDecodeTest final : public Game {
public:
explicit GIFDecodeTest(const std::shared_ptr<GameHost>& gameHost);

[[nodiscard]] std::shared_ptr<Error>
[[nodiscard]] std::unique_ptr<Error>
Initialize() override;

void Update() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ GLTFModelTest::GLTFModelTest(const std::shared_ptr<GameHost>& gameHostIn)
{
}

std::shared_ptr<Error> GLTFModelTest::Initialize()
std::unique_ptr<Error> GLTFModelTest::Initialize()
{
auto assets = gameHost->GetAssetManager();
auto clock = gameHost->GetClock();

std::shared_ptr<Error> err;
std::unique_ptr<Error> err;

// NOTE: Create graphics command list
std::tie(commandList, err) = graphicsDevice->CreateGraphicsCommandList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class GLTFModelTest final : public Game {
public:
explicit GLTFModelTest(const std::shared_ptr<GameHost>& gameHost);

[[nodiscard]] std::shared_ptr<Error>
[[nodiscard]] std::unique_ptr<Error>
Initialize() override;

void Update() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ GUISplitterTest::GUISplitterTest(const std::shared_ptr<GameHost>& gameHostIn)
{
}

std::shared_ptr<Error> GUISplitterTest::Initialize()
std::unique_ptr<Error> GUISplitterTest::Initialize()
{
auto assets = gameHost->GetAssetManager();
auto clock = gameHost->GetClock();

std::shared_ptr<Error> err;
std::unique_ptr<Error> err;

// NOTE: Create graphics command list
std::tie(commandList, err) = graphicsDevice->CreateGraphicsCommandList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class GUISplitterTest final : public Game {
public:
explicit GUISplitterTest(const std::shared_ptr<GameHost>& gameHost);

[[nodiscard]] std::shared_ptr<Error>
[[nodiscard]] std::unique_ptr<Error>
Initialize() override;

void Update() override;
Expand Down
4 changes: 2 additions & 2 deletions examples/FeatureShowcase/Source/GamepadTest/GamepadTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ GamepadTest::GamepadTest(const std::shared_ptr<GameHost>& gameHostIn)
{
}

std::shared_ptr<Error> GamepadTest::Initialize()
std::unique_ptr<Error> GamepadTest::Initialize()
{
auto assets = gameHost->GetAssetManager();
auto clock = gameHost->GetClock();

std::shared_ptr<Error> err;
std::unique_ptr<Error> err;

// NOTE: Create graphics command list
std::tie(commandList, err) = graphicsDevice->CreateGraphicsCommandList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class GamepadTest final : public Game {
public:
explicit GamepadTest(const std::shared_ptr<GameHost>& gameHost);

[[nodiscard]] std::shared_ptr<Error>
[[nodiscard]] std::unique_ptr<Error>
Initialize() override;

void Update() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ HTTPClientTest::HTTPClientTest(const std::shared_ptr<GameHost>& gameHostIn)
{
}

std::shared_ptr<Error> HTTPClientTest::Initialize()
std::unique_ptr<Error> HTTPClientTest::Initialize()
{
auto assets = gameHost->GetAssetManager();
auto clock = gameHost->GetClock();

std::shared_ptr<Error> err;
std::unique_ptr<Error> err;

// NOTE: Create graphics command list
std::tie(commandList, err) = graphicsDevice->CreateGraphicsCommandList();
Expand All @@ -33,7 +33,7 @@ std::shared_ptr<Error> HTTPClientTest::Initialize()
spriteFont->PrepareFonts("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345689.,!?-+/():;%&`'*#=[]\" ");

auto http = gameHost->GetHTTPClient();
auto callback = [this](const std::shared_ptr<HTTPResponse>& resp, const std::shared_ptr<Error>& err) {
auto callback = [this](const std::shared_ptr<HTTPResponse>& resp, const std::unique_ptr<Error>& err) {
if (err != nullptr) {
webText = err->ToString();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class HTTPClientTest final : public Game {
public:
explicit HTTPClientTest(const std::shared_ptr<GameHost>& gameHost);

[[nodiscard]] std::shared_ptr<Error>
[[nodiscard]] std::unique_ptr<Error>
Initialize() override;

void Update() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ HardwareInstancingTest::HardwareInstancingTest(const std::shared_ptr<GameHost>&
{
}

std::shared_ptr<Error> HardwareInstancingTest::Initialize()
std::unique_ptr<Error> HardwareInstancingTest::Initialize()
{
auto assets = gameHost->GetAssetManager();
auto clock = gameHost->GetClock();

std::shared_ptr<Error> err;
std::unique_ptr<Error> err;

// NOTE: Create graphics command list
std::tie(commandList, err) = graphicsDevice->CreateGraphicsCommandList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class HardwareInstancingTest final : public Game {
public:
explicit HardwareInstancingTest(const std::shared_ptr<GameHost>& gameHost);

[[nodiscard]] std::shared_ptr<Error>
[[nodiscard]] std::unique_ptr<Error>
Initialize() override;

void Update() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ ImageEffectsTest::ImageEffectsTest(const std::shared_ptr<GameHost>& gameHostIn)
{
}

std::shared_ptr<Error> ImageEffectsTest::Initialize()
std::unique_ptr<Error> ImageEffectsTest::Initialize()
{
auto assets = gameHost->GetAssetManager();
auto clock = gameHost->GetClock();

std::shared_ptr<Error> err;
std::unique_ptr<Error> err;

// NOTE: Create graphics command list
std::tie(commandList, err) = graphicsDevice->CreateGraphicsCommandList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ImageEffectsTest final : public Game {
public:
explicit ImageEffectsTest(const std::shared_ptr<GameHost>& gameHost);

[[nodiscard]] std::shared_ptr<Error>
[[nodiscard]] std::unique_ptr<Error>
Initialize() override;

void Update() override;
Expand Down
Loading

0 comments on commit c733c9d

Please sign in to comment.