Message.h

Go to the documentation of this file.
00001 //**********************************************************************
00002 //
00003 //  REGCOM: Regimental Command
00004 //  Copyright (C) 2008 Randi J. Relander
00005 //    <rjrelander@users.sourceforge.net>
00006 //
00007 //  This program is free software; you can redistribute it and/or
00008 //  modify it under the terms of the GNU General Public License
00009 //  as published by the Free Software Foundation; either version 3
00010 //  of the License, or (at your option) any later version.
00011 //  
00012 //  This program is distributed in the hope that it will be useful,
00013 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 //  GNU General Public License for more details.
00016 //  
00017 //  You should have received a copy of the GNU General Public
00018 //  License along with this program.  If not, see 
00019 //  <http://www.gnu.org/licenses/>.
00020 //  
00021 //**********************************************************************
00022 
00023 #ifndef REGCOM_COMMON_NETWORK_MESSAGE_H
00024 #define REGCOM_COMMON_NETWORK_MESSAGE_H
00025 
00026 // SYSTEM INCLUDES
00027 #include <string>
00028 #include <iostream>
00029 
00030 // PROJECT INCLUDES
00031 #include "regcom/common/ErrorCode.h"
00032 
00033 // NAMESPACES
00034 namespace regcom {
00035 namespace network {
00036 
00037 class MessageData;
00038 
00040 //  CLASS: Message
00046 class Message
00047 {
00048 public:
00049 
00050     // PUBLIC METHODS
00051 
00053     Message();
00054 
00056     virtual ~Message();
00057 
00059     common::ErrorCodeType GetValue(std::string& rValue) const;
00060 
00062     common::ErrorCodeType SetValue(const std::string& rValue);
00063 
00065     common::ErrorCodeType GetAttribute(
00066         const std::string& rAttribute, std::string& rValue) const;
00067 
00069     common::ErrorCodeType SetAttribute(
00070         const std::string& rAttribute, const std::string& rValue);
00071 
00073     common::ErrorCodeType SetAttribute(
00074         const std::string& rAttribute, int value);
00075 
00076     // PUBLIC OPERATORS
00077 
00078     friend std::istream& operator >> 
00079         (std::istream& rInputStream, Message& rMessage);
00080     
00081     friend std::ostream& operator << 
00082         (std::ostream& rOutputStream, const Message& rMessage);
00083 
00084 private:
00085 
00086     // MEMBER VARIABLES
00087 
00089     MessageData* m_pMessageData;
00090 };
00091 
00092 } // namespace network
00093 } // namespace regcom
00094 
00095 #endif