diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-06-14 01:43:54 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-06-23 19:51:28 +0200 |
| commit | 17c0ab15ae0b5f96a73648b7ca96e14c250e93e5 (patch) | |
| tree | 6d0d155dac00bf26793e165ec8ae5a778098b3bf /src/lib | |
| parent | 4181c68e98c9623ea1d5a747678d825662205920 (diff) | |
Add Socket::write for std::string.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/dcpomatic_socket.cc | 7 | ||||
| -rw-r--r-- | src/lib/dcpomatic_socket.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/dcpomatic_socket.cc b/src/lib/dcpomatic_socket.cc index 8f8f639cc..6dcc8e933 100644 --- a/src/lib/dcpomatic_socket.cc +++ b/src/lib/dcpomatic_socket.cc @@ -115,6 +115,13 @@ Socket::write (uint8_t const * data, int size) void +Socket::write(std::string const& str) +{ + write(reinterpret_cast<uint8_t const*>(str.c_str()), str.size()); +} + + +void Socket::write (uint32_t v) { v = htonl (v); diff --git a/src/lib/dcpomatic_socket.h b/src/lib/dcpomatic_socket.h index 7dff979e0..ef92ea844 100644 --- a/src/lib/dcpomatic_socket.h +++ b/src/lib/dcpomatic_socket.h @@ -47,6 +47,7 @@ public: void write (uint32_t n); void write (uint8_t const * data, int size); + void write(std::string const& str); void read (uint8_t* data, int size); uint32_t read_uint32 (); |
