- Update address of Free Software Foundation.
[reactos.git] / reactos / tools / rbuild / exception.h
1 /*
2 * Copyright (C) 2005 Casper S. Hornstrup
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18 #ifndef __EXCEPTION_H
19 #define __EXCEPTION_H
20
21 #include "pch.h"
22 #include "xml.h"
23
24 class Exception
25 {
26 public:
27 Exception ( const std::string& message );
28 Exception ( const char* format,
29 ...);
30 const std::string& operator *() { return _e; }
31
32 protected:
33 Exception ();
34 void SetMessage ( const char* message, ... );
35 void SetMessageV ( const char* message, va_list args );
36
37 private:
38 std::string _e;
39 };
40
41
42 class MissingArgumentException : public Exception
43 {
44 public:
45 MissingArgumentException ( const std::string& argument );
46 };
47
48
49 class InvalidOperationException : public Exception
50 {
51 public:
52 InvalidOperationException ( const char* filename,
53 const int linenumber);
54 InvalidOperationException ( const char* filename,
55 const int linenumber,
56 const char* message,
57 ... );
58 };
59
60
61 class OutOfMemoryException : public Exception
62 {
63 public:
64 OutOfMemoryException ();
65 };
66
67
68 class FileNotFoundException : public Exception
69 {
70 public:
71 FileNotFoundException ( const std::string& filename );
72 std::string Filename;
73 };
74
75
76 class AccessDeniedException : public Exception
77 {
78 public:
79 AccessDeniedException ( const std::string& filename );
80 std::string Filename;
81 };
82
83 class InvalidDateException : public Exception
84 {
85 public:
86 InvalidDateException ( const std::string& filename );
87 std::string Filename;
88 };
89
90 class RequiredAttributeNotFoundException : public XMLInvalidBuildFileException
91 {
92 public:
93 RequiredAttributeNotFoundException ( const std::string& location,
94 const std::string& attributeName,
95 const std::string& elementName );
96 };
97
98
99 class InvalidAttributeValueException : public XMLInvalidBuildFileException
100 {
101 public:
102 InvalidAttributeValueException ( const std::string& location,
103 const std::string& name,
104 const std::string& value );
105 };
106
107
108 class BackendNameConflictException : public Exception
109 {
110 public:
111 BackendNameConflictException ( const std::string& name );
112 };
113
114
115 class UnknownBackendException : public Exception
116 {
117 public:
118 UnknownBackendException ( const std::string& name );
119 };
120
121 class UnknownModuleTypeException : public XMLInvalidBuildFileException
122 {
123 public:
124 UnknownModuleTypeException ( const std::string& location,
125 int moduletype );
126 };
127
128
129 class InvocationFailedException : public Exception
130 {
131 public:
132 InvocationFailedException ( const std::string& command,
133 int exitcode );
134 std::string Command;
135 int ExitCode;
136 };
137
138
139 class UnsupportedBuildToolException : public Exception
140 {
141 public:
142 UnsupportedBuildToolException ( const std::string& buildtool,
143 const std::string& version );
144 std::string BuildTool;
145 std::string Version;
146 };
147
148 #endif /* __EXCEPTION_H */