1 | /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ |
2 | /* If you are missing that file, acquire a complete release at teeworlds.com. */ |
3 | #ifndef ENGINE_SHARED_LINEREADER_H |
4 | #define ENGINE_SHARED_LINEREADER_H |
5 | #include <base/types.h> |
6 | |
7 | // buffered stream for reading lines |
8 | class CLineReader |
9 | { |
10 | char *m_pBuffer; |
11 | unsigned m_BufferPos; |
12 | bool m_ReadLastLine; |
13 | |
14 | public: |
15 | CLineReader(); |
16 | ~CLineReader(); |
17 | |
18 | bool OpenFile(IOHANDLE File); |
19 | void OpenBuffer(char *pBuffer); // Buffer must have been allocated with malloc, will be freed by the line reader |
20 | |
21 | const char *Get(); // Returned string is valid until the line reader is destroyed |
22 | }; |
23 | #endif |
24 | |