33 lines
741 B
C++
33 lines
741 B
C++
|
|
#ifndef DRIVER_UTIL_HPP
|
|
#define DRIVER_UTIL_HPP
|
|
|
|
#include "wrap-string.hpp"
|
|
#include "wrap-vector.hpp"
|
|
|
|
#include <istream>
|
|
#include <ostream>
|
|
#include <string_view>
|
|
|
|
namespace drv {
|
|
|
|
void split_host_port(std::string_view target, std::string &host, std::string &port);
|
|
|
|
std::vector<std::string> parse_control_lst(std::string_view ctrl);
|
|
|
|
|
|
|
|
// Write encoded data to a replay log.
|
|
void wlog_byte(std::ostream &s, uint8_t byte);
|
|
void wlog_uint16(std::ostream &s, uint16_t v);
|
|
void wlog_string(std::ostream &s, std::string_view v);
|
|
|
|
// Read encoded data from a file.
|
|
uint8_t rlog_byte(std::istream &s);
|
|
uint16_t rlog_uint16(std::istream &s);
|
|
std::string_view rlog_string(std::istream &s, char *buf, size_t buflen);
|
|
|
|
}
|
|
|
|
#endif // DRIVER_UTIL_HPP
|