为文字处理器存储文本的更好方法是什么? [英] What's a better way to store text for a word processor?

查看:29
本文介绍了为文字处理器存储文本的更好方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常的方式是将字符存储在一个字符串中,但是因为在编写文本时,很多时候用户会在文本中间删除或添加字符,也许使用 std 会更好::list 来包含字符,然后在列表中间添加字符不是成本高的操作.

The usual way is to store the characters in a string, but because while writing a text, a lot of times the user deletes or adds characters in the middle of the text, perhaps it is better to use std::list<char> to contains the characters, then adding characters in the middle of list is not costly operation.

推荐答案

以下论文总结了文字处理器中使用的数据结构:http://www.cs.unm.edu/~crowley/papers/sds.pdf

The following paper summarizes the data structures used in word processors: http://www.cs.unm.edu/~crowley/papers/sds.pdf

文本序列的数据结构.查尔斯·克劳利,新墨西哥大学,1998 年

Data Structures for Text Sequences. Charles Crowley, University of New Mexico, 1998

用于维护字符序列的数据结构是一个文本编辑器的重要组成部分.本文调查和评估文本序列可能的数据结构范围.ADT检查文本编辑器的文本序列组件的接口.六种常见的序列数据结构(数组、间隙、列表、行指针、固定尺寸的 buers 和计件表)被检查,然后一个一般的包含所有六种结构的序列数据结构模型被表达.片表法详解及其优点介绍.序列数据结构的设计空间进行了检查,上面列出的几个变体是提出了.通过实验比较这些序列数据结构并根据多项标准进行评估.实验性的比较是通过在编辑中实现每个数据结构来完成的模拟器并使用数千个合成负载对其进行测试编辑.我们还报告了有关结果敏感性的实验用于生成合成编辑的参数的变化加载.

The data structure used to maintain the sequence of characters is an important part of a text editor. This paper investigates and evaluates the range of possible data structures for text sequences. The ADT interface to the text sequence component of a text editor is examined. Six common sequence data structures (array, gap, list, line pointers, fixed size buers and piece tables) are examined and then a general model of sequence data structures that encompasses all six structures is presented. The piece table method is explained in detail and its advantages are presented. The design space of sequence data structures is examined and several variations on the ones listed above are presented. These sequence data structures are compared experimentally and evaluated based on a number of criteria. The experimental comparison is done by implementing each data structure in an editing simulator and testing it using a synthetic load of many thousands of edits. We also report on experiments on the senstivity of the results to variations in the parameters used to generate the synthetic editing load.

这篇关于为文字处理器存储文本的更好方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆