mirror of https://github.com/AxioDL/boo.git
switched to unique_ptr due to expected app main use
This commit is contained in:
parent
87ab129e01
commit
2c2991d44e
|
@ -56,7 +56,7 @@ public:
|
|||
|
||||
};
|
||||
|
||||
std::shared_ptr<IApplication>
|
||||
std::unique_ptr<IApplication>
|
||||
ApplicationBootstrap(IApplication::EPlatformType platform,
|
||||
IApplicationCallback& cb,
|
||||
const std::string& uniqueName,
|
||||
|
@ -66,7 +66,7 @@ ApplicationBootstrap(IApplication::EPlatformType platform,
|
|||
bool singleInstance=true);
|
||||
extern IApplication* APP;
|
||||
|
||||
static inline std::shared_ptr<IApplication>
|
||||
static inline std::unique_ptr<IApplication>
|
||||
ApplicationBootstrap(IApplication::EPlatformType platform,
|
||||
IApplicationCallback& cb,
|
||||
const std::string& uniqueName,
|
||||
|
@ -75,7 +75,7 @@ ApplicationBootstrap(IApplication::EPlatformType platform,
|
|||
bool singleInstance=true)
|
||||
{
|
||||
if (APP)
|
||||
return std::shared_ptr<IApplication>(APP);
|
||||
return std::unique_ptr<IApplication>();
|
||||
std::vector<std::string> args;
|
||||
for (int i=1 ; i<argc ; ++i)
|
||||
args.push_back(argv[i]);
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace boo
|
|||
{
|
||||
|
||||
IApplication* APP = NULL;
|
||||
std::shared_ptr<IApplication> ApplicationBootstrap(IApplication::EPlatformType platform,
|
||||
std::unique_ptr<IApplication> ApplicationBootstrap(IApplication::EPlatformType platform,
|
||||
IApplicationCallback& cb,
|
||||
const std::string& uniqueName,
|
||||
const std::string& friendlyName,
|
||||
|
@ -56,17 +56,16 @@ std::shared_ptr<IApplication> ApplicationBootstrap(IApplication::EPlatformType p
|
|||
const std::vector<std::string>& args,
|
||||
bool singleInstance)
|
||||
{
|
||||
if (!APP)
|
||||
{
|
||||
if (platform == IApplication::PLAT_WAYLAND)
|
||||
APP = new ApplicationWayland(cb, uniqueName, friendlyName, pname, args, singleInstance);
|
||||
else if (platform == IApplication::PLAT_XCB ||
|
||||
platform == IApplication::PLAT_AUTO)
|
||||
APP = new ApplicationXCB(cb, uniqueName, friendlyName, pname, args, singleInstance);
|
||||
else
|
||||
return std::shared_ptr<IApplication>();
|
||||
}
|
||||
return std::shared_ptr<IApplication>(APP);
|
||||
if (APP)
|
||||
return std::unique_ptr<IApplication>();
|
||||
if (platform == IApplication::PLAT_WAYLAND)
|
||||
APP = new ApplicationWayland(cb, uniqueName, friendlyName, pname, args, singleInstance);
|
||||
else if (platform == IApplication::PLAT_XCB ||
|
||||
platform == IApplication::PLAT_AUTO)
|
||||
APP = new ApplicationXCB(cb, uniqueName, friendlyName, pname, args, singleInstance);
|
||||
else
|
||||
return std::unique_ptr<IApplication>();
|
||||
return std::unique_ptr<IApplication>(APP);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ struct TestApplicationCallback : IApplicationCallback
|
|||
int main(int argc, const char** argv)
|
||||
{
|
||||
boo::TestApplicationCallback appCb;
|
||||
std::shared_ptr<boo::IApplication> app =
|
||||
std::unique_ptr<boo::IApplication> app =
|
||||
ApplicationBootstrap(boo::IApplication::PLAT_AUTO,
|
||||
appCb, "rwk", "RWK", argc, argv);
|
||||
app->run();
|
||||
|
|
Loading…
Reference in New Issue