IAnimReader: Make use of std::string_view where applicable

Same behavior, but allows interoperating with different string types in
a more straightforward manner.
This commit is contained in:
Lioncash 2020-03-31 03:05:05 -04:00
parent 13ce419554
commit 2c36b0bb83
11 changed files with 34 additions and 33 deletions

View File

@ -172,7 +172,7 @@ u32 CAnimSourceReaderBase::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOI
return 0;
}
bool CAnimSourceReaderBase::VGetBoolPOIState(const char* name) const {
bool CAnimSourceReaderBase::VGetBoolPOIState(std::string_view name) const {
const auto iter = std::find_if(x24_boolStates.cbegin(), x24_boolStates.cend(),
[name](const auto& entry) { return entry.first == name; });
@ -183,7 +183,7 @@ bool CAnimSourceReaderBase::VGetBoolPOIState(const char* name) const {
return iter->second;
}
s32 CAnimSourceReaderBase::VGetInt32POIState(const char* name) const {
s32 CAnimSourceReaderBase::VGetInt32POIState(std::string_view name) const {
const auto iter = std::find_if(x34_int32States.cbegin(), x34_int32States.cend(),
[name](const auto& entry) { return entry.first == name; });
@ -194,7 +194,7 @@ s32 CAnimSourceReaderBase::VGetInt32POIState(const char* name) const {
return iter->second;
}
CParticleData::EParentedMode CAnimSourceReaderBase::VGetParticlePOIState(const char* name) const {
CParticleData::EParentedMode CAnimSourceReaderBase::VGetParticlePOIState(std::string_view name) const {
const auto iter = std::find_if(x44_particleStates.cbegin(), x44_particleStates.cend(),
[name](const auto& entry) { return entry.first == name; });

View File

@ -68,9 +68,9 @@ public:
u32) const override;
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator,
u32) const override;
bool VGetBoolPOIState(const char* name) const override;
s32 VGetInt32POIState(const char* name) const override;
CParticleData::EParentedMode VGetParticlePOIState(const char* name) const override;
bool VGetBoolPOIState(std::string_view name) const override;
s32 VGetInt32POIState(std::string_view name) const override;
CParticleData::EParentedMode VGetParticlePOIState(std::string_view name) const override;
using IAnimReader::VGetOffset;
virtual zeus::CVector3f VGetOffset(const CSegId& seg, const CCharAnimTime& b) const = 0;

View File

@ -58,15 +58,15 @@ u32 CAnimTreeAnimReaderContainer::VGetSoundPOIList(const CCharAnimTime& time, CS
return x14_reader->GetSoundPOIList(time, listOut, capacity, iterator, unk);
}
bool CAnimTreeAnimReaderContainer::VGetBoolPOIState(const char* name) const {
bool CAnimTreeAnimReaderContainer::VGetBoolPOIState(std::string_view name) const {
return x14_reader->VGetBoolPOIState(name);
}
s32 CAnimTreeAnimReaderContainer::VGetInt32POIState(const char* name) const {
s32 CAnimTreeAnimReaderContainer::VGetInt32POIState(std::string_view name) const {
return x14_reader->VGetInt32POIState(name);
}
CParticleData::EParentedMode CAnimTreeAnimReaderContainer::VGetParticlePOIState(const char* name) const {
CParticleData::EParentedMode CAnimTreeAnimReaderContainer::VGetParticlePOIState(std::string_view name) const {
return x14_reader->VGetParticlePOIState(name);
}

View File

@ -37,9 +37,9 @@ public:
u32) const override;
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator,
u32) const override;
bool VGetBoolPOIState(const char*) const override;
s32 VGetInt32POIState(const char*) const override;
CParticleData::EParentedMode VGetParticlePOIState(const char*) const override;
bool VGetBoolPOIState(std::string_view name) const override;
s32 VGetInt32POIState(std::string_view name) const override;
CParticleData::EParentedMode VGetParticlePOIState(std::string_view name) const override;
void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut) const override;
void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut, const CCharAnimTime& time) const override;
std::unique_ptr<IAnimReader> VClone() const override;

View File

@ -101,11 +101,11 @@ u32 CAnimTreeDoubleChild::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOIN
return newCapacity;
}
bool CAnimTreeDoubleChild::VGetBoolPOIState(const char* name) const { return x18_b->VGetBoolPOIState(name); }
bool CAnimTreeDoubleChild::VGetBoolPOIState(std::string_view name) const { return x18_b->VGetBoolPOIState(name); }
s32 CAnimTreeDoubleChild::VGetInt32POIState(const char* name) const { return x18_b->VGetInt32POIState(name); }
s32 CAnimTreeDoubleChild::VGetInt32POIState(std::string_view name) const { return x18_b->VGetInt32POIState(name); }
CParticleData::EParentedMode CAnimTreeDoubleChild::VGetParticlePOIState(const char* name) const {
CParticleData::EParentedMode CAnimTreeDoubleChild::VGetParticlePOIState(std::string_view name) const {
return x18_b->VGetParticlePOIState(name);
}

View File

@ -41,9 +41,9 @@ public:
u32) const override;
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator,
u32) const override;
bool VGetBoolPOIState(const char* name) const override;
s32 VGetInt32POIState(const char* name) const override;
CParticleData::EParentedMode VGetParticlePOIState(const char* name) const override;
bool VGetBoolPOIState(std::string_view name) const override;
s32 VGetInt32POIState(std::string_view name) const override;
CParticleData::EParentedMode VGetParticlePOIState(std::string_view name) const override;
void VSetPhase(float) override;
SAdvancementResults VGetAdvancementResults(const CCharAnimTime& a, const CCharAnimTime& b) const override;
u32 Depth() const override;

View File

@ -35,11 +35,11 @@ u32 CAnimTreeSingleChild::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOIN
return x14_child->GetSoundPOIList(time, listOut, capacity, iterator, unk);
}
bool CAnimTreeSingleChild::VGetBoolPOIState(const char* name) const { return x14_child->VGetBoolPOIState(name); }
bool CAnimTreeSingleChild::VGetBoolPOIState(std::string_view name) const { return x14_child->VGetBoolPOIState(name); }
s32 CAnimTreeSingleChild::VGetInt32POIState(const char* name) const { return x14_child->VGetInt32POIState(name); }
s32 CAnimTreeSingleChild::VGetInt32POIState(std::string_view name) const { return x14_child->VGetInt32POIState(name); }
CParticleData::EParentedMode CAnimTreeSingleChild::VGetParticlePOIState(const char* name) const {
CParticleData::EParentedMode CAnimTreeSingleChild::VGetParticlePOIState(std::string_view name) const {
return x14_child->VGetParticlePOIState(name);
}

View File

@ -27,9 +27,9 @@ public:
u32) const override;
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator,
u32) const override;
bool VGetBoolPOIState(const char* name) const override;
s32 VGetInt32POIState(const char* name) const override;
CParticleData::EParentedMode VGetParticlePOIState(const char* name) const override;
bool VGetBoolPOIState(std::string_view name) const override;
s32 VGetInt32POIState(std::string_view name) const override;
CParticleData::EParentedMode VGetParticlePOIState(std::string_view name) const override;
void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut) const override;
void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut, const CCharAnimTime& time) const override;
void VSetPhase(float) override;

View File

@ -99,11 +99,11 @@ u32 CAnimTreeTimeScale::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINod
return ret;
}
bool CAnimTreeTimeScale::VGetBoolPOIState(const char* name) const { return x14_child->VGetBoolPOIState(name); }
bool CAnimTreeTimeScale::VGetBoolPOIState(std::string_view name) const { return x14_child->VGetBoolPOIState(name); }
s32 CAnimTreeTimeScale::VGetInt32POIState(const char* name) const { return x14_child->VGetInt32POIState(name); }
s32 CAnimTreeTimeScale::VGetInt32POIState(std::string_view name) const { return x14_child->VGetInt32POIState(name); }
CParticleData::EParentedMode CAnimTreeTimeScale::VGetParticlePOIState(const char* name) const {
CParticleData::EParentedMode CAnimTreeTimeScale::VGetParticlePOIState(std::string_view name) const {
return x14_child->VGetParticlePOIState(name);
}

View File

@ -34,9 +34,9 @@ public:
u32) const override;
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator,
u32) const override;
bool VGetBoolPOIState(const char* name) const override;
s32 VGetInt32POIState(const char* name) const override;
CParticleData::EParentedMode VGetParticlePOIState(const char* name) const override;
bool VGetBoolPOIState(std::string_view name) const override;
s32 VGetInt32POIState(std::string_view name) const override;
CParticleData::EParentedMode VGetParticlePOIState(std::string_view name) const override;
CAnimTreeEffectiveContribution VGetContributionOfHighestInfluence() const override;
std::shared_ptr<IAnimReader> VGetBestUnblendedChild() const override;

View File

@ -2,6 +2,7 @@
#include <memory>
#include <optional>
#include <string_view>
#include "Runtime/CToken.hpp"
#include "Runtime/RetroTypes.hpp"
@ -120,9 +121,9 @@ public:
u32) const = 0;
virtual u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator,
u32) const = 0;
virtual bool VGetBoolPOIState(const char*) const = 0;
virtual s32 VGetInt32POIState(const char*) const = 0;
virtual CParticleData::EParentedMode VGetParticlePOIState(const char*) const = 0;
virtual bool VGetBoolPOIState(std::string_view name) const = 0;
virtual s32 VGetInt32POIState(std::string_view name) const = 0;
virtual CParticleData::EParentedMode VGetParticlePOIState(std::string_view name) const = 0;
virtual void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut) const = 0;
virtual void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut,
const CCharAnimTime& time) const = 0;