message.cc

Go to the documentation of this file.
00001 /*
00002    The lestes compiler suite
00003    Copyright (C) 2002, 2003, 2004, 2005 Miroslav Tichy
00004    Copyright (C) 2002, 2003, 2004, 2005 Petr Zika
00005    Copyright (C) 2002, 2003, 2004, 2005 Vojtech Hala
00006    Copyright (C) 2002, 2003, 2004, 2005 Jiri Kosina
00007    Copyright (C) 2002, 2003, 2004, 2005 Pavel Sanda
00008    Copyright (C) 2002, 2003, 2004, 2005 Jan Zouhar
00009    Copyright (C) 2002, 2003, 2004, 2005 Rudolf Thomas
00010 
00011    This program is free software; you can redistribute it and/or modify
00012    it under the terms of the GNU General Public License as published by
00013    the Free Software Foundation; version 2 of the License.
00014 
00015    This program is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018    GNU General Public License for more details.
00019 
00020    See the full text of the GNU General Public License version 2, and
00021    the limitations in the file doc/LICENSE.
00022 
00023    By accepting the license the licensee waives any and all claims
00024    against the copyright holder(s) related in whole or in part to the
00025    work, its use, and/or the inability to use it.
00026  
00027  */
00028 /*! \file
00029   \brief Message wrapper.
00030 
00031   Definition of message class representing message.
00032   \author pt
00033 */
00034 #include <lestes/common.hh>
00035 #include <lestes/equality.hh>
00036 #include <lestes/msg/message.hh>
00037 
00038 package(lestes);
00039 package(msg);
00040 
00041 /*! 
00042   Creates a message.
00043   \param a_kind  The identification of the message kind.
00044   \param a_tex  The text of the message.
00045   \param a_flags  The flags for the message.
00046 */
00047 message::message(ulint a_kind, const lstring &a_text, flags_type a_flags):
00048         kind(a_kind),
00049         text(a_text),
00050         flags(a_flags)
00051 {
00052 }
00053 
00054 /*!
00055   Returns messsage kind identification.
00056   \return  The identification number of the message kind.
00057 */
00058 ulint message::kind_get(void) const
00059 {
00060         return kind;
00061 }
00062 
00063 /*!
00064   Returns the messsage text. 
00065   \return  The text of the message.
00066 */
00067 lstring message::text_get(void) const
00068 {
00069         return text;
00070 }
00071 
00072 /*!
00073   Returns the messsage flags. 
00074   \return  The flags of the message.
00075 */
00076 message::flags_type message::flags_get(void) const
00077 {
00078         return flags;
00079 }
00080 
00081 /*!
00082   Tests equality to other message.
00083   \param other  The message to compare to.
00084   \return true  If both messages have the same fields.
00085 */
00086 bool message::equals(const ptr<message> &other) const
00087 {
00088         return other &&
00089                 is_equal(kind,other->kind_get()) &&
00090                 is_equal(text,other->text_get()) &&
00091                 is_equal(flags,other->flags_get());
00092 }
00093 
00094 /*!
00095   Returns new message.
00096   \param a_kind  The unique identification the message kind.
00097   \param a_text  The text of the message.
00098   \param a_flags  The flags for the message.
00099   \return The message with supplied text.
00100 */
00101 ptr<message> message::create(ulint a_kind, const lstring &a_text, flags_type a_flags)
00102 {
00103         return new message(a_kind,a_text,a_flags);
00104 }
00105 
00106 end_package(msg);
00107 end_package(lestes);
00108 /* vim: set ft=lestes : */

Generated on Mon Feb 12 18:22:41 2007 for lestes by doxygen 1.5.1-20070107