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.
|
|
|
|
*/
|
2019-01-01 20:54:57 +00:00
|
|
|
class IHashCalculator
|
2018-10-25 10:39:16 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-01-01 20:54:57 +00:00
|
|
|
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;
|
|
|
|
|
|
|
|
/**
|
2018-11-16 15:02:43 +00:00
|
|
|
* Calculate a property hash from the property's name.
|
2018-10-25 10:39:16 +00:00
|
|
|
* @param name The name of the property.
|
|
|
|
*/
|
2018-11-16 15:02:43 +00:00
|
|
|
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.
|
|
|
|
*/
|
2019-01-01 20:54:57 +00:00
|
|
|
class WizardHashCalculator : public IHashCalculator
|
2018-10-25 10:39:16 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
hash_t calculate_type_hash(const std::string& name) const override;
|
2018-11-16 15:02:43 +00:00
|
|
|
hash_t calculate_property_hash(const std::string& name) const override;
|
2018-10-25 10:39:16 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|