msg.h

Go to the documentation of this file.
00001 /*
00002  * steghide 0.5.1 - a steganography program
00003  * Copyright (C) 1999-2003 Stefan Hetzl <shetzl@chello.at>
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  *
00019  */
00020 
00021 #ifndef SH_MSG_H
00022 #define SH_MSG_H
00023 
00024 #include <cstdarg>
00025 #include <string>
00026 
00027 class MessageBase {
00028         public:
00029         MessageBase (void) ;
00030         MessageBase (std::string msg) ;
00031         MessageBase (const char* msgfmt, ...) ;
00032         virtual ~MessageBase() {} ;
00033 
00034         const std::string& getMessage (void) const
00035                 { return Message ; } ;
00036 
00037         void setMessage (std::string msg)
00038                 { Message = msg ; } ;
00039 
00044         void setNewline (bool prnl)
00045                 { Newline = prnl ; } ;
00046 
00050         const std::string getNewline (void) const
00051                 { return (Newline ? "\n" : "") ; } ;
00052 
00053         void setMessage (const char *msgfmt, ...) ;
00054         virtual void printMessage (void) const = 0 ;
00055 
00056         protected:
00057         static const unsigned int MsgMaxSize = 512 ;
00058 
00059         std::string compose (const char *msgfmt, ...) const ;
00060         std::string vcompose (const char *msgfmt, va_list ap) const ;
00061 
00062         private:
00063         std::string Message ;
00064         bool Newline ;
00065 } ;
00066 
00067 class Message : public MessageBase {
00068         public:
00069         Message (void) : MessageBase() {} ;
00070         Message (std::string msg) : MessageBase (msg) {} ;
00071         Message (const char *msgfmt, ...) ;
00072 
00073         void printMessage (void) const ;
00074 } ;
00075 
00076 class VerboseMessage : public MessageBase {
00077         public:
00078         VerboseMessage (void) : MessageBase() {} ;
00079         VerboseMessage (std::string msg) : MessageBase (msg) {} ;
00080         VerboseMessage (const char *msgfmt, ...) ;
00081 
00082         void printMessage (void) const ;
00083 } ;
00084 
00085 class Warning : public MessageBase {
00086         public:
00087         Warning (void) : MessageBase() {} ;
00088         Warning (std::string msg) : MessageBase (msg) {} ;
00089         Warning (const char *msgfmt, ...) ;
00090 
00091         void printMessage (void) const ;
00092 } ;
00093 
00094 class CriticalWarning : public MessageBase {
00095         public:
00096         CriticalWarning (void) : MessageBase() {} ;
00097         CriticalWarning (std::string msg) : MessageBase (msg) {} ;
00098         CriticalWarning (const char *msgfmt, ...) ;
00099 
00100         void printMessage (void) const ;
00101 } ;
00102 
00103 class Question : public MessageBase {
00104         public:
00105         Question (void) ;
00106         Question (std::string msg) ;
00107         Question (const char *msgfmt, ...) ;
00108 
00109         void printMessage (void) const ;
00110 
00115         bool getAnswer (void) ;
00116 
00117         private:
00118         std::string yeschar ;
00119         std::string nochar ;
00120 } ;
00121 
00122 #endif  /* ndef SH_MSG_H */

Generated on Fri Feb 2 09:21:48 2007 for steghide by  doxygen 1.5.1