Panda3D

Loading...
Searching...
No Matches
lineStream.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 lineStream.h
10 * @author drose
11 * @date 2000-02-26
12 */
13
14#ifndef LINESTREAM_H
15#define LINESTREAM_H
16
17#include "dtoolbase.h"
18
19#include "lineStreamBuf.h"
20
21/**
22 * This is a special ostream that writes to a memory buffer, like ostrstream.
23 * However, its contents can be continuously extracted as a sequence of lines
24 * of text.
25 *
26 * Unlike ostrstream, which can only be extracted from once (and then the
27 * buffer freezes and it can no longer be written to), the LineStream is not
28 * otherwise affected when a line of text is extracted. More text can still
29 * be written to it and continuously extracted.
30 */
31 class EXPCL_DTOOL_DTOOLUTIL LineStream : public std::ostream {
32PUBLISHED:
33 INLINE LineStream();
34
35#if _MSC_VER >= 1800
36 INLINE LineStream(const LineStream &copy) = delete;
37#endif
38
39 INLINE bool is_text_available() const;
40 INLINE std::string get_line();
41 INLINE bool has_newline() const;
42
43 private:
44 LineStreamBuf _lsb;
45};
46
47#include "lineStream.I"
48
49#endif
LineStreamBuf
Used by LineStream to implement an ostream that writes to a memory buffer, whose contents can be cont...
Definition lineStreamBuf.h:26
LineStream::has_newline
bool has_newline() const
Returns true if the line of text most recently returned by get_line() was written out with a terminat...
Definition lineStream.I:48
LineStream::is_text_available
bool is_text_available() const
Returns true if there is at least one line of text (or even a partial line) available in the LineStre...
Definition lineStream.I:27
LineStream::get_line
std::string get_line()
Extracts and returns the next line (or partial line) of text available in the LineStream object.
Definition lineStream.I:38
dtoolbase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
lineStreamBuf.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
lineStream.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.