-
Notifications
You must be signed in to change notification settings - Fork 59
/
CChatBox.h
76 lines (58 loc) · 1.33 KB
/
CChatBox.h
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
/////////////////////////////////////////
//
// OpenLieroX
//
// code under LGPL, based on JasonBs work,
// enhanced by Dark Charlie and Albert Zeyer
//
//
/////////////////////////////////////////
// Chat Box class
// Created 10/5/01
// Jason Boettcher
#ifndef __CCHATBOX_H__
#define __CCHATBOX_H__
#include <SDL.h>
#include <list>
#include "Protocol.h"
#include "olx-types.h"
#include "Color.h"
#define MAX_LLENGTH 128
// Line structure
struct line_t {
std::string strLine;
Color iColour;
TXT_TYPE iTextType;
AbsTime fTime;
size_t iID;
};
typedef std::list<line_t> ct_lines_t;
typedef ct_lines_t::iterator lines_iterator;
typedef ct_lines_t::reverse_iterator lines_riterator;
class CChatBox {
public:
// Constructor
CChatBox() {
Clear();
}
~CChatBox() {
Clear();
}
private:
// Attributes
ct_lines_t Lines;
ct_lines_t NewLines;
public:
// Methods
void Clear();
void AddText(const std::string& txt, Color colour, TXT_TYPE TextType, const AbsTime& time);
// Variables
lines_iterator Begin() { return Lines.begin(); }
lines_iterator End() { return Lines.end(); }
lines_iterator At(int i);
lines_riterator RBegin() { return Lines.rbegin(); }
lines_riterator REnd() { return Lines.rend(); }
bool GetNewLine(line_t& ln);
size_t getNumLines() { return Lines.size(); }
};
#endif // __CCHATBOX_H__