From fc323560826ac24b7a66b5cd0a5621963b9d1677 Mon Sep 17 00:00:00 2001 From: chatty Date: Wed, 8 Feb 1995 14:44:33 +0000 Subject: Additional cleanup of Read functions --- comm/MsgBuffer.h | 47 +++++++++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 26 deletions(-) (limited to 'comm/MsgBuffer.h') diff --git a/comm/MsgBuffer.h b/comm/MsgBuffer.h index 8abee14..869933b 100644 --- a/comm/MsgBuffer.h +++ b/comm/MsgBuffer.h @@ -3,7 +3,7 @@ * * by Michel Beaudouin-Lafon * - * Copyright 1990-1993 + * Copyright 1990-1995 * Laboratoire de Recherche en Informatique (LRI) * * Messages, buffers @@ -36,6 +36,9 @@ protected: bool GetErr; int GrowSize, MaxSize, MinSize; + bool GetBuf (byte*, int, bool, int = 0); + int GetString (char*, int, const char*, bool, int = 0); + public: UchMsgBuffer (); UchMsgBuffer (int); @@ -57,35 +60,27 @@ public: void WriteLong (lword); void WriteString (const char*); - void ReadBuf (byte*, int); - void ReadByte (byte&); - void ReadChar (char&); - void ReadShort (sword&); - void ReadLong (lword&); - void ReadString (char*); - void ReadString (CcuString&); + bool ReadByte (byte&); + bool ReadChar (char&); + bool ReadShort (sword&); + bool ReadLong (lword&); + bool ReadBuf (byte*, int); + int ReadString (char*, const char*, int = -1); + int ReadString (char*, char, int = -1); + int ReadString (char*, int = -1); + int ReadString (CcuString&); + bool ReadMsg (UchMessage&); void Append (const char*, bool = true); void WriteMsg (UchMessage&); - bool Get (byte*, int, bool = false); - bool Get (byte& b, bool peek = false) { return Get (&b, 1, peek); } - bool Get (char& c, bool peek = false) { return Get ((byte*) &c, 1, peek); } - bool Get (lword& l, bool peek = false) { return Get ((byte*) &l, lwsize, peek); } - bool Get (sword& s, bool peek = false) { return Get ((byte*) &s, swsize, peek); } - int Get (char*, int, char, bool = false); - int Get (char*, int = -1, const char* = 0, bool = false); - int Get (CcuString&, bool = false); - bool ReadMsg (UchMessage&); - - bool Peek (byte*, lword = 0); - bool Peek (sword*, lword = 0); - bool Peek (lword*, lword = 0); - bool Peek (int, byte*, lword = 0); - bool MsgPeek (byte* b, lword o = 0) { return Peek (b, o+lwsize); } - bool MsgPeek (sword* sw, lword o = 0) { return Peek (sw, o+lwsize); } - bool MsgPeek (lword* lw, lword o = 0) { return Peek (lw, o+lwsize); } - bool MsgPeek (int sz, byte* b, lword o = 0) { return Peek (sz, b, o+lwsize); } + bool PeekByte (byte&, int = 0); + bool PeekShort (sword&, int = 0); + bool PeekLong (lword&, int = 0); + bool PeekBuf (byte*, int, int = 0); + int PeekString (char*, int=-1, const char* = 0, int = 0); + int PeekString (char*, int, char, int = 0); + int PeekString (CcuString&, int = 0); byte* Buffer () { return Start; } int BufLength () { return Stop - Start; } -- cgit v1.1