-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviewbuf.h
More file actions
89 lines (69 loc) · 2.64 KB
/
viewbuf.h
File metadata and controls
89 lines (69 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* Sergeev Artemiy, 33601/2 (3057/2) */
#ifndef _VIEWBUF_H_
#define _VIEWBUF_H_
#include <stdio.h>
/* Project namespace */
namespace notepad
{
/* Specialized text buffer class */
class viewbuf
{
private:
static const unsigned char defaultText[]; // text, which will be displayed default (on error)
unsigned char *buffer; // text buffer
unsigned long size, // count of bytes of memory for buffer
currentString, // number of current first-displayed string in buffer
currentCharacter, // number of current first-displayed character in string
beginIndex, // index of first-displayed character
currentIndex, // index of current displayed string
nextIndex, // index of next displayed
stringsCount, // count of strings in 'buffer' ('\n' is stop-character)
maxStringLength; // length of max-string in buffer
public:
unsigned int breakScrollX, // Count of characters, which will be displayed in right-side position of scroll bar
breakScrollY; // Count of characters, which will be displayed in bottom-side position of scroll bar
viewbuf( void ) : buffer(NULL), size(0), stringsCount(0),
currentString(0), currentCharacter(0), currentIndex(0), nextIndex(0), beginIndex(0),
breakScrollX(15), breakScrollY(5)
{
}
~viewbuf( void ) { Close(); }
/* Read text from file function */
int Open( unsigned char *fileName = NULL );
/* Deinitialite buffer function */
void Close( void );
/* Get pointer to begin of first string of 'visible' buffer function */
unsigned char * Begin( void );
/* Get pointer to begin of next string of 'visible' buffer function */
unsigned char * Next( void );
/* Get pointer to end of string of 'visible' buffer function */
unsigned char * End( void );
/* Check avalibility of strings to output function */
bool HaveStrings( void ) const
{
return (currentIndex < size);
}
/* Horizontal shift text function */
void ShiftX( const long shift );
/* Vertical shift text function */
void ShiftY( const long shift );
/*** GetSmth() functions ***/
unsigned long GetStringsCount( void ) const
{
return stringsCount;
}
unsigned long GetMaxStringLength( void ) const
{
return maxStringLength;
}
unsigned long GetCurrentString( void ) const
{
return currentString;
}
unsigned long GetCurrentCharacter( void ) const
{
return currentCharacter;
}
};
}
#endif /* _VIEWBUF_H_ */