void TIniFile::WriteStringList(const wxString & Section, const wxString & Ident, wxArrayString Value) { EraseSection(Section); for (int i = 0; i < Value.GetCount(); i++) { this->WriteString(Section, wxString::Format("%s%d", Ident, i),Value.Item(i)); } }
//--------------------------------------------------------------------------- // 函数: EraseKey // 功能: 清除Section的下一个Key的内容 // 参数: pSection 节的名字 //--------------------------------------------------------------------------- void QIniFileImpl::EraseKey(const char* lpSection, const char* lpKey) { // setup section name char szSection[64]; COPY_SECTION_AND_ADD_BOUND(szSection, lpSection); // search for the matched section SECNODE* pSecNode = m_Header.pNextNode; unsigned int dwID = String2Id(szSection); while (pSecNode != NULL) { if (dwID == pSecNode->dwID) { break; } pSecNode = pSecNode->pNextNode; } // if no such section found if (pSecNode == NULL) { return; } KEYNODE* pThisKey = &pSecNode->RootNode; KEYNODE* pNextKey = pThisKey->pNextNode; dwID = String2Id(lpKey); while (pNextKey != NULL) { if (pNextKey->dwID == dwID) { pThisKey->pNextNode = pNextKey->pNextNode; SAFE_DELETE_ARRAY(pNextKey->pKey); SAFE_DELETE_ARRAY(pNextKey->pValue); SAFE_DELETE(pNextKey); if (pSecNode->RootNode.pNextNode == NULL) EraseSection(szSection); return; } pThisKey = pNextKey; pNextKey = pNextKey->pNextNode; } }