Small overhaul using string_view

This commit is contained in:
2022-03-04 16:45:47 -05:00
parent b17b34924e
commit cfeeb2eaf3
6 changed files with 60 additions and 39 deletions

View File

@@ -152,8 +152,8 @@ private:
// DrivenEngine::new_outgoing_channel to create outgoing socket channels.
//
void feed_readline(int nbytes, const char *bytes);
void peek_outgoing(int *nbytes, const char **bytes) const;
void feed_readline(std::string_view data);
std::string_view peek_outgoing() const;
void sent_outgoing(int nbytes);
void erase_command();
void echo_command();
@@ -334,7 +334,7 @@ public:
// here is naturally only valid until the buffer is changed. This function
// is used for all channels, including sockets and stdio.
//
void drv_peek_outgoing(int chid, int *nbytes, const char **bytes) const;
std::string_view drv_peek_outgoing(int chid) const;
// Notifies the channel that some bytes were transmitted. This causes those
// bytes to be removed from the outgoing buffer. This function is used for
@@ -346,7 +346,7 @@ public:
// bytes to be appended to the incoming buffer. This function is used for
// all channels, including sockets and stdio.
//
void drv_recv_incoming(int chid, int nbytes, const char *bytes);
void drv_recv_incoming(int chid, std::string_view data);
// Notify the channel that the connection was closed. This includes all
// sorts of closes, including friendly termination, all the way to network