00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef CPROTOCOLUTIL_H
00016 #define CPROTOCOLUTIL_H
00017
00018 #include "BasicTypes.h"
00019 #include "XIO.h"
00020 #include <stdarg.h>
00021
00022 class IStream;
00023
00025
00029 class CProtocolUtil {
00030 public:
00032
00049 static void writef(IStream*,
00050 const char* fmt, ...);
00051
00053
00068 static bool readf(IStream*,
00069 const char* fmt, ...);
00070
00071 private:
00072 static void vwritef(IStream*,
00073 const char* fmt, UInt32 size, va_list);
00074 static void vreadf(IStream*,
00075 const char* fmt, va_list);
00076
00077 static UInt32 getLength(const char* fmt, va_list);
00078 static void writef(void*, const char* fmt, va_list);
00079 static UInt32 eatLength(const char** fmt);
00080 static void read(IStream*, void*, UInt32);
00081 };
00082
00084
00088 class XIOReadMismatch : public XIO {
00089 public:
00090
00091 virtual CString getWhat() const throw();
00092 };
00093
00094 #endif
00095