2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * The Original Code is: all of this file.
23 * Contributor(s): none yet.
25 * ***** END GPL LICENSE BLOCK *****
28 /** \file NG_NetworkMessage.h
30 * \brief generic Network Message class
32 #ifndef __NG_NETWORKMESSAGE_H__
33 #define __NG_NETWORKMESSAGE_H__
35 #include "STR_HashedString.h"
37 #ifdef WITH_CXX_GUARDEDALLOC
38 #include "MEM_guardedalloc.h"
41 class NG_NetworkMessage
44 int m_uniqueMessageID; // intern counting MessageID
45 unsigned int m_ClientId;
48 STR_String m_to; // receiver
49 STR_String m_from; // sender
50 STR_String m_subject; // empty or propName
51 STR_String m_message; // message or propValue
59 const STR_String& from,
60 const STR_String& subject,
61 const STR_String& body);
67 // This is not nice code you should'nt need to resort to
78 * set the content of this message
80 void SetMessageText(const STR_String& msgtext) {
85 * get the (read-only) To part of this message
87 const STR_String& GetDestinationName() { return m_to; }
90 * get the (read-only) From part of this message
92 const STR_String& GetSenderName() { return m_from; }
95 * get the (read-only) Subject part of this message
97 const STR_String& GetSubject() { return m_subject; }
100 * get the (read-only) Body part of this message
102 const STR_String& GetMessageText() {
103 //cout << "GetMessageText " << m_message << "\n";
106 const STR_String& GetMessageText() const {
107 //cout << "GetMessageText " << m_message << "\n";
112 * Set the NetworkMessage sender identifier
114 void SetSender(unsigned int ClientId) {
115 m_ClientId = ClientId;
119 * Get the NetworkMessage sender identifier
121 unsigned int GetSender(void) {
126 * get the unique Network Message ID
129 return m_uniqueMessageID;
133 #ifdef WITH_CXX_GUARDEDALLOC
135 void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:NG_NetworkMessage"); }
136 void operator delete( void *mem ) { MEM_freeN(mem); }
140 #endif //__NG_NETWORKMESSAGE_H__