Panda3D
Loading...
Searching...
No Matches
stringStream.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 stringStream.h
10 * @author drose
11 * @date 2007-07-03
12 */
13
14#ifndef STRINGSTREAM_H
15#define STRINGSTREAM_H
16
17#include "pandabase.h"
18#include "stringStreamBuf.h"
19#include "vector_uchar.h"
20#include "extension.h"
21
22/**
23 * A bi-directional stream object that reads and writes data to an internal
24 * buffer, which can be retrieved and/or set as a string in Python 2 or a
25 * bytes object in Python 3.
26 */
27class EXPCL_PANDA_DOWNLOADER StringStream : public std::iostream {
28public:
29 INLINE StringStream(const std::string &source);
30
31PUBLISHED:
32 EXTENSION(StringStream(PyObject *source));
33 INLINE StringStream();
34
35#if _MSC_VER >= 1800
36 INLINE StringStream(const StringStream &copy) = delete;
37#endif
38
39 INLINE void clear_data();
40 INLINE size_t get_data_size();
41
42 EXTENSION(PyObject *get_data());
43 EXTENSION(void set_data(PyObject *data));
44
45 MAKE_PROPERTY(data, get_data, set_data);
46
47public:
48#ifndef CPPPARSER
49 INLINE std::string get_data();
50 INLINE void set_data(const std::string &data);
51 void set_data(const unsigned char *data, size_t size);
52#endif
53
54 INLINE void swap_data(vector_uchar &data);
55
56private:
57 StringStreamBuf _buf;
58
59 friend class Extension<StringStream>;
60};
61
62#include "stringStream.I"
63
64#endif
The default class template does not define any methods.
Definition extension.h:34
Used by StringStream to implement an stream that reads from and/or writes to a memory buffer,...
A bi-directional stream object that reads and writes data to an internal buffer, which can be retriev...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.