Commit Graph

67 Commits

Author SHA1 Message Date
5d32408126 io: allow write to take rvalue file objects
This simplifies using temporaries in a few locations.
2018-01-31 19:31:57 +11:00
9045e16476 io: expose only view style read/write from io module
Allow the destination file-like object to implement whatever style
writers and readers they want, but don't expose those directly via the
io module.
2018-01-31 19:30:48 +11:00
8682381618 io: add slurp overload for string views 2018-01-30 12:53:43 +11:00
681768093e hash: use a consistency, less flexible, interface 2018-01-13 15:24:12 +11:00
e2f0d23a6d io: ensure we only write views that look like bytes 2018-01-10 18:50:02 +11:00
b8fd18f1cc io: ensure view writes only take byte sized data 2018-01-10 18:50:02 +11:00
f2fa90d043 io: return views from write wrappers 2017-12-28 17:50:38 +11:00
ac685cfdd2 io: expose file-object variant of draining write 2017-12-26 17:24:42 +11:00
e48aebb503 io: remove lvalue write function
writing arbitrary lvalues is incredibly dangerous if we don't have total
coverage of suitable overloads. eg, we have accidentally written string
objects to file descriptors.

instead we prefer byte/char views which the user can create as desired.
there's a little more cognitive overhead here, but it's substantially
less dangerous in casual usage.
2017-12-19 18:18:10 +11:00
0351313c36 Merge branch 'master' into coord 2017-11-23 17:24:11 +11:00
34788756d2 build: don't use './' as an include prefix
GCC produces ODR error when including paths of the form './foo' and
'foo' in the same binary. Rather than managing duplication we just
universally pick the absolute form over the relative form.
2017-11-22 16:49:37 +11:00
c1aa0f7a3d io: slurp should default to providing bytes, not chars
std::byte has less potential for abuse. if you want an array of chars
you should ask for it.
2017-09-12 14:18:34 +10:00
25e19b5810 build: use explicit constructors 2017-05-23 12:50:51 +10:00
31e9270e6b build: fix missing windows includes 2016-11-17 18:38:08 +11:00
9a798446b5 build: remove unnecessary includes
discovered with include-what-you-use
2016-10-12 15:08:22 +11:00
e80c3c959c io: return path object from path_error accessor 2016-10-08 17:28:06 +11:00
598c5d4e48 change const char paths to std::filesystem::path 2016-10-08 17:18:18 +11:00
48364cd227 build: use experimental::fs over boost::fs 2016-10-07 19:48:42 +11:00
98732179a7 io: add std::string overload to slurp 2016-10-07 18:08:41 +11:00
790728d3b1 posix/fd: extract file descriptor into own unit 2016-10-02 15:50:13 +11:00
5e597eef25 io: remove uneeded stream_error destructor 2016-05-12 17:53:37 +10:00
cc001c4788 win32/handle: merge various handle wrapper classes 2016-04-27 17:01:45 +10:00
aa780963e0 io: support piped streams in slurp 2016-04-19 14:52:05 +10:00
80158b7343 io: remove our wrapper flag types 2016-04-05 11:07:23 +10:00
ecb97143cf io: don't add a null terminator with slurp 2016-03-17 18:06:45 +11:00
18c3a1eaaf io: record path in path_error 2016-02-12 13:36:03 +11:00
6561e46018 memory: remove legacy scoped_malloc 2015-11-13 13:48:46 +11:00
620c2d3eb1 io: add FILE slurp overload 2015-10-29 17:52:19 +11:00
cb12d4fd1f io: remove redundant write overloads 2015-10-29 10:51:42 +11:00
73720feceb io: remove access_flag abstraction 2015-10-29 10:48:11 +11:00
ba9a8f8b35 io: add more write wrappers 2015-10-20 21:04:14 +11:00
0967c5252f io: remove useless chdir wrapper
just use chdir directly.
2015-09-15 21:09:37 +10:00
b6ce75aca6 build: windows fixes 2015-07-23 13:53:48 +10:00
75a1f1e5e7 io: add more write overloads 2015-07-02 16:34:17 +10:00
a5ae97025c io: add override specifiers 2015-06-30 22:24:43 +10:00
653ada4bfd io: change slurp return type to vector 2015-06-11 19:28:03 +10:00
33b3b48c74 io: rename fd_ref to fd 2015-06-11 19:27:42 +10:00
7ae57730f0 whitespace 2015-04-13 18:06:08 +10:00
2658b41ea1 relicence under Apache-2.0 2015-04-13 18:05:28 +10:00
46686dbc64 io: templatise write on output data type 2014-12-30 18:37:36 +11:00
7d5eac3f2f io: move mapped_file to platform subfiles 2014-12-19 18:28:50 +11:00
c1c74a14f0 io: always enable mapped_file 2014-12-18 12:57:04 +11:00
23b0a7b146 remove annotations header
The annotations were never particularly robust, and weren't used in many
locations (or consistently). And we should be migrating to c++14
annotation syntax anyway. By focusing on writing them all locally we
will be a little more standards compliant, and the attributes should be
more visible.
2014-10-17 19:24:53 +11:00
abfe4daac3 io: default mapped_file to read only
This is vastly safer compared to write by default. No more unexpectedly
changing files.
2014-09-29 16:19:16 +10:00
c9fae9f23a io: rename mapped_file end/begin to cend/cbegin 2014-08-22 19:07:22 +10:00
51b119f0fc io: move identer ostream to util namespace 2014-08-01 20:43:51 +10:00
503f5e2eff io: require access flags for mapped_file 2014-07-29 02:20:02 +10:00
1a461eddf0 io: give mapped_file begin/end accessors 2014-07-15 19:48:59 +10:00
a9af10ec42 io: give fd_ref a flags argument 2014-07-15 19:47:15 +10:00
f46c090c72 io: allow mutable memory for mapped_file 2014-07-07 15:21:17 +10:00