String::getHash rename String::getHashCode
This commit is contained in:
parent
6331a4c111
commit
2e88860b32
|
|
@ -41,7 +41,7 @@ void e2d::Image::loadFrom(const String & strFilePath)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pBitmap = s_mBitmapsFromFile.at(strFilePath.getHash());
|
m_pBitmap = s_mBitmapsFromFile.at(strFilePath.getHashCode());
|
||||||
m_fSourceClipX = m_fSourceClipY = 0;
|
m_fSourceClipX = m_fSourceClipY = 0;
|
||||||
m_fSourceClipWidth = m_pBitmap->GetSize().width;
|
m_fSourceClipWidth = m_pBitmap->GetSize().width;
|
||||||
m_fSourceClipHeight = m_pBitmap->GetSize().height;
|
m_fSourceClipHeight = m_pBitmap->GetSize().height;
|
||||||
|
|
@ -132,7 +132,7 @@ e2d::Point e2d::Image::getClipPos() const
|
||||||
|
|
||||||
bool e2d::Image::preload(const String & fileName)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -192,7 +192,7 @@ bool e2d::Image::preload(const String & fileName)
|
||||||
// 保存图片指针和图片的 Hash 名
|
// 保存图片指针和图片的 Hash 名
|
||||||
s_mBitmapsFromFile.insert(
|
s_mBitmapsFromFile.insert(
|
||||||
std::map<size_t, ID2D1Bitmap*>::value_type(
|
std::map<size_t, ID2D1Bitmap*>::value_type(
|
||||||
fileName.getHash(),
|
fileName.getHashCode(),
|
||||||
pBitmap)
|
pBitmap)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -292,7 +292,7 @@ int e2d::String::getLength() const
|
||||||
return static_cast<int>(m_str.size());
|
return static_cast<int>(m_str.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int e2d::String::getHash() const
|
unsigned int e2d::String::getHashCode() const
|
||||||
{
|
{
|
||||||
unsigned int hash = 0;
|
unsigned int hash = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ bool e2d::MusicManager::add(const String & strFilePath)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UINT nRet = strFilePath.getHash();
|
UINT nRet = strFilePath.getHashCode();
|
||||||
pPlayer = new Music();
|
pPlayer = new Music();
|
||||||
|
|
||||||
if (pPlayer->_open(strFilePath))
|
if (pPlayer->_open(strFilePath))
|
||||||
|
|
@ -45,7 +45,7 @@ e2d::Music * e2d::MusicManager::get(const String & strFilePath)
|
||||||
if (strFilePath.isEmpty())
|
if (strFilePath.isEmpty())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
UINT nRet = strFilePath.getHash();
|
UINT nRet = strFilePath.getHashCode();
|
||||||
|
|
||||||
if (getMusicList().end() != getMusicList().find(nRet))
|
if (getMusicList().end() != getMusicList().find(nRet))
|
||||||
return getMusicList()[nRet];
|
return getMusicList()[nRet];
|
||||||
|
|
|
||||||
|
|
@ -623,7 +623,7 @@ e2d::Node * e2d::Node::getChild(const String & name)
|
||||||
{
|
{
|
||||||
WARN_IF(name.isEmpty(), "Invalid Node name.");
|
WARN_IF(name.isEmpty(), "Invalid Node name.");
|
||||||
|
|
||||||
unsigned int hash = name.getHash();
|
unsigned int hash = name.getHashCode();
|
||||||
|
|
||||||
for (auto child : m_vChildren)
|
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.");
|
WARN_IF(name.isEmpty(), "Invalid Node name.");
|
||||||
|
|
||||||
unsigned int hash = name.getHash();
|
unsigned int hash = name.getHashCode();
|
||||||
|
|
||||||
for (auto child : m_vChildren)
|
for (auto child : m_vChildren)
|
||||||
if (child->m_nHashName == hash && child->m_sName == name)
|
if (child->m_nHashName == hash && child->m_sName == name)
|
||||||
|
|
@ -703,7 +703,7 @@ void e2d::Node::removeChildren(const String & childName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算名称 Hash 值
|
// 计算名称 Hash 值
|
||||||
unsigned int hash = childName.getHash();
|
unsigned int hash = childName.getHashCode();
|
||||||
|
|
||||||
size_t size = m_vChildren.size();
|
size_t size = m_vChildren.size();
|
||||||
for (size_t i = 0; i < size; i++)
|
for (size_t i = 0; i < size; i++)
|
||||||
|
|
@ -860,7 +860,7 @@ void e2d::Node::setName(const String & name)
|
||||||
// 保存节点名
|
// 保存节点名
|
||||||
m_sName = name;
|
m_sName = name;
|
||||||
// 保存节点 Hash 名
|
// 保存节点 Hash 名
|
||||||
m_nHashName = name.getHash();
|
m_nHashName = name.getHashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ public:
|
||||||
int getLength() const;
|
int getLength() const;
|
||||||
|
|
||||||
// 获取该字符串的散列值
|
// 获取该字符串的散列值
|
||||||
unsigned int getHash() const;
|
unsigned int getHashCode() const;
|
||||||
|
|
||||||
// 后接字符串
|
// 后接字符串
|
||||||
String& append(
|
String& append(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue