libki/include/ki/pclass/HashCalculator.h

46 lines
991 B
C
Raw Normal View History

2018-10-25 10:39:16 +00:00
#pragma once
#include <string>
namespace ki
{
namespace pclass
{
/**
* The type used to store a type/property hash.
*/
typedef uint32_t hash_t;
/**
* A base class for type/property hash calculators.
*/
class IHashCalculator
2018-10-25 10:39:16 +00:00
{
public:
virtual ~IHashCalculator() {};
2018-10-25 10:39:16 +00:00
/**
* Calculate a type hash from the type's name.
* @param name The name of the type.
*/
virtual hash_t calculate_type_hash(const std::string &name) const = 0;
/**
* Calculate a property hash from the property's name.
2018-10-25 10:39:16 +00:00
* @param name The name of the property.
*/
virtual hash_t calculate_property_hash(const std::string& name) const = 0;
2018-10-25 10:39:16 +00:00
};
/**
* A hash calculator that uses the algorithms found and used in
* Wizard101.
*/
class WizardHashCalculator : public IHashCalculator
2018-10-25 10:39:16 +00:00
{
public:
hash_t calculate_type_hash(const std::string& name) const override;
hash_t calculate_property_hash(const std::string& name) const override;
2018-10-25 10:39:16 +00:00
};
}
}