-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathError.h
More file actions
executable file
·117 lines (101 loc) · 4.6 KB
/
Error.h
File metadata and controls
executable file
·117 lines (101 loc) · 4.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
//------------------------------------------------------------------------------
/// Filename: Error.h
/// Description: Header for Class Error
/// Authors:
/// Robin Ankele (0931951)
/// Tutor: Manuel Weber
/// Group: 24
/// Created: 08.09.2011
/// Last change: 08.09.2011
//------------------------------------------------------------------------------
#ifndef ERROR_H_INCLUDED
#define ERROR_H_INCLUDED
#include <iostream>
#include <string>
class Error
{
private:
//----------------------------------------------------------------------------
/// Copy Constructor
/// Makes a copy of another Error Object.
/// @param source Original to copy.
Error(const Error& source);
//----------------------------------------------------------------------------
/// Assignment Operator
/// Used to assign one Error to another
/// @param source Original with values to copy.
Error &operator=(const Error& source);
public:
//----------------------------------------------------------------------------
/// Constructor
Error() {}
//----------------------------------------------------------------------------
/// Destructor
virtual ~Error() throw() {}
//----------------------------------------------------------------------------
/// "usage: exA -c=configfile\n"
/// usageConfigFile() : Prints Errormessage
/// @return returns void
inline void usageConfigFile()
{ std::cout<<"usage: exA -c=configfile"<<std::endl;}
//----------------------------------------------------------------------------
/// "error: out of memory\n"
/// outOfMemory() : Prints Errormessage
/// @return returns void
inline void outOfMemory()
{ std::cout<<"error: out of memory"<<std::endl;}
//----------------------------------------------------------------------------
/// "error: cannot read configfile [filename]\n"
/// cannotReadConfigFile() : Prints Errormessage
/// @param filename is the filename of the configfile
/// @return returns void
inline void cannotReadConfigFile(std::string filename)
{ std::cout<<"error: cannot read configfile "<<filename<<std::endl;}
//----------------------------------------------------------------------------
/// "error: configfile [filename] corrupt\n"
/// configFileCorrupt() : Prints Errormessage
/// @return returns void
inline void configFileCorrupt(std::string filename)
{ std::cout<<"error: configfile "<<filename<<" corrupt"<<std::endl;}
//----------------------------------------------------------------------------
/// "warning: file [filename] exists and will be replaced. Do you want to
/// proceed? (y/n)\n"
/// filenameExists() : Prints Errormessage
/// @return returns void
inline void filenameExists(std::string filename)
{ std::cout<<"warning: file "<<filename<<" exists and will be "<<std::flush
<<"replaced. Do you want to proceed? (y/n)"<<std::endl;}
//----------------------------------------------------------------------------
/// "error: unknown command\n"
/// unkownCommand() : Prints Errormessage
/// @return returns void
inline void unknownCommand()
{ std::cout<<"error: unknown command"<<std::endl;}
//----------------------------------------------------------------------------
/// "error: invalid parameter - please enter an integer number\n"
/// invalidParameter() : Prints Errormessage
/// @return returns void
inline void invalidParameter()
{ std::cout<<"error: invalid parameter - please enter an "<<std::flush
<<"integer number"<<std::endl;}
//----------------------------------------------------------------------------
/// "error: id does not exist\n"
/// idDoesnotExist() : Prints Errormessage
/// @return returns void
inline void idDoesnotExist()
{ std::cout<<"error: id does not exist"<<std::endl;}
//----------------------------------------------------------------------------
/// "error: id does already exist\n"
/// idAlreadyExist() : Prints Errormessage
/// @return returns void
inline void idAlreadyExist()
{ std::cout<<"error: id does already exist"<<std::endl;}
//----------------------------------------------------------------------------
/// "error: cannot write to savefile [filename]. Quit anyway? (y/n)\n"
/// cannotWriteToFile() : Prints Errormessage
/// @return returns void
inline void cannotWriteToFile(std::string filename)
{ std::cout<<"error: cannot write to savefile "<<filename<<". "<<std::flush
<<"Quit anyway? (y/n)"<<std::endl;}
};
#endif //ERROR_H_INCLUDED