Пример #1
0
void CModel::DeleteSequence(CSequence* deleteSequence)
{
	// linklist is only 1-way, so we need to find the stage previous to this (if any)...

	CSequence* prevSequence = NULL;
	CSequence* scanSequence = GetFirstSequence();

	while (scanSequence && scanSequence != deleteSequence)
	{
		prevSequence = scanSequence;
		scanSequence = scanSequence->GetNext();
	}
	if (scanSequence == deleteSequence)
	{
		// we found it, so was this the first sequence in the list?

		if (prevSequence)
		{
			prevSequence->SetNext(scanSequence->GetNext());	// ...no
		}
		else
		{
			m_sequences = scanSequence->GetNext();			// ...yes
		}
		scanSequence->Delete();
	}
}
Пример #2
0
void CModel::Delete()
{
	while(m_comments != NULL)
	{
		CComment* curComment = m_comments;
		m_comments = curComment->GetNext();
		curComment->Delete();
	}
	while(m_sequences != NULL)
	{
		CSequence* curSequence = m_sequences;
		m_sequences = curSequence->GetNext();
		curSequence->Delete();
	}
	if (m_name != NULL)
	{
		free(m_name);
		m_name = NULL;
	}
	if (m_path != NULL)
	{
		free(m_path);
		m_path = NULL;
	}
	if (m_psSkelPath != NULL)
	{
		free(m_psSkelPath);
		m_psSkelPath = NULL;
	}
	if (m_psMakeSkelPath != NULL)
	{
		free(m_psMakeSkelPath);
		m_psMakeSkelPath = NULL;
	}
	if (m_psRefGLAPath != NULL)
	{
		free(m_psRefGLAPath);
		m_psRefGLAPath = NULL;
	}
	m_curSequence = NULL;

	PCJList_Clear();	// not really necessary, but useful reminder

	delete this;
}