// insert a new line after the given one or in the very beginning if !pLine LineList *wxFileConfig::LineListInsert(const wxString& str, LineList *pLine) { if ( pLine == m_linesTail ) return LineListAppend(str); LineList *pNewLine = new LineList(str); if ( pLine == NULL ) { // prepend to the list pNewLine->SetNext(m_linesHead); m_linesHead->SetPrev(pNewLine); m_linesHead = pNewLine; } else { // insert before pLine LineList *pNext = pLine->Next(); pNewLine->SetNext(pNext); pNewLine->SetPrev(pLine); pNext->SetPrev(pNewLine); pLine->SetNext(pNewLine); } return pNewLine; }
void wxFileConfig::LineListRemove(LineList *pLine) { LineList *pPrev = pLine->Prev(), *pNext = pLine->Next(); // first entry? if ( pPrev == NULL ) m_linesHead = pNext; else pPrev->SetNext(pNext); // last entry? if ( pNext == NULL ) m_linesTail = pPrev; else pNext->SetPrev(pPrev); delete pLine; }