void LoadFile(const char * pFilePath)
{
//获取文件全路径
std::string strFullName = FileUtils::getInstance()->fullPathForFilename(pFilePath);
//获取文件内容
std::string strData = FileUtils::getInstance()->getStringFromFile(strFullName);
rapidjson::Document doc;
//解析文件内容
doc.Parse<0>(strData.c_str());
parse对于不同的json数据进行不同的解析方式
parse(doc);
doc.Clear();
}
//解析具体文件
void parse(rapidjson::Document & doc)
{
//获取解析的文件对象个数
for (int i = 0;i<doc.Size();i++)
{
//创建数据实例存储
SIconDt * pIcon = new SIconDt();
pIcon->nID = doc[i]["id"].GetInt();
pIcon->nValue = doc[i]["value"].GetInt();
for (int j = 0;j<doc[i]["imgs"].Size();j++)
{
std::string strImg = doc[i]["imgs"][j].GetString();
pIcon->vecImgs.push_back(strImg);
}
m_vecData.push_back(pIcon);
}
}
//解析的jso