-
Notifications
You must be signed in to change notification settings - Fork 16
/
ttxline.h
68 lines (56 loc) · 1.96 KB
/
ttxline.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
#ifndef TTXLINE_H
#define TTXLINE_H
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
/** TTXLine - a single line of teletext
* The line is always stored in 40 bytes in transmission ready format
* (but with the parity bit set to 0).
*/
class TTXLine
{
public:
/** Constructors */
TTXLine();
TTXLine(std::string const& line, bool validate=true);
// TTXLine(std::string const& line);
/** Default destructor */
virtual ~TTXLine();
/** Set the teletext line contents
* \param val - New value to set
* \param validateLine - If true, it ensures the line is checked and modified if needed to be transmission ready.
*/
void Setm_textline(std::string const& val, bool validateLine=true);
/** Access m_textline
* \return The current value of m_textline
*/
std::string GetLine();
/**
* @brief Check if the line is blank so that we don't bother to write it to the file.
* @return true is the line is blank
*/
bool IsBlank();
/** Place a character in a line. Must be an actual teletext code.
* Bit 7 will be stripped off.
* @param x - Address of the character
& @param code - The character to set
* \return previous character at that location (for undo)
*/
char SetCharAt(int x,int code);
/** Get one character from this line.
* If there is no data set then return a space
*/
char GetCharAt(int xLoc);
/** Adds line to a linked list
* This is used for enhanced packets which might require multiples of the same row
*/
void AppendLine(std::string const& line);
TTXLine* GetNextLine(){return _nextLine;}
protected:
private:
std::string validate(std::string const& test);
std::string m_textline;
TTXLine* _nextLine;
};
#endif // TTXLINE_H