Panda3D
Loading...
Searching...
No Matches
lineStreamBuf.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file lineStreamBuf.h
10 * @author drose
11 * @date 2000-02-26
12 */
13
14#ifndef LINESTREAMBUF_H
15#define LINESTREAMBUF_H
16
17#include "dtoolbase.h"
18
19#include <string>
20
21/**
22 * Used by LineStream to implement an ostream that writes to a memory buffer,
23 * whose contents can be continuously extracted as a sequence of lines of
24 * text.
25 */
26class EXPCL_DTOOL_DTOOLUTIL LineStreamBuf : public std::streambuf {
27public:
29 virtual ~LineStreamBuf();
30
31 INLINE bool is_text_available() const;
32 std::string get_line();
33 INLINE bool has_newline() const;
34
35protected:
36 virtual int overflow(int c);
37 virtual int sync();
38
39private:
40 INLINE void write_chars(const char *start, size_t length);
41
42 std::string _data;
43 bool _has_newline;
44};
45
46#include "lineStreamBuf.I"
47
48#endif
Used by LineStream to implement an ostream that writes to a memory buffer, whose contents can be cont...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.