⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tbuffer.h

📁 Software Development in C: A Practical Approach to Programming and Design 软件开发:编程与设计(C))——国外经典教材·计
💻 H
字号:
//---------------------------------------------------------
/*
File Name:	TBuffer.h
Comments:	This file contains the definition of the 
			text_buffer type.
*/
//---------------------------------------------------------

#ifndef TBUFFER_H
#define TBUFFER_H


//---------------------------------------------------------
// Include Files

#include "MiscType.h"
#include "TString.h"

// End Include Files
//---------------------------------------------------------




//---------------------------------------------------------
// Types

typedef struct
{
	text_string *allRows;
	int totalRows;
	int topLine;
	boolean isDirty;
} text_buffer;


typedef enum
{
	TBE_NO_ERROR = 0,
	TBE_CANT_ALLOCATE_BUFFER,
	TBE_CANT_LOAD_FILE,
	TBE_CANT_SAVE_FILE
} buffer_error;

// End Types
//---------------------------------------------------------




//---------------------------------------------------------
// Prototypes.

void TextBufferInitialize(text_buffer *tBuffer);
buffer_error TextBufferSetRow(
					int rowNumber,
					const text_string * const textString,
					text_buffer *tBuffer);
buffer_error TextBufferGetRow(
					  int rowNumber,
					  text_string *textString,
					  const text_buffer * const tBuffer);
void TextBufferScrollUp(int linesToScroll,
					    text_buffer *tBuffer);
void TextBufferScrollDown(int linesToScroll,
						  int displayAreaHeight,
						  text_buffer *tBuffer);
int TextBufferGetTopLine(const text_buffer * const tBuffer);
int TextBufferGetBufferLength(
		const text_buffer * const tBuffer);
void TextBufferFree(text_buffer *tBuffer);
buffer_error TextBufferLoadFile(text_buffer *tBuffer,
							    const text_string *fileName);
buffer_error TextBufferSaveFile(text_buffer *tBuffer,
							    const text_string *fileName);

// End Prototypes.
//---------------------------------------------------------



#endif

// End TBuffer.h
//---------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -