文本编辑器 源代码 MFC VC 课程设计 数据结构与算法
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-12-06 15:00 文本编辑器 MFC VC 数据结构 课程设计
目录 0 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditor
文件 8774 2011-03-20 20:08 文本编辑器 MFC VC 数据结构 课程设计TextEditorData.cpp
文件 1873 2011-03-20 20:08 文本编辑器 MFC VC 数据结构 课程设计TextEditorData.h
目录 0 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebug
文件 16833 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugData.obj
文件 6046 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugData.sbr
文件 19446 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugMainFrm.obj
文件 3610 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugMainFrm.sbr
文件 106181 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugStdAfx.obj
文件 1375136 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugStdAfx.sbr
文件 147582 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditor.exe
文件 369416 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditor.ilk
文件 23737 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditor.obj
文件 6879584 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditor.pch
文件 377856 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditor.pdb
文件 6708 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditor.res
文件 8509 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditor.sbr
文件 15518 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditorDoc.obj
文件 3380 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditorDoc.sbr
文件 79680 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditorView.obj
文件 21504 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditorView.sbr
文件 214016 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugvc60.idb
文件 364544 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugvc60.pdb
文件 2131 2011-03-14 07:08 文本编辑器 MFC VC 数据结构 课程设计TextEditorMainFrm.cpp
文件 1553 2011-03-13 23:40 文本编辑器 MFC VC 数据结构 课程设计TextEditorMainFrm.h
文件 4088 2011-03-03 15:30 文本编辑器 MFC VC 数据结构 课程设计TextEditorReadMe.txt
文件 212 2011-03-03 15:30 文本编辑器 MFC VC 数据结构 课程设计TextEditorStdAfx.cpp
文件 1054 2011-03-03 15:30 文本编辑器 MFC VC 数据结构 课程设计TextEditorStdAfx.h
文件 43752 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorTextEditor.aps
文件 2000 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorTextEditor.clw
............此处省略19个文件信息
// Data.cpp: implementation of the CData class.
//
//////////////////////////////////////////////////////////////////////
#include “stdafx.h“
#include “TextEditor.h“
#include “Data.h“
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
//对数据进行初始化,建立头结点,初始化链表
CData::CData()
{
m_Head = new Node;
m_Head->prior = m_Head->next = NULL;
m_Head->number = 0;
m_Head->pos = 0;
m_CurrentLine = m_Head;
InsertLine();
m_srSearchRecord.line = m_srSearchRecord.pos = 0;
}
//删除链表,释放内存
CData::~CData()
{
pNode p r;
p = m_Head;
while (p != NULL)
{
r = p;
p = p->next;
delete r;
}
}
//从指定起始位置开始查找指定字符串,返回查找到的行的指针,将查找到的地址保存到函数参数position中
pNode CData::Search(int startline int startchar char *value int &position)
{
pNode p;
//从指定行开始查找
p = GetLine(startline);
//对指定行的结点数据进行查找,若找到返回,否则进行下一步
if (p != NULL)
{
if ((position = BF(p->data+startchar value)) != -1)
{
if (m_srSearchRecord.line > m_Head->number && position > m_srSearchRecord.pos)
return NULL;
position += startchar;
return p;
}
else
{
p = p->next;
m_srSearchRecord.line++;
}
}
//遍历链表查找,若找到返回,否则进行下一步
while (p != NULL && m_srSearchRecord.line <= m_Head->number)
{
if ((position = BF(p->data value)) != -1)
return p;
else
{
p = p->next;
m_srSearchRecord.line++;
}
}
//通过查找记录的行数来判断是否已遍历完一遍链表,若未遍历完则将指针p指向头结点
if (m_srSearchRecord.line <= m_Head->number)
{
p = m_Head->next;
m_srSearchRecord.line++;
}
//继续遍历链表进行查找,若查找到数据则返回指针,否则直到查找记录的行数达到总行数为止,然后进行下一步
while (m_srSearchRecord.line <= m_Head->number)
{
if ((position = BF(p->data value)) != -1)
return p;
else
{
p = p->next;
m_srSearchRecord.line++;
}
}
//对最后一行的结束位置之前进行查找,若查找到返回指针,否则返回NULL
if (m_srSearchRecord.line > m_Head->number)
{
if ((position = BF(p->data value)) != -1 && position <= m_srSearchRecord.pos)
return p;
}
return NULL;
}
//插入新行,返回新行指针
pNode CData::InsertLine()
{
pNode p;
if (m_CurrentLine == NULL)
return NULL;
//建立新节点,插入到链表中
pNode line = new Node;
line->next = m_CurrentLine->next;
line->prior = m_CurrentLine;
m_CurrentLine->next = line;
if (line->next != NULL)
line->next->prior = line;
//对结点数据初始化
line->data[0] = ‘
‘;
line->data[1] = ‘ ‘;
line->number = 0;
line->pos = m_CurrentLine->pos + 1;
//更新由于插入新行而导致的其他数据变化
m_Head->number++;
p = line->next;
while (p != NULL)
{
p->pos++;
p = p->next;
}
m_CurrentLine = line;
return m_CurrentLine;
}
//删除当前行,返回前一行的指针
pNode CData::DeleteLine()
{
if (m_CurrentLine == NULL)
return NULL;
if (m_CurrentLine->pos == 1)
return m_CurrentLine;
pNode r;
//保存前一行指针
pNode p = m_CurrentLine->prior;
//
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-12-06 15:00 文本编辑器 MFC VC 数据结构 课程设计
目录 0 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditor
文件 8774 2011-03-20 20:08 文本编辑器 MFC VC 数据结构 课程设计TextEditorData.cpp
文件 1873 2011-03-20 20:08 文本编辑器 MFC VC 数据结构 课程设计TextEditorData.h
目录 0 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebug
文件 16833 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugData.obj
文件 6046 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugData.sbr
文件 19446 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugMainFrm.obj
文件 3610 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugMainFrm.sbr
文件 106181 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugStdAfx.obj
文件 1375136 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugStdAfx.sbr
文件 147582 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditor.exe
文件 369416 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditor.ilk
文件 23737 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditor.obj
文件 6879584 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditor.pch
文件 377856 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditor.pdb
文件 6708 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditor.res
文件 8509 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditor.sbr
文件 15518 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditorDoc.obj
文件 3380 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditorDoc.sbr
文件 79680 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditorView.obj
文件 21504 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugTextEditorView.sbr
文件 214016 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugvc60.idb
文件 364544 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorDebugvc60.pdb
文件 2131 2011-03-14 07:08 文本编辑器 MFC VC 数据结构 课程设计TextEditorMainFrm.cpp
文件 1553 2011-03-13 23:40 文本编辑器 MFC VC 数据结构 课程设计TextEditorMainFrm.h
文件 4088 2011-03-03 15:30 文本编辑器 MFC VC 数据结构 课程设计TextEditorReadMe.txt
文件 212 2011-03-03 15:30 文本编辑器 MFC VC 数据结构 课程设计TextEditorStdAfx.cpp
文件 1054 2011-03-03 15:30 文本编辑器 MFC VC 数据结构 课程设计TextEditorStdAfx.h
文件 43752 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorTextEditor.aps
文件 2000 2011-12-06 15:01 文本编辑器 MFC VC 数据结构 课程设计TextEditorTextEditor.clw
............此处省略19个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)