steghide  0.5.1
msg.h
Go to the documentation of this file.
1 /*
2  * steghide 0.5.1 - a steganography program
3  * Copyright (C) 1999-2003 Stefan Hetzl <shetzl@chello.at>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  *
19  */
20 
21 #ifndef SH_MSG_H
22 #define SH_MSG_H
23 
24 #include <cstdarg>
25 #include <string>
26 
27 class MessageBase {
28  public:
29  MessageBase (void) ;
30  MessageBase (std::string msg) ;
31  MessageBase (const char* msgfmt, ...) ;
32  virtual ~MessageBase() {} ;
33 
34  const std::string& getMessage (void) const
35  { return Message ; } ;
36 
37  void setMessage (std::string msg)
38  { Message = msg ; } ;
39 
44  void setNewline (bool prnl)
45  { Newline = prnl ; } ;
46 
50  const std::string getNewline (void) const
51  { return (Newline ? "\n" : "") ; } ;
52 
53  void setMessage (const char *msgfmt, ...) ;
54  virtual void printMessage (void) const = 0 ;
55 
56  protected:
57  static const unsigned int MsgMaxSize = 512 ;
58 
59  std::string compose (const char *msgfmt, ...) const ;
60  std::string vcompose (const char *msgfmt, va_list ap) const ;
61 
62  private:
63  std::string Message ;
64  bool Newline ;
65 } ;
66 
67 class Message : public MessageBase {
68  public:
69  Message (void) : MessageBase() {} ;
70  Message (std::string msg) : MessageBase (msg) {} ;
71  Message (const char *msgfmt, ...) ;
72 
73  void printMessage (void) const ;
74 } ;
75 
76 class VerboseMessage : public MessageBase {
77  public:
78  VerboseMessage (void) : MessageBase() {} ;
79  VerboseMessage (std::string msg) : MessageBase (msg) {} ;
80  VerboseMessage (const char *msgfmt, ...) ;
81 
82  void printMessage (void) const ;
83 } ;
84 
85 class Warning : public MessageBase {
86  public:
87  Warning (void) : MessageBase() {} ;
88  Warning (std::string msg) : MessageBase (msg) {} ;
89  Warning (const char *msgfmt, ...) ;
90 
91  void printMessage (void) const ;
92 } ;
93 
94 class CriticalWarning : public MessageBase {
95  public:
96  CriticalWarning (void) : MessageBase() {} ;
97  CriticalWarning (std::string msg) : MessageBase (msg) {} ;
98  CriticalWarning (const char *msgfmt, ...) ;
99 
100  void printMessage (void) const ;
101 } ;
102 
103 class Question : public MessageBase {
104  public:
105  Question (void) ;
106  Question (std::string msg) ;
107  Question (const char *msgfmt, ...) ;
108 
109  void printMessage (void) const ;
110 
115  bool getAnswer (void) ;
116 
117  private:
118  std::string yeschar ;
119  std::string nochar ;
120 } ;
121 
122 #endif /* ndef SH_MSG_H */
Question::nochar
std::string nochar
Definition: msg.h:119
Message::printMessage
void printMessage(void) const
Definition: msg.cc:92
VerboseMessage::VerboseMessage
VerboseMessage(void)
Definition: msg.h:78
Question
Definition: msg.h:103
MessageBase::setMessage
void setMessage(std::string msg)
Definition: msg.h:37
VerboseMessage::printMessage
void printMessage(void) const
Definition: msg.cc:113
MessageBase
Definition: msg.h:27
MessageBase::MsgMaxSize
static const unsigned int MsgMaxSize
Definition: msg.h:57
Warning::Warning
Warning(void)
Definition: msg.h:87
MessageBase::printMessage
virtual void printMessage(void) const =0
MessageBase::Message
std::string Message
Definition: msg.h:63
MessageBase::getMessage
const std::string & getMessage(void) const
Definition: msg.h:34
CriticalWarning
Definition: msg.h:94
Warning::printMessage
void printMessage(void) const
Definition: msg.cc:132
Question::getAnswer
bool getAnswer(void)
Definition: msg.cc:194
CriticalWarning::printMessage
void printMessage(void) const
Definition: msg.cc:151
CriticalWarning::CriticalWarning
CriticalWarning(void)
Definition: msg.h:96
MessageBase::compose
std::string compose(const char *msgfmt,...) const
Definition: msg.cc:62
Question::Question
Question(void)
Definition: msg.cc:159
CriticalWarning::CriticalWarning
CriticalWarning(std::string msg)
Definition: msg.h:97
Warning
Definition: msg.h:85
MessageBase::MessageBase
MessageBase(void)
Definition: msg.cc:33
Question::yeschar
std::string yeschar
Definition: msg.h:118
MessageBase::vcompose
std::string vcompose(const char *msgfmt, va_list ap) const
Definition: msg.cc:71
Message::Message
Message(void)
Definition: msg.h:69
MessageBase::~MessageBase
virtual ~MessageBase()
Definition: msg.h:32
Message::Message
Message(std::string msg)
Definition: msg.h:70
Message
Definition: msg.h:67
MessageBase::setNewline
void setNewline(bool prnl)
Definition: msg.h:44
Question::printMessage
void printMessage(void) const
Definition: msg.cc:185
MessageBase::Newline
bool Newline
Definition: msg.h:64
Warning::Warning
Warning(std::string msg)
Definition: msg.h:88
VerboseMessage
Definition: msg.h:76
VerboseMessage::VerboseMessage
VerboseMessage(std::string msg)
Definition: msg.h:79
MessageBase::getNewline
const std::string getNewline(void) const
Definition: msg.h:50