14 Commits

Author SHA1 Message Date
Dmitry Marakasov
f28e873d17 Implement proper Size() handling in custom rwops 2017-04-21 18:16:49 +03:00
Dmitry Marakasov
8ab8772a1c Add explicit cast from streamsize, fixing MSVC warning 2016-05-23 19:54:53 +03:00
Dmitry Marakasov
f0dd37f428 Use more correct file offset type 2016-01-05 18:17:59 +03:00
Dmitry Marakasov
595da1e61e Fix infinite loop 2015-09-17 15:33:00 +03:00
Dmitry Marakasov
9ecd4a12fe Fix variable types 2015-09-17 15:32:29 +03:00
Dmitry Marakasov
0f1dd26ebd Add in/out specifiers to param documentation 2015-01-12 21:43:28 +03:00
Dmitry Marakasov
c753c8ceba Multiple documentation fixes 2015-01-11 06:25:38 +03:00
Dmitry Marakasov
8f8c5e2bf1 Improve wording 2015-01-11 00:23:02 +03:00
Dmitry Marakasov
488063c3a5 Document StreamRWops 2015-01-11 00:16:27 +03:00
Dmitry Marakasov
4db7a4e0db Fix close return code 2015-01-11 00:16:18 +03:00
Dmitry Marakasov
927f812d43 Fix argument name for Write() 2015-01-10 23:47:42 +03:00
Dmitry Marakasov
7123b32217 Remove copy/move ctor/assign definitions
Since the class is trivial, default ones are fine
2015-01-10 23:45:59 +03:00
Dmitry Marakasov
53aa26dec5 Make StreamRWops work with istream/ostream
Streams do not generally work well with RWops because
* streams have separate read and write pointers
* ostream doesn't allow you to determine how many bytes were actually written
* istream and ostream have separate set of functions

Try my best to support streams in RWops though, engaging some template
magic:
* provide separate template implementations of all operations which
  depend on whether stream is an istream or ostream. This allows to
  e.g. return 0 immediately for an attempt to write() to istream.
* disallow StreamRWops for classes which are both istream and ostream
  to not run into ambiguity of separate read/write pointers
* for read failure, but partially read object back to the stream to not
  lose data for following read (not sure that e.g. fread behaves so
  though; I'll anyway expect user to Seek() after read or write failure)
* for write failure, there's no way to avoid leaking partial data to the
  stream

In general, it is best to use this container as read-only.

Also add tests for StreamRWops
2014-12-18 16:23:22 +03:00
Dmitry Marakasov
7ba131a913 Add StreamRWops class 2014-12-18 14:32:27 +03:00