cpp utils files, network and a smal util class

This commit is contained in:
Ziver Koc 2009-11-21 01:11:05 +00:00
parent ea3dffdb4a
commit 62f50a2f79
13 changed files with 610 additions and 0 deletions

36
net/socketstream.h Normal file
View file

@ -0,0 +1,36 @@
#ifndef ZUTIL_NET_SOCKETSTREAM
#define ZUTIL_NET_SOCKETSTREAM
#include <iostream>
#include "socketio.h"
using namespace std;
const size_t BUFFER_SIZE = 100;
namespace zutil{
class SocketStreamBuffer : public streambuf{
private:
SocketIO &soc;
char pBuffer[BUFFER_SIZE];
char gBuffer[BUFFER_SIZE];
char *pBeg, *pCur, *pEnd;
char *gBeg, *gCur, *gEnd;
typedef char_traits<char> Tr;
protected:
//virtual int uflow();
virtual int underflow();
//virtual streamsize xsgetn(char_type *s, streamsize n);
virtual int overflow(int = Tr::eof());
//virtual streamsize xsputn(const char_type *s, streamsize n);
//virtual int sync();
public:
SocketStreamBuffer(SocketIO &s);
};
}
#endif