All Classes Namespaces Files Functions Variables Enumerations Enumerator
libs/connection/ConnectionUtils.h
Go to the documentation of this file.
00001 #ifndef QRK_CONNECTION_UTILS_H
00002 #define QRK_CONNECTION_UTILS_H
00003 
00013 #include <cstddef>
00014 #include <algorithm>
00015 
00016 
00018 namespace qrk
00019 {
00020     class Connection;
00021 
00022 
00029     extern bool isLF(const char ch);
00030 
00031 
00041     extern void skip(Connection* con, int total_timeout, int each_timeout = 0);
00042 
00043 
00056     extern int readline(Connection* con, char* buf, const size_t count,
00057                         int timeout);
00058 
00059 
00065     template <class T>
00066     void swapConnection(T& a, T& b)
00067     {
00068         Connection* t = a.connection();
00069         a.setConnection(b.connection());
00070         b.setConnection(t);
00071     }
00072 }
00073 
00074 #endif /* !QRK_CONNECTION_UTILS_H */