String::getHash rename String::getHashCode

This commit is contained in:
Nomango 2018-03-01 23:47:42 +08:00
parent 6331a4c111
commit 2e88860b32
5 changed files with 11 additions and 11 deletions

View File

@ -41,7 +41,7 @@ void e2d::Image::loadFrom(const String & strFilePath)
return;
}
m_pBitmap = s_mBitmapsFromFile.at(strFilePath.getHash());
m_pBitmap = s_mBitmapsFromFile.at(strFilePath.getHashCode());
m_fSourceClipX = m_fSourceClipY = 0;
m_fSourceClipWidth = m_pBitmap->GetSize().width;
m_fSourceClipHeight = m_pBitmap->GetSize().height;
@ -132,7 +132,7 @@ e2d::Point e2d::Image::getClipPos() const
bool e2d::Image::preload(const String & fileName)
{
if (s_mBitmapsFromFile.find(fileName.getHash()) != s_mBitmapsFromFile.end())
if (s_mBitmapsFromFile.find(fileName.getHashCode()) != s_mBitmapsFromFile.end())
{
return true;
}
@ -192,7 +192,7 @@ bool e2d::Image::preload(const String & fileName)
// 保存图片指针和图片的 Hash 名
s_mBitmapsFromFile.insert(
std::map<size_t, ID2D1Bitmap*>::value_type(
fileName.getHash(),
fileName.getHashCode(),
pBitmap)
);
}

View File

@ -292,7 +292,7 @@ int e2d::String::getLength() const
return static_cast<int>(m_str.size());
}
unsigned int e2d::String::getHash() const
unsigned int e2d::String::getHashCode() const
{
unsigned int hash = 0;

View File

@ -24,7 +24,7 @@ bool e2d::MusicManager::add(const String & strFilePath)
}
else
{
UINT nRet = strFilePath.getHash();
UINT nRet = strFilePath.getHashCode();
pPlayer = new Music();
if (pPlayer->_open(strFilePath))
@ -45,7 +45,7 @@ e2d::Music * e2d::MusicManager::get(const String & strFilePath)
if (strFilePath.isEmpty())
return nullptr;
UINT nRet = strFilePath.getHash();
UINT nRet = strFilePath.getHashCode();
if (getMusicList().end() != getMusicList().find(nRet))
return getMusicList()[nRet];

View File

@ -623,7 +623,7 @@ e2d::Node * e2d::Node::getChild(const String & name)
{
WARN_IF(name.isEmpty(), "Invalid Node name.");
unsigned int hash = name.getHash();
unsigned int hash = name.getHashCode();
for (auto child : m_vChildren)
{
@ -640,7 +640,7 @@ std::vector<e2d::Node*> e2d::Node::getChildren(const String & name)
WARN_IF(name.isEmpty(), "Invalid Node name.");
unsigned int hash = name.getHash();
unsigned int hash = name.getHashCode();
for (auto child : m_vChildren)
if (child->m_nHashName == hash && child->m_sName == name)
@ -703,7 +703,7 @@ void e2d::Node::removeChildren(const String & childName)
}
// 计算名称 Hash 值
unsigned int hash = childName.getHash();
unsigned int hash = childName.getHashCode();
size_t size = m_vChildren.size();
for (size_t i = 0; i < size; i++)
@ -860,7 +860,7 @@ void e2d::Node::setName(const String & name)
// 保存节点名
m_sName = name;
// 保存节点 Hash 名
m_nHashName = name.getHash();
m_nHashName = name.getHashCode();
}
}

View File

@ -68,7 +68,7 @@ public:
int getLength() const;
// 获取该字符串的散列值
unsigned int getHash() const;
unsigned int getHashCode() const;
// 后接字符串
String& append(