Update StringIdPool to use AZ::u32 instead of uint32

Signed-off-by: Chris Burel <burelc@amazon.com>
This commit is contained in:
Chris Burel
2021-05-24 12:03:41 -07:00
parent 0a56c17519
commit c3ff3f342d
2 changed files with 12 additions and 31 deletions
@@ -50,14 +50,7 @@ namespace MCore
* @param id The unique id to search for the name.
* @return The name of the given object.
*/
const AZStd::string& GetName(uint32 id);
/**
* Return the name of the given id.
* @param id The unique id to search for the name.
* @return The name of the given object.
*/
const AZStd::string& GetStringById(AZ::u32 id);
const AZStd::string& GetName(AZ::u32 id);
/**
* Reserve space for a given amount of strings.
@@ -84,17 +77,15 @@ namespace MCore
/**
* The StringIdPoolIndex is a helper class to aid with serialization of
* class members that store indexes into the StringIdPool. Members of this
* type will serialize to a string, and deserialize to a uint32, while
* type will serialize to a string, and deserialize to a AZ::u32, while
* allowing the StringIdPool to deduplicate the strings.
*/
struct StringIdPoolIndex
{
AZ::u32 m_index;
AZ::u32 m_index{};
StringIdPoolIndex() : m_index(0) {}
StringIdPoolIndex(uint32 index) : m_index(index) {}
operator uint32() const { return m_index; }
bool operator==(uint32 rhs) const { return m_index == rhs; }
operator AZ::u32() const { return m_index; }
bool operator==(AZ::u32 rhs) const { return m_index == rhs; }
static void Reflect(AZ::ReflectContext* context);
};
@@ -104,4 +95,4 @@ namespace MCore
namespace AZ
{
AZ_TYPE_INFO_SPECIALIZE(MCore::StringIdPoolIndex, "{C374F051-8323-49DB-A1BD-C6B6CF0333C0}")
}
} // namespace AZ