From 290bdc4566fec10e4689991dd9c1a9ff65595b64 Mon Sep 17 00:00:00 2001 From: DHrpcs3 Date: Fri, 8 Jan 2016 01:07:55 +0200 Subject: [PATCH] added psf::object::get --- rpcs3/Loader/PSF.cpp | 12 ++++++++++++ rpcs3/Loader/PSF.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/rpcs3/Loader/PSF.cpp b/rpcs3/Loader/PSF.cpp index 8fa027d943..b0fcb22410 100644 --- a/rpcs3/Loader/PSF.cpp +++ b/rpcs3/Loader/PSF.cpp @@ -365,4 +365,16 @@ namespace psf { return m_entries.at(key); } + + const entry* object::get(const std::string &key) const + { + auto found = m_entries.find(key); + + if (found == m_entries.end()) + { + return nullptr; + } + + return &found->second; + } } diff --git a/rpcs3/Loader/PSF.h b/rpcs3/Loader/PSF.h index 690ab0a13f..1a24768d1e 100644 --- a/rpcs3/Loader/PSF.h +++ b/rpcs3/Loader/PSF.h @@ -81,6 +81,9 @@ namespace psf entry& operator[](const std::string &key); const entry& operator[](const std::string &key) const; + //returns pointer to entry or null, if not exists + const entry *get(const std::string &key) const; + bool exists(const std::string &key) const { return m_entries.find(key) != m_entries.end();