00001 #ifndef QRK_CONNECTION_UTILS_H
00002 #define QRK_CONNECTION_UTILS_H
00003
00013 #include <cstddef>
00014 #include <algorithm>
00015
00016
00020 namespace qrk
00021 {
00022 class Connection;
00023
00024
00031 extern bool isLF(const char ch);
00032
00033
00043 extern void skip(Connection* con, int total_timeout, int each_timeout = 0);
00044
00045
00058 extern int readline(Connection* con, char* buf, const size_t count,
00059 const int timeout);
00060
00061
00067 template <class T>
00068 void swapConnection(T& a, T& b)
00069 {
00070 Connection* t = a.connection();
00071 a.setConnection(b.connection());
00072 b.setConnection(t);
00073 }
00074 }
00075
00076 #endif