tbuffer.h
来自「Software Development in C: A Practical A」· C头文件 代码 · 共 108 行
H
108 行
//---------------------------------------------------------
/*
File Name: TBuffer.h
Comments: This file contains the definition of the
text_buffer type.
*/
//---------------------------------------------------------
#ifndef TBUFFER_H
#define TBUFFER_H
//---------------------------------------------------------
// Include Files
#include "TString.h"
#include "MiscType.h"
// End Include Files
//---------------------------------------------------------
//---------------------------------------------------------
// Enumerated Types
typedef enum
{
TBE_NO_ERROR = 0,
TBE_OUT_OF_MEMORY,
TBE_CANT_ALLOCATE_BUFFER,
TBE_CANT_OPEN_FILE,
TBE_CANT_WRITE_TO_FILE
} text_buffer_error;
// End Enumerated Types
//---------------------------------------------------------
//---------------------------------------------------------
// Types
typedef struct
{
text_string *allRows;
int totalRows;
int topLine;
boolean isDirty;
text_buffer_error errorStatus;
} text_buffer;
// End Types
//---------------------------------------------------------
//---------------------------------------------------------
// Prototypes.
void TextBufferInitialize(text_buffer *tBuffer);
void TextBufferSetRow(text_buffer *tBuffer,
int rowNumber,
text_string textString);
void TextBufferGetRow(const text_buffer * const tBuffer,
int rowNumber,
text_string *textString);
void TextBufferScrollUp(text_buffer *tBuffer,
int linesToScroll);
void TextBufferScrollDown(text_buffer *tBuffer,
int linesToScroll,
int displayAreaHeight);
void TextBufferScrollToBeginning(text_buffer *textBuffer);
void TextBufferScrollToEnd(text_buffer *textBuffer);
int TextBufferGetTopLine(const text_buffer * const tBuffer);
void TextBufferSaveToFile(text_buffer *textBuffer,
text_string fileName);
void TextBufferLoadFromFile(text_buffer *textBuffer,
text_string fileName);
int TextBufferGetBufferLength(
const text_buffer * const tBuffer);
text_buffer_error TextBufferGetError(text_buffer *tBuffer);
void TextBufferClearError(text_buffer *tBuffer);
void TextBufferFree(text_buffer *tBuffer);
// End Prototypes.
//---------------------------------------------------------
#endif
// End TBuffer.h
//---------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?