From 0223e22e5ac2a4cab8a4031612b007b2cda0517b Mon Sep 17 00:00:00 2001 From: DarkWyrm Date: Fri, 11 Jun 2004 12:55:42 +0000 Subject: [PATCH] Janitorial work, mostly. Removed SetMsgCode() git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7903 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/app/Session.h | 162 ++++++++++++++++++++-------------- 1 file changed, 94 insertions(+), 68 deletions(-) diff --git a/headers/private/app/Session.h b/headers/private/app/Session.h index f9c9a7f308..3a543ebc00 100644 --- a/headers/private/app/Session.h +++ b/headers/private/app/Session.h @@ -1,3 +1,29 @@ +//------------------------------------------------------------------------------ +// Copyright (c) 2001-2002, OpenBeOS +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// +// File Name: Session.h +// Author: Adi Oanca +// Description: Stream-based messaging class +// +//------------------------------------------------------------------------------ #ifndef _SESSION_H #define _SESSION_H @@ -8,78 +34,78 @@ #include #include -class BSession { - +class BSession +{ public: - BSession(port_id receivePort, port_id sendPort); - BSession(int32, char *); - BSession( const BSession &ses ); - virtual ~BSession(); - void SetSendPort( port_id port ); - void SetRecvPort( port_id port ); - port_id GetSendPort(void) const { return fSendPort; } - port_id GetRecvPort(void) const { return fReceivePort; } - void SetMsgCode(int32 code); + BSession(port_id receivePort, port_id sendPort); + BSession(int32, char *); + BSession( const BSession &ses ); + virtual ~BSession(void); + void SetSendPort( port_id port ); + void SetRecvPort( port_id port ); + port_id GetSendPort(void) const { return fSendPort; } + port_id GetRecvPort(void) const { return fReceivePort; } + + char *ReadString(); + void ReadBool( bool *b ); + void ReadInt8( int8 *i ); + void ReadUInt8( uint8 *i ); + void ReadInt16( int16 *i ); + void ReadUInt16( uint16 *i ); + void ReadInt32( int32 *i ); + void ReadUInt32( uint32 *i ); + void ReadInt64( int64 *i ); + void ReadUInt64( uint64 *i ); + void ReadFloat( float *f ); + void ReadFloatFromInt32( float *f ); + void ReadDouble( double *d ); + void ReadDoubleFromInt64( double *d ); + void ReadPoint( BPoint *point ); + void ReadPointFromInts( BPoint *point ); + void ReadRectCR( clipping_rect *rect ); + void ReadRect( BRect *rect ); + void ReadRectFromInts( BRect *rect ); + void ReadData( void* data, int32 size ); + + void WriteString( const char* string ); + void WriteBool( const bool& b ); + void WriteInt8( const int8& i ); + void WriteUInt8( const uint8& i ); + void WriteInt16( const int16& i ); + void WriteUInt16( const uint16& i ); + void WriteInt32( const int32& i ); + void WriteUInt32( const uint32& i ); + void WriteInt64( const int64& i ); + void WriteUInt64( const uint64& i ); + void WriteFloat(const float& f ); + void WriteFloatAsInt32( const float& f ); + void WriteDouble( const double& d ); + void WriteDoubleAsInt64( const double& d ); + void WritePoint(const BPoint& point); + void WritePointAsInt32s(const BPoint& point); + void WriteRect(const clipping_rect& rect); + void WriteRect(const BRect& rect); + void WriteRectAsInt32s(const BRect& rect); + void WriteData(const void* data, int32 size); + + void Sync(); + void Close(); - char* ReadString(); - void ReadBool( bool *b ); - void ReadInt8( int8 *i ); - void ReadUInt8( uint8 *i ); - void ReadInt16( int16 *i ); - void ReadUInt16( uint16 *i ); - void ReadInt32( int32 *i ); - void ReadUInt32( uint32 *i ); - void ReadInt64( int64 *i ); - void ReadUInt64( uint64 *i ); - void ReadFloat( float *f ); - void ReadFloatFromInt32( float *f ); - void ReadDouble( double *d ); - void ReadDoubleFromInt64( double *d ); - void ReadPoint( BPoint *point ); - void ReadPointFromInts( BPoint *point ); - void ReadRectCR( clipping_rect *rect ); - void ReadRect( BRect *rect ); - void ReadRectFromInts( BRect *rect ); - void ReadData( void* data, int32 size ); + // if possible, do not use + void SetMsgCode(int32 code); + void CopyToSendBuffer(void* buffer, int32 count); - void WriteString( const char* string ); - void WriteBool( const bool& b ); - void WriteInt8( const int8& i ); - void WriteUInt8( const uint8& i ); - void WriteInt16( const int16& i ); - void WriteUInt16( const uint16& i ); - void WriteInt32( const int32& i ); - void WriteUInt32( const uint32& i ); - void WriteInt64( const int64& i ); - void WriteUInt64( const uint64& i ); - void WriteFloat(const float& f ); - void WriteFloatAsInt32( const float& f ); - void WriteDouble( const double& d ); - void WriteDoubleAsInt64( const double& d ); - void WritePoint(const BPoint& point); - void WritePointAsInt32s(const BPoint& point); - void WriteRect(const clipping_rect& rect); - void WriteRect(const BRect& rect); - void WriteRectAsInt32s(const BRect& rect); - void WriteData(const void* data, int32 size); - - void Sync(); - void Close(); - // if possible - do not use! - void CopyToSendBuffer(void* buffer, int32 count); private: - - port_id fSendPort; - port_id fReceivePort; - - char *fSendBuffer; - int32 fSendPosition; - int32 fSendCode; - int32 fRecvCode; - - char *fReceiveBuffer; - int32 fReceiveSize; - int32 fReceivePosition; + port_id fSendPort; + port_id fReceivePort; + + char *fSendBuffer; + int32 fSendPosition; + int32 fRecvCode; + + char *fReceiveBuffer; + int32 fReceiveSize; + int32 fReceivePosition; };