From babfd913fb5b895a675e032816060a33654f52fc Mon Sep 17 00:00:00 2001 From: vladislavbelov Date: Sat, 22 May 2021 19:23:03 +0000 Subject: [PATCH] Adds std namespace to shared_ptr usages in gui and sound. This was SVN commit r25526. --- source/gui/CGUI.cpp | 2 +- source/gui/CGUI.h | 6 +++--- source/gui/GUIManager.cpp | 10 +++++----- source/gui/GUIManager.h | 18 +++++++++--------- source/soundmanager/data/ogg.cpp | 12 ++++++------ source/soundmanager/data/ogg.h | 4 ++-- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/source/gui/CGUI.cpp b/source/gui/CGUI.cpp index 0bffc64d0d..21d5a2978e 100644 --- a/source/gui/CGUI.cpp +++ b/source/gui/CGUI.cpp @@ -94,7 +94,7 @@ void CollectVisibleObjectsRecursively(const std::vector& objects, C } // anonynous namespace -CGUI::CGUI(const shared_ptr& context) +CGUI::CGUI(const std::shared_ptr& context) : m_BaseObject(std::make_unique(*this)), m_FocusedObject(nullptr), m_InternalNameNumber(0), diff --git a/source/gui/CGUI.h b/source/gui/CGUI.h index fafc984917..f4a2e13f0d 100644 --- a/source/gui/CGUI.h +++ b/source/gui/CGUI.h @@ -62,7 +62,7 @@ private: using ConstructObjectFunction = IGUIObject* (*)(CGUI&); public: - CGUI(const shared_ptr& context); + CGUI(const std::shared_ptr& context); ~CGUI(); /** @@ -246,7 +246,7 @@ public: GUIProxyProps* GetProxyData(const js::BaseProxyHandler* ptr) { return m_ProxyData.at(ptr).get(); } - shared_ptr GetScriptInterface() { return m_ScriptInterface; }; + std::shared_ptr GetScriptInterface() { return m_ScriptInterface; }; private: /** @@ -546,7 +546,7 @@ private: //-------------------------------------------------------- //@{ - shared_ptr m_ScriptInterface; + std::shared_ptr m_ScriptInterface; /** * don't want to pass this around with the diff --git a/source/gui/GUIManager.cpp b/source/gui/GUIManager.cpp index 5b97680d8f..bcdad45832 100644 --- a/source/gui/GUIManager.cpp +++ b/source/gui/GUIManager.cpp @@ -131,13 +131,13 @@ CGUIManager::SGUIPage::SGUIPage(const CStrW& pageName, const Script::StructuredC { } -void CGUIManager::SGUIPage::LoadPage(shared_ptr scriptContext) +void CGUIManager::SGUIPage::LoadPage(std::shared_ptr scriptContext) { // If we're hotloading then try to grab some data from the previous page Script::StructuredClone hotloadData; if (gui) { - shared_ptr scriptInterface = gui->GetScriptInterface(); + std::shared_ptr scriptInterface = gui->GetScriptInterface(); ScriptRequest rq(scriptInterface); JS::RootedValue global(rq.cx, rq.globalValue()); @@ -203,7 +203,7 @@ void CGUIManager::SGUIPage::LoadPage(shared_ptr scriptContext) gui->LoadedXmlFiles(); - shared_ptr scriptInterface = gui->GetScriptInterface(); + std::shared_ptr 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 = gui->GetScriptInterface(); + std::shared_ptr 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 CGUIManager::top() const +std::shared_ptr CGUIManager::top() const { ENSURE(m_PageStack.size()); return m_PageStack.back().gui; diff --git a/source/gui/GUIManager.h b/source/gui/GUIManager.h index da7f5df858..52c2821ffd 100644 --- a/source/gui/GUIManager.h +++ b/source/gui/GUIManager.h @@ -45,12 +45,12 @@ public: CGUIManager(); ~CGUIManager(); - shared_ptr GetScriptInterface() + std::shared_ptr GetScriptInterface() { return m_ScriptInterface; } - shared_ptr GetContext() { return m_ScriptContext; } - shared_ptr GetActiveGUI() { return top(); } + std::shared_ptr GetContext() { return m_ScriptContext; } + std::shared_ptr 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); + void LoadPage(std::shared_ptr 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 inputs; // for hotloading Script::StructuredClone initData; // data to be passed to the init() function - shared_ptr gui; // the actual GUI page + std::shared_ptr 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 callbackFunction; + std::shared_ptr callbackFunction; }; const static CStr EventNameWindowResized; - shared_ptr top() const; + std::shared_ptr top() const; - shared_ptr m_ScriptContext; - shared_ptr m_ScriptInterface; + std::shared_ptr m_ScriptContext; + std::shared_ptr m_ScriptInterface; using PageStackType = std::vector; PageStackType m_PageStack; diff --git a/source/soundmanager/data/ogg.cpp b/source/soundmanager/data/ogg.cpp index 52a6a02643..19ad5b9f5e 100644 --- a/source/soundmanager/data/ogg.cpp +++ b/source/soundmanager/data/ogg.cpp @@ -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& buffer, size_t size) + VorbisBufferAdapter(const std::shared_ptr& buffer, size_t size) : buffer(buffer) , size(size) , offset(0) @@ -202,7 +202,7 @@ public: } private: - shared_ptr buffer; + std::shared_ptr 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> tmp = std::make_shared>(VorbisFileAdapter(file)); + std::shared_ptr> tmp = std::make_shared>(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 contents; + std::shared_ptr contents; size_t size; RETURN_STATUS_IF_ERR(vfs->LoadFile(pathname, contents, size)); - shared_ptr> tmp = std::make_shared>(VorbisBufferAdapter(contents, size)); + std::shared_ptr> tmp = std::make_shared>(VorbisBufferAdapter(contents, size)); RETURN_STATUS_IF_ERR(tmp->Open()); stream = tmp; return INFO::OK; diff --git a/source/soundmanager/data/ogg.h b/source/soundmanager/data/ogg.h index bff6bbc9fa..34612bd394 100644 --- a/source/soundmanager/data/ogg.h +++ b/source/soundmanager/data/ogg.h @@ -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 OggStreamPtr; +typedef std::shared_ptr OggStreamPtr; extern Status OpenOggStream(const OsPath& pathname, OggStreamPtr& stream);