1
0
forked from 0ad/0ad

Adds std namespace to shared_ptr usages in gui and sound.

This was SVN commit r25526.
This commit is contained in:
Vladislav Belov 2021-05-22 19:23:03 +00:00
parent b03b560e71
commit babfd913fb
6 changed files with 26 additions and 26 deletions

View File

@ -94,7 +94,7 @@ void CollectVisibleObjectsRecursively(const std::vector<IGUIObject*>& objects, C
} // anonynous namespace
CGUI::CGUI(const shared_ptr<ScriptContext>& context)
CGUI::CGUI(const std::shared_ptr<ScriptContext>& context)
: m_BaseObject(std::make_unique<CGUIDummyObject>(*this)),
m_FocusedObject(nullptr),
m_InternalNameNumber(0),

View File

@ -62,7 +62,7 @@ private:
using ConstructObjectFunction = IGUIObject* (*)(CGUI&);
public:
CGUI(const shared_ptr<ScriptContext>& context);
CGUI(const std::shared_ptr<ScriptContext>& context);
~CGUI();
/**
@ -246,7 +246,7 @@ public:
GUIProxyProps* GetProxyData(const js::BaseProxyHandler* ptr) { return m_ProxyData.at(ptr).get(); }
shared_ptr<ScriptInterface> GetScriptInterface() { return m_ScriptInterface; };
std::shared_ptr<ScriptInterface> GetScriptInterface() { return m_ScriptInterface; };
private:
/**
@ -546,7 +546,7 @@ private:
//--------------------------------------------------------
//@{
shared_ptr<ScriptInterface> m_ScriptInterface;
std::shared_ptr<ScriptInterface> m_ScriptInterface;
/**
* don't want to pass this around with the

View File

@ -131,13 +131,13 @@ CGUIManager::SGUIPage::SGUIPage(const CStrW& pageName, const Script::StructuredC
{
}
void CGUIManager::SGUIPage::LoadPage(shared_ptr<ScriptContext> scriptContext)
void CGUIManager::SGUIPage::LoadPage(std::shared_ptr<ScriptContext> scriptContext)
{
// If we're hotloading then try to grab some data from the previous page
Script::StructuredClone hotloadData;
if (gui)
{
shared_ptr<ScriptInterface> scriptInterface = gui->GetScriptInterface();
std::shared_ptr<ScriptInterface> scriptInterface = gui->GetScriptInterface();
ScriptRequest rq(scriptInterface);
JS::RootedValue global(rq.cx, rq.globalValue());
@ -203,7 +203,7 @@ void CGUIManager::SGUIPage::LoadPage(shared_ptr<ScriptContext> scriptContext)
gui->LoadedXmlFiles();
shared_ptr<ScriptInterface> scriptInterface = gui->GetScriptInterface();
std::shared_ptr<ScriptInterface> scriptInterface = gui->GetScriptInterface();
ScriptRequest rq(scriptInterface);
JS::RootedValue initDataVal(rq.cx);
@ -245,7 +245,7 @@ void CGUIManager::SGUIPage::PerformCallbackFunction(Script::StructuredClone args
if (!callbackFunction)
return;
shared_ptr<ScriptInterface> scriptInterface = gui->GetScriptInterface();
std::shared_ptr<ScriptInterface> scriptInterface = gui->GetScriptInterface();
ScriptRequest rq(scriptInterface);
JS::RootedObject globalObj(rq.cx, rq.glob);
@ -403,7 +403,7 @@ const CParamNode& CGUIManager::GetTemplate(const std::string& templateName)
// This returns a shared_ptr to make sure the CGUI doesn't get deallocated
// while we're in the middle of calling a function on it (e.g. if a GUI script
// calls SwitchPage)
shared_ptr<CGUI> CGUIManager::top() const
std::shared_ptr<CGUI> CGUIManager::top() const
{
ENSURE(m_PageStack.size());
return m_PageStack.back().gui;

View File

@ -45,12 +45,12 @@ public:
CGUIManager();
~CGUIManager();
shared_ptr<ScriptInterface> GetScriptInterface()
std::shared_ptr<ScriptInterface> GetScriptInterface()
{
return m_ScriptInterface;
}
shared_ptr<ScriptContext> GetContext() { return m_ScriptContext; }
shared_ptr<CGUI> GetActiveGUI() { return top(); }
std::shared_ptr<ScriptContext> GetContext() { return m_ScriptContext; }
std::shared_ptr<CGUI> GetActiveGUI() { return top(); }
/**
* Returns the number of currently open GUI pages.
@ -136,7 +136,7 @@ private:
/**
* Create the CGUI with it's own ScriptInterface. Deletes the previous CGUI if it existed.
*/
void LoadPage(shared_ptr<ScriptContext> scriptContext);
void LoadPage(std::shared_ptr<ScriptContext> scriptContext);
/**
* Sets the callback handler when a new page is opened that will be performed when the page is closed.
@ -151,21 +151,21 @@ private:
CStrW m_Name;
std::unordered_set<VfsPath> inputs; // for hotloading
Script::StructuredClone initData; // data to be passed to the init() function
shared_ptr<CGUI> gui; // the actual GUI page
std::shared_ptr<CGUI> gui; // the actual GUI page
/**
* Function executed by this parent GUI page when the child GUI page it pushed is popped.
* Notice that storing it in the SGUIPage instead of CGUI means that it will survive the hotloading CGUI reset.
*/
shared_ptr<JS::PersistentRootedValue> callbackFunction;
std::shared_ptr<JS::PersistentRootedValue> callbackFunction;
};
const static CStr EventNameWindowResized;
shared_ptr<CGUI> top() const;
std::shared_ptr<CGUI> top() const;
shared_ptr<ScriptContext> m_ScriptContext;
shared_ptr<ScriptInterface> m_ScriptInterface;
std::shared_ptr<ScriptContext> m_ScriptContext;
std::shared_ptr<ScriptInterface> m_ScriptInterface;
using PageStackType = std::vector<SGUIPage>;
PageStackType m_PageStack;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -144,7 +144,7 @@ private:
class VorbisBufferAdapter
{
public:
VorbisBufferAdapter(const shared_ptr<u8>& buffer, size_t size)
VorbisBufferAdapter(const std::shared_ptr<u8>& buffer, size_t size)
: buffer(buffer)
, size(size)
, offset(0)
@ -202,7 +202,7 @@ public:
}
private:
shared_ptr<u8> buffer;
std::shared_ptr<u8> buffer;
off_t size;
off_t offset;
};
@ -310,7 +310,7 @@ Status OpenOggStream(const OsPath& pathname, OggStreamPtr& stream)
PFile file(new File);
RETURN_STATUS_IF_ERR(file->Open(pathname, L'r'));
shared_ptr<OggStreamImpl<VorbisFileAdapter>> tmp = std::make_shared<OggStreamImpl<VorbisFileAdapter>>(VorbisFileAdapter(file));
std::shared_ptr<OggStreamImpl<VorbisFileAdapter>> tmp = std::make_shared<OggStreamImpl<VorbisFileAdapter>>(VorbisFileAdapter(file));
RETURN_STATUS_IF_ERR(tmp->Open());
stream = tmp;
return INFO::OK;
@ -318,11 +318,11 @@ Status OpenOggStream(const OsPath& pathname, OggStreamPtr& stream)
Status OpenOggNonstream(const PIVFS& vfs, const VfsPath& pathname, OggStreamPtr& stream)
{
shared_ptr<u8> contents;
std::shared_ptr<u8> contents;
size_t size;
RETURN_STATUS_IF_ERR(vfs->LoadFile(pathname, contents, size));
shared_ptr<OggStreamImpl<VorbisBufferAdapter>> tmp = std::make_shared<OggStreamImpl<VorbisBufferAdapter>>(VorbisBufferAdapter(contents, size));
std::shared_ptr<OggStreamImpl<VorbisBufferAdapter>> tmp = std::make_shared<OggStreamImpl<VorbisBufferAdapter>>(VorbisBufferAdapter(contents, size));
RETURN_STATUS_IF_ERR(tmp->Open());
stream = tmp;
return INFO::OK;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2012 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -40,7 +40,7 @@ public:
virtual Status GetNextChunk(u8* buffer, size_t size) = 0;
};
typedef shared_ptr<OggStream> OggStreamPtr;
typedef std::shared_ptr<OggStream> OggStreamPtr;
extern Status OpenOggStream(const OsPath& pathname, OggStreamPtr& stream);