Pimpl declaration macros now define a make_pimpl(...) static helper function
This commit is contained in:
parent
a8aef622a1
commit
5e7aa7601d
11 changed files with 15 additions and 13 deletions
|
|
@ -52,7 +52,7 @@ namespace psemek::app
|
||||||
{}
|
{}
|
||||||
|
|
||||||
app::app(std::string const & name, int multisampling)
|
app::app(std::string const & name, int multisampling)
|
||||||
: pimpl_{std::make_unique<struct impl>(this)}
|
: pimpl_{make_impl(this)}
|
||||||
{
|
{
|
||||||
impl().start_time = clock::now();
|
impl().start_time = clock::now();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@ namespace psemek::audio
|
||||||
if (auto p = instance_ptr.lock(); p)
|
if (auto p = instance_ptr.lock(); p)
|
||||||
return p;
|
return p;
|
||||||
|
|
||||||
auto p = std::make_shared<struct impl>();
|
auto p = make_impl();
|
||||||
instance_ptr = p;
|
instance_ptr = p;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ void main()
|
||||||
};
|
};
|
||||||
|
|
||||||
hblur::hblur(int size, float sigma)
|
hblur::hblur(int size, float sigma)
|
||||||
: pimpl_{std::make_unique<struct impl>(size, sigma, true)}
|
: pimpl_{make_impl(size, sigma, true)}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
hblur::~hblur() = default;
|
hblur::~hblur() = default;
|
||||||
|
|
@ -156,7 +156,7 @@ void main()
|
||||||
};
|
};
|
||||||
|
|
||||||
vblur::vblur(int size, float sigma)
|
vblur::vblur(int size, float sigma)
|
||||||
: pimpl_{std::make_unique<struct impl>(size, sigma, false)}
|
: pimpl_{make_impl(size, sigma, false)}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
vblur::~vblur() = default;
|
vblur::~vblur() = default;
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ void main()
|
||||||
};
|
};
|
||||||
|
|
||||||
fxaa::fxaa()
|
fxaa::fxaa()
|
||||||
: pimpl_{std::make_unique<struct impl>()}
|
: pimpl_{make_impl()}
|
||||||
{
|
{
|
||||||
impl().program.bind();
|
impl().program.bind();
|
||||||
impl().program["u_input"] = 0;
|
impl().program["u_input"] = 0;
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ void main()
|
||||||
};
|
};
|
||||||
|
|
||||||
gamma_correction::gamma_correction()
|
gamma_correction::gamma_correction()
|
||||||
: pimpl_{std::make_unique<struct impl>()}
|
: pimpl_{make_impl()}
|
||||||
{
|
{
|
||||||
impl().program.bind();
|
impl().program.bind();
|
||||||
impl().program["u_input"] = 0;
|
impl().program["u_input"] = 0;
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ void main()
|
||||||
};
|
};
|
||||||
|
|
||||||
overlay::overlay()
|
overlay::overlay()
|
||||||
: pimpl_{std::make_unique<struct impl>()}
|
: pimpl_{make_impl()}
|
||||||
{
|
{
|
||||||
impl().program.bind();
|
impl().program.bind();
|
||||||
impl().program["u_texture"] = 0;
|
impl().program["u_texture"] = 0;
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ namespace psemek::gfx
|
||||||
};
|
};
|
||||||
|
|
||||||
painter::painter()
|
painter::painter()
|
||||||
: pimpl_{std::make_unique<struct impl>()}
|
: pimpl_{make_impl()}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
painter::~painter() = default;
|
painter::~painter() = default;
|
||||||
|
|
|
||||||
|
|
@ -878,7 +878,7 @@ void main(){}
|
||||||
};
|
};
|
||||||
|
|
||||||
deferred_renderer::deferred_renderer()
|
deferred_renderer::deferred_renderer()
|
||||||
: pimpl_{std::make_unique<struct impl>()}
|
: pimpl_{make_impl()}
|
||||||
{
|
{
|
||||||
impl().g_buffer_pass_program.bind();
|
impl().g_buffer_pass_program.bind();
|
||||||
impl().g_buffer_pass_program["u_texture"] = 0;
|
impl().g_buffer_pass_program["u_texture"] = 0;
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ void main()
|
||||||
};
|
};
|
||||||
|
|
||||||
simple_renderer::simple_renderer()
|
simple_renderer::simple_renderer()
|
||||||
: pimpl_{std::make_unique<struct impl>()}
|
: pimpl_{make_impl()}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
simple_renderer::~simple_renderer() = default;
|
simple_renderer::~simple_renderer() = default;
|
||||||
|
|
|
||||||
|
|
@ -1002,7 +1002,7 @@ namespace psemek::phys2d
|
||||||
}
|
}
|
||||||
|
|
||||||
engine::engine()
|
engine::engine()
|
||||||
: pimpl_{std::make_unique<struct impl>()}
|
: pimpl_{make_impl()}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
engine::~engine() = default;
|
engine::~engine() = default;
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,15 @@
|
||||||
struct impl; \
|
struct impl; \
|
||||||
std::unique_ptr<struct impl> pimpl_; \
|
std::unique_ptr<struct impl> pimpl_; \
|
||||||
struct impl & impl() { return *pimpl_; } \
|
struct impl & impl() { return *pimpl_; } \
|
||||||
struct impl const & impl() const { return *pimpl_; }
|
struct impl const & impl() const { return *pimpl_; } \
|
||||||
|
template <typename ... Args> static auto make_impl(Args && ... args) { return std::make_unique<struct impl>(std::forward<Args>(args)...); }
|
||||||
|
|
||||||
#define psemek_declare_shared_pimpl \
|
#define psemek_declare_shared_pimpl \
|
||||||
struct impl; \
|
struct impl; \
|
||||||
std::shared_ptr<struct impl> pimpl_; \
|
std::shared_ptr<struct impl> pimpl_; \
|
||||||
struct impl & impl() { return *pimpl_; } \
|
struct impl & impl() { return *pimpl_; } \
|
||||||
struct impl const & impl() const { return *pimpl_; }
|
struct impl const & impl() const { return *pimpl_; } \
|
||||||
|
template <typename ... Args> static auto make_impl(Args && ... args) { return std::make_shared<struct impl>(std::forward<Args>(args)...); }
|
||||||
|
|
||||||
namespace psemek::util::pimpl
|
namespace psemek::util::pimpl
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue