void MIniFile::Print() { IniSection* pSection = 0; SectionIter iter = m_SectionList.begin(); if(iter != m_SectionList.end()) { pSection = *iter; } IniKey* pKey = NULL; while(pSection != NULL) { pKey = pSection->GetFirstKey(); printf("%s\n",pSection->m_SectionName.c_str()); while(pKey != NULL) { printf("\t%s =\t%s\n",pKey->m_Key.c_str(),pKey->m_Value.c_str()); pKey = pKey->GetNextKey(); } pSection = pSection->GetNextSection(); } }
IniKey* MIniFile::GetFirstKey(const char* sectionName) { IniSection* pSection = GetSection(sectionName); if (pSection != NULL) { IniKey* pKey = pSection->GetFirstKey(); if(pKey != 0) { return pKey; } } return 0; }
//获取一个节的第一个键 const char* MIniFile::GetFirstKeyName(const char* sectionName) { IniSection* pSection = GetSection(sectionName); if (pSection != NULL) { IniKey* pKey = pSection->GetFirstKey(); if(pKey != 0) { return pKey->m_Key.c_str(); } } return ""; }