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 */
VerboseMessage(void)
Definition: msg.h:78
Definition: msg.h:27
std::string Message
Definition: msg.h:63
Definition: msg.h:94
Definition: msg.h:67
CriticalWarning(void)
Definition: msg.h:96
Message(std::string msg)
Definition: msg.h:70
Definition: msg.h:76
std::string nochar
Definition: msg.h:119
void setMessage(std::string msg)
Definition: msg.h:37
std::string compose(const char *msgfmt,...) const
Definition: msg.cc:62
static const unsigned int MsgMaxSize
Definition: msg.h:57
const std::string & getMessage(void) const
Definition: msg.h:34
const std::string getNewline(void) const
Definition: msg.h:50
virtual void printMessage(void) const =0
CriticalWarning(std::string msg)
Definition: msg.h:97
virtual ~MessageBase()
Definition: msg.h:32
Definition: msg.h:85
Definition: msg.h:103
bool Newline
Definition: msg.h:64
std::string vcompose(const char *msgfmt, va_list ap) const
Definition: msg.cc:71
void setNewline(bool prnl)
Definition: msg.h:44
Warning(std::string msg)
Definition: msg.h:88
Message(void)
Definition: msg.h:69
std::string yeschar
Definition: msg.h:118
MessageBase(void)
Definition: msg.cc:33
VerboseMessage(std::string msg)
Definition: msg.h:79
Warning(void)
Definition: msg.h:87