Add warning silence to fallback ID resolve

This commit is contained in:
Jack Andersen 2016-04-05 16:04:15 -10:00
parent a75bda77b6
commit 8f4cc0876e
3 changed files with 12 additions and 12 deletions

View File

@ -57,19 +57,19 @@ protected:
public: public:
PAKRouterBase(const SpecBase& dataSpec) : m_dataSpec(dataSpec) {} PAKRouterBase(const SpecBase& dataSpec) : m_dataSpec(dataSpec) {}
hecl::Database::Project& getProject() const {return m_dataSpec.getProject();} hecl::Database::Project& getProject() const {return m_dataSpec.getProject();}
virtual hecl::ProjectPath getWorking(const UniqueID32&) const virtual hecl::ProjectPath getWorking(const UniqueID32&, bool silenceWarnings=false) const
{ {
LogDNACommon.report(logvisor::Fatal, LogDNACommon.report(logvisor::Fatal,
"PAKRouter IDType mismatch; expected UniqueID32 specialization"); "PAKRouter IDType mismatch; expected UniqueID32 specialization");
return hecl::ProjectPath(); return hecl::ProjectPath();
} }
virtual hecl::ProjectPath getWorking(const UniqueID64&) const virtual hecl::ProjectPath getWorking(const UniqueID64&, bool silenceWarnings=false) const
{ {
LogDNACommon.report(logvisor::Fatal, LogDNACommon.report(logvisor::Fatal,
"PAKRouter IDType mismatch; expected UniqueID64 specialization"); "PAKRouter IDType mismatch; expected UniqueID64 specialization");
return hecl::ProjectPath(); return hecl::ProjectPath();
} }
virtual hecl::ProjectPath getWorking(const UniqueID128&) const virtual hecl::ProjectPath getWorking(const UniqueID128&, bool silenceWarnings=false) const
{ {
LogDNACommon.report(logvisor::Fatal, LogDNACommon.report(logvisor::Fatal,
"PAKRouter IDType mismatch; expected UniqueID128 specialization"); "PAKRouter IDType mismatch; expected UniqueID128 specialization");
@ -87,12 +87,12 @@ class UniqueIDBridge
static hecl::Database::Project* s_Project; static hecl::Database::Project* s_Project;
public: public:
template <class IDType> template <class IDType>
static hecl::ProjectPath TranslatePakIdToPath(const IDType& id) static hecl::ProjectPath TranslatePakIdToPath(const IDType& id, bool silenceWarnings=false)
{ {
if (!g_PakRouter) if (!g_PakRouter)
LogDNACommon.report(logvisor::Fatal, LogDNACommon.report(logvisor::Fatal,
"g_Project must be set to non-null before calling UniqueIDBridge::TranslatePakIdToPath"); "g_Project must be set to non-null before calling UniqueIDBridge::TranslatePakIdToPath");
return g_PakRouter->getWorking(id); return g_PakRouter->getWorking(id, silenceWarnings);
} }
static hecl::ProjectPath MakePathFromString(const std::string& str) static hecl::ProjectPath MakePathFromString(const std::string& str)
{ {
@ -228,7 +228,7 @@ public:
{ {
if (!operator bool()) if (!operator bool())
return; return;
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this); hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this, true);
if (!path) if (!path)
path = UniqueIDBridge::TranslatePakIdToPath(m_baseId); path = UniqueIDBridge::TranslatePakIdToPath(m_baseId);
if (!path) if (!path)

View File

@ -327,9 +327,9 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry) cons
} }
template <class BRIDGETYPE> template <class BRIDGETYPE>
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const IDType& id) const hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const IDType& id, bool silenceWarnings) const
{ {
return getWorking(lookupEntry(id)); return getWorking(lookupEntry(id, nullptr, silenceWarnings, false));
} }
template <class BRIDGETYPE> template <class BRIDGETYPE>
@ -379,9 +379,9 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getCooked(const EntryType* entry) const
} }
template <class BRIDGETYPE> template <class BRIDGETYPE>
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getCooked(const IDType& id) const hecl::ProjectPath PAKRouter<BRIDGETYPE>::getCooked(const IDType& id, bool silenceWarnings) const
{ {
return getCooked(lookupEntry(id)); return getCooked(lookupEntry(id, nullptr, silenceWarnings, false));
} }
template <class BRIDGETYPE> template <class BRIDGETYPE>

View File

@ -145,9 +145,9 @@ public:
hecl::ProjectPath getWorking(const EntryType* entry, hecl::ProjectPath getWorking(const EntryType* entry,
const ResExtractor<BRIDGETYPE>& extractor) const; const ResExtractor<BRIDGETYPE>& extractor) const;
hecl::ProjectPath getWorking(const EntryType* entry) const; hecl::ProjectPath getWorking(const EntryType* entry) const;
hecl::ProjectPath getWorking(const IDType& id) const; hecl::ProjectPath getWorking(const IDType& id, bool silenceWarnings=false) const;
hecl::ProjectPath getCooked(const EntryType* entry) const; hecl::ProjectPath getCooked(const EntryType* entry) const;
hecl::ProjectPath getCooked(const IDType& id) const; hecl::ProjectPath getCooked(const IDType& id, bool silenceWarnings=false) const;
bool isShared() bool isShared()
{ {
const PAKType* pak = m_pak.get(); const PAKType* pak = m_pak.get();