This commit is contained in:
2025-10-06 04:18:49 +08:00
commit df2cacdb92
2784 changed files with 1280840 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
#include "Ifstream_PVF.h"
Ifstream_PVF::Ifstream_PVF(std::string fileName)
{
std::ifstream file(fileName, std::ios::binary | std::ios::in);
if (file.is_open())
{
// 获取文件大小
file.seekg(0, std::ios::end);
std::streamsize length = file.tellg();
file.seekg(0, std::ios::beg);
if (length > 0)
{
// 直接调整vector大小并读取数据
_Data.resize(static_cast<size_t>(length));
if (file.read(_Data.data(), length))
{
}
else
{
_Data.clear();
}
}
file.close();
}
else
{
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "无法打开文件: %s", fileName.c_str());
}
}
Ifstream_PVF::~Ifstream_PVF()
{
// vector会自动释放内存无需手动操作
}