diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-11-15 20:45:21 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-15 20:45:21 -0500 |
| commit | 914a3808ebefb0f7f0a728469a2ce6b56dfc316c (patch) | |
| tree | 9e452c21cf2a1d89d180818c65c6e7909f3328cf /source/core/slang-stream.h | |
| parent | ae9df74fce7e3583effc822b3003542cf753823d (diff) | |
Http protocol support (#2012)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Use 'Process' to communicate with an command line tool.
* Remove slang-win-stream
* Tidy up windows ProcessUtil.
* First version of BufferedReadStream.
* Windows working IPC for steams.
* Test proxy count option.
* Split Process/ProcessUtil. Process is platform dependant. ProcessUtil are functions that are platform independent.
* First implementation of Unix Process interface.
* Unix process compiles on cygwin.
* Fix typo in unix process.
* Separate unix pipe stream error of invalid access, from pipe availability.
* Fix in standard line extraction.
* Make fd non blocking.
* Fix issues with Windows Process streams.
* Added UnixPipe.
* Some fixes around UnixPipeStream.
* Make a unix stream closed explicit.
* Hack to debug linux process/stream.
* Revert to old linux pipe handling.
* Pass executable path for unit tests.
Split out CommandLine into own source.
* Small improvements in process/command line.
* Check process behavior with crash.
* Make stderr and stdout unbuffered for crash testing.
* Only turn disable buffering in crash test.
* Disable crash test on CI.
* Fix crash on clang/linux.
* Enable crash test.
Remove _appendBuffer as can use StreamUtil functionality.
* Added inital processing for http headers.
* Small improvements to HttpHeader.
* First pass HTTPPacketConnection working on windows.
* Enable other Process communication tests.
* Update comments.
Diffstat (limited to 'source/core/slang-stream.h')
| -rw-r--r-- | source/core/slang-stream.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/source/core/slang-stream.h b/source/core/slang-stream.h index f6c9f54a3..a163a0c5d 100644 --- a/source/core/slang-stream.h +++ b/source/core/slang-stream.h @@ -201,16 +201,34 @@ public: /// Will read assuming backing stream is SlangResult update(); + /// Consume bytes in the buffer. + void consume(Index byteCount); + Byte* getBuffer() { return m_buffer.getBuffer() + m_startIndex; } const Byte* getBuffer() const { return m_buffer.getBuffer() + m_startIndex; } size_t getCount() const { return m_buffer.getCount() - m_startIndex; } + /// Read until the buffer contains the specified amount of bytes + SlangResult readUntilContains(size_t size); + ConstArrayView<Byte> getView() const { return ConstArrayView<Byte>(getBuffer(), Index(getCount())); } ArrayView<Byte> getView() { return ArrayView<Byte>(getBuffer(), Index(getCount())); } + BufferedReadStream(Stream* stream) : + m_stream(stream), + m_startIndex(0) + { + + } + protected: - void _advanceStartIndex(Index byteCount); + + void _resetBuffer() + { + m_startIndex = 0; + m_buffer.setCount(0); + } size_t m_defaultReadSize = 1024; ///< When initiating a read the default read size List<Byte> m_buffer; ///< Holds the characters |
