Browse Source

downloader: allow constructing StringStream from vector_uchar

rdb 6 years ago
parent
commit
1a1648682a
2 changed files with 10 additions and 0 deletions
  1. 9 0
      panda/src/downloader/stringStream.I
  2. 1 0
      panda/src/downloader/stringStream.h

+ 9 - 0
panda/src/downloader/stringStream.I

@@ -27,6 +27,15 @@ StringStream(const std::string &source) : std::iostream(&_buf) {
   set_data(source);
   set_data(source);
 }
 }
 
 
+/**
+ * This version of the constructor preloads the buffer with the indicated
+ * data.
+ */
+INLINE StringStream::
+StringStream(vector_uchar source) : std::iostream(&_buf) {
+  _buf.swap_data(source);
+}
+
 /**
 /**
  * Empties the buffer.
  * Empties the buffer.
  */
  */

+ 1 - 0
panda/src/downloader/stringStream.h

@@ -27,6 +27,7 @@
 class EXPCL_PANDA_DOWNLOADER StringStream : public std::iostream {
 class EXPCL_PANDA_DOWNLOADER StringStream : public std::iostream {
 public:
 public:
   INLINE StringStream(const std::string &source);
   INLINE StringStream(const std::string &source);
+  INLINE StringStream(vector_uchar source);
 
 
 PUBLISHED:
 PUBLISHED:
   EXTENSION(StringStream(PyObject *source));
   EXTENSION(StringStream(PyObject *source));