From e2a9c878c42fc5653f53cc98a9f43aa2488fe961 Mon Sep 17 00:00:00 2001 From: chatty Date: Tue, 10 May 1994 09:54:49 +0000 Subject: Renamed Delete into Clear replaced TRUE/FALSE by true/false Now derive from IOS --- comm/MsgBuffer.h | 64 +++++++++++++++++++++++++++----------------------------- 1 file changed, 31 insertions(+), 33 deletions(-) (limited to 'comm/MsgBuffer.h') diff --git a/comm/MsgBuffer.h b/comm/MsgBuffer.h index 8f96358..8abee14 100644 --- a/comm/MsgBuffer.h +++ b/comm/MsgBuffer.h @@ -18,6 +18,7 @@ #include "cplus_bugs.h" #include "global.h" #include "ccu/SmartPointer.h" +#include "IOS.h" class CcuString; class UchMessage; @@ -26,7 +27,7 @@ class UchMessage; // UchMsgBuffer derives from CcuSmartData to be able to have smart pointers (pUchMsgBuffer) // a buffer grows and shrinks automatically // -class UchMsgBuffer : public CcuSmartData { +class UchMsgBuffer : public CcuSmartData, public UchIOS { protected: byte* Begin; byte* Start; @@ -42,30 +43,40 @@ public: UchMsgBuffer (const UchMsgBuffer&, int = 0); // construct a fake buffer ~UchMsgBuffer (); - void Delete (); + void Clear (); void NeedSize (int n); void Grow () { NeedSize (GrowSize); } void Flush (int n = -1); void Flush (byte*); void SetSizes (int, int, int); - void Append (const byte*, int); - void Append (byte); - void Append (char c) { Append ((byte) c); } - void Append (sword s) { Append ((const byte*) &s, swsize); } - void Append (lword l) { Append ((const byte*) &l, lwsize); } - void Append (const char*, bool = TRUE); - void Append (UchMessage&); + void WriteBuf (const byte*, int); + void WriteByte (byte); + void WriteChar (char); + void WriteShort (sword); + void WriteLong (lword); + void WriteString (const char*); - 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 Get (UchMessage&); + void ReadBuf (byte*, int); + void ReadByte (byte&); + void ReadChar (char&); + void ReadShort (sword&); + void ReadLong (lword&); + void ReadString (char*); + void ReadString (CcuString&); + + 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); @@ -84,22 +95,9 @@ public: void Discard (int); bool Error () { return GetErr; } - bool Ok () { return GetErr ? FALSE : TRUE; } - void ResetError () { GetErr = FALSE; } + bool Ok () { return GetErr ? false : true; } + void ResetError () { GetErr = false; } - UchMsgBuffer& operator << (lword l) { Append (l); return *this; } - UchMsgBuffer& operator << (sword s) { Append (s); return *this; } - UchMsgBuffer& operator << (byte b) { Append (b); return *this; } - UchMsgBuffer& operator << (char c) { Append (c); return *this; } - UchMsgBuffer& operator << (const char* s) { Append (s, TRUE); return *this; } - - UchMsgBuffer& operator >> (lword& l) { Get (l); return *this; } - UchMsgBuffer& operator >> (sword& s) { Get (s); return *this; } - UchMsgBuffer& operator >> (byte& b) { Get (b); return *this; } - UchMsgBuffer& operator >> (char& c) { Get (c); return *this; } - UchMsgBuffer& operator >> (char* s) { Get (s); return *this; } - UchMsgBuffer& operator >> (CcuString& s) { Get (s); return *this; } - #ifdef DOC UchMsgBuffer& operator << (type data); UchMsgBuffer& operator >> (type& data); -- cgit v1.1