Add ROS_ARCH environment variable
[reactos.git] / reactos / tools / rbuild / exception.cpp
index 47e0d32..d19179a 100644 (file)
-\r
-#include "pch.h"\r
-\r
-#include "rbuild.h"\r
-\r
-using std::string;\r
-\r
-Exception::Exception ()\r
-{\r
-}\r
-\r
-Exception::Exception ( const string& message )\r
-{\r
-       Message = message;\r
-}\r
-\r
-Exception::Exception ( const char* format,\r
-                       ...)\r
-{\r
-       va_list args;\r
-       va_start ( args,\r
-                  format);\r
-       Message = ssvprintf ( format,\r
-                             args);\r
-       va_end ( args );\r
-}\r
-\r
-void Exception::SetMessage ( const char* message,\r
-                             va_list args)\r
-{\r
-       Message = ssvprintf ( message,\r
-                             args);\r
-}\r
-\r
-\r
-OutOfMemoryException::OutOfMemoryException ()\r
-       : Exception ( "Out of memory" )\r
-{\r
-}\r
-\r
-\r
-InvalidOperationException::InvalidOperationException ( const char* filename,\r
-                                                          const int linenumber )\r
-{\r
-       Message = ssprintf ( "%s:%d",\r
-                            filename,\r
-                            linenumber );\r
-}\r
-\r
-InvalidOperationException::InvalidOperationException ( const char* filename,\r
-                                                          const int linenumber,\r
-                                                          const char* message,\r
-                                                          ... )\r
-{\r
-       string errorMessage;\r
-       va_list args;\r
-       va_start ( args,\r
-                  message );\r
-       errorMessage = ssvprintf ( message,\r
-                                  args );\r
-       va_end ( args );\r
-       Message = ssprintf ( "%s:%d %s",\r
-                            filename,\r
-                            linenumber,\r
-                            errorMessage.c_str () );\r
-}\r
-\r
-\r
-FileNotFoundException::FileNotFoundException ( const string& filename )\r
-       : Exception ( "File '%s' not found.",\r
-                     filename.c_str() )\r
-{\r
-       Filename = filename;\r
-}\r
-\r
-\r
-AccessDeniedException::AccessDeniedException ( const string& filename)\r
-       : Exception ( "Access denied to file '%s'.",\r
-                    filename.c_str() )\r
-{\r
-       Filename = filename;\r
-}\r
-\r
-\r
-InvalidBuildFileException::InvalidBuildFileException ( const string& location,\r
-                                                       const char* message,\r
-                                                       ...)\r
-{\r
-       va_list args;\r
-       va_start ( args,\r
-                  message );\r
-       SetLocationMessage ( location, message, args );\r
-       va_end ( args );\r
-}\r
-\r
-InvalidBuildFileException::InvalidBuildFileException ()\r
-{\r
-}\r
-\r
-void\r
-InvalidBuildFileException::SetLocationMessage ( const std::string& location,\r
-                                                const char* message,\r
-                                                va_list args )\r
-{\r
-       Message = location + ": " + ssvprintf ( message, args );\r
-}\r
-\r
-XMLSyntaxErrorException::XMLSyntaxErrorException ( const string& location,\r
-                                                      const char* message,\r
-                                                      ... )\r
-{\r
-       va_list args;\r
-       va_start ( args,\r
-                 message );\r
-       SetLocationMessage ( location, message, args );\r
-       va_end ( args );\r
-}\r
-\r
-\r
-RequiredAttributeNotFoundException::RequiredAttributeNotFoundException (\r
-       const string& location,\r
-       const string& attributeName,\r
-       const string& elementName )\r
-       : InvalidBuildFileException ( location,\r
-                                     "Required attribute '%s' not found on '%s'.",\r
-                                     attributeName.c_str (),\r
-                                     elementName.c_str ())\r
-{\r
-}\r
-\r
-InvalidAttributeValueException::InvalidAttributeValueException (\r
-       const string& location,\r
-       const string& name,\r
-       const string& value )\r
-       : InvalidBuildFileException ( location,\r
-                                     "Attribute '%s' has an invalid value '%s'.",\r
-                                     name.c_str (),\r
-                                     value.c_str () )\r
-{\r
-       \r
-}\r
-\r
-BackendNameConflictException::BackendNameConflictException ( const string& name )\r
-       : Exception ( "Backend name conflict: '%s'",\r
-                    name.c_str() )\r
-{\r
-}\r
-\r
-\r
-UnknownBackendException::UnknownBackendException ( const string& name )\r
-       : Exception ( "Unknown Backend requested: '%s'",\r
-                     name.c_str() )\r
-{\r
-}\r
-\r
-\r
-UnknownModuleTypeException::UnknownModuleTypeException ( const string& location,\r
-                                                         int moduletype )\r
-       : InvalidBuildFileException ( location,\r
-                                     "module type requested: %i",\r
-                                     moduletype )\r
-{\r
-}\r
-\r
-\r
-InvocationFailedException::InvocationFailedException ( const std::string& command,\r
-                                                       int exitcode )\r
-       : Exception ( "Failed to execute '%s' (exit code %d)",\r
-                     command.c_str (),\r
-                     exitcode )\r
-{\r
-       Command = command;\r
-       ExitCode = exitcode;\r
-}\r
+/*
+ * Copyright (C) 2005 Casper S. Hornstrup
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#include "pch.h"
+#include "rbuild.h"
+
+using std::string;
+
+Exception::Exception ()
+{
+}
+
+Exception::Exception ( const string& message )
+{
+       _e = message;
+}
+
+Exception::Exception ( const char* format, ...)
+{
+       va_list args;
+       va_start ( args, format);
+       _e = ssvprintf ( format, args);
+       va_end ( args );
+}
+
+void Exception::SetMessage ( const char* format, ...)
+{
+       va_list args;
+       va_start ( args, format);
+       _e = ssvprintf ( format, args);
+       va_end ( args );
+}
+
+void Exception::SetMessageV ( const char* message, va_list args )
+{
+       _e = ssvprintf ( message, args);
+}
+
+
+MissingArgumentException::MissingArgumentException ( const string& argument )
+       : Exception ( "Argument '%s' is missing",
+                     argument.c_str () )
+{
+}
+
+
+OutOfMemoryException::OutOfMemoryException ()
+       : Exception ( "Out of memory" )
+{
+}
+
+
+InvalidOperationException::InvalidOperationException (
+       const char* filename,
+       const int linenumber )
+       : Exception ( "%s:%d", filename, linenumber )
+{
+}
+
+InvalidDateException::InvalidDateException ( const string& filename)
+       : Exception ( "File '%s' has an invalid date.",
+                    filename.c_str() )
+{
+       Filename = filename;
+}
+
+InvalidOperationException::InvalidOperationException (
+       const char* filename,
+       const int linenumber,
+       const char* message,
+       ... )
+{
+       string errorMessage;
+       va_list args;
+       va_start ( args, message );
+       errorMessage = ssvprintf ( message, args );
+       va_end ( args );
+       SetMessage (
+               "%s:%d %s",
+               filename,
+               linenumber,
+               errorMessage.c_str () );
+}
+
+
+FileNotFoundException::FileNotFoundException ( const string& filename )
+       : Exception ( "File '%s' not found.",
+                     filename.c_str() )
+{
+       Filename = filename;
+}
+
+
+AccessDeniedException::AccessDeniedException ( const string& filename)
+       : Exception ( "Access denied to file or directory '%s'.",
+                    filename.c_str() )
+{
+       Filename = filename;
+}
+
+
+RequiredAttributeNotFoundException::RequiredAttributeNotFoundException (
+       const string& location,
+       const string& attributeName,
+       const string& elementName )
+       : XMLInvalidBuildFileException (
+               location,
+               "Required attribute '%s' not found on '%s'.",
+               attributeName.c_str (),
+               elementName.c_str ())
+{
+}
+
+InvalidAttributeValueException::InvalidAttributeValueException (
+       const string& location,
+       const string& name,
+       const string& value )
+       : XMLInvalidBuildFileException (
+               location,
+               "Attribute '%s' has an invalid value '%s'.",
+               name.c_str (),
+               value.c_str () )
+{
+       
+}
+
+BackendNameConflictException::BackendNameConflictException ( const string& name )
+       : Exception ( "Backend name conflict: '%s'",
+                    name.c_str() )
+{
+}
+
+
+UnknownBackendException::UnknownBackendException ( const string& name )
+       : Exception ( "Unknown Backend requested: '%s'",
+                     name.c_str() )
+{
+}
+
+
+UnknownModuleTypeException::UnknownModuleTypeException ( const string& location,
+                                                         int moduletype )
+       : XMLInvalidBuildFileException (
+               location,
+               "module type requested: %i",
+               moduletype )
+{
+}
+
+
+InvocationFailedException::InvocationFailedException ( const std::string& command,
+                                                       int exitcode )
+       : Exception ( "Failed to execute '%s' (exit code %d)",
+                     command.c_str (),
+                     exitcode )
+{
+       Command = command;
+       ExitCode = exitcode;
+}
+
+
+UnsupportedBuildToolException::UnsupportedBuildToolException ( const std::string& buildTool,
+                                                               const std::string& version )
+       : Exception ( "Build tool '%s' with version '%s' is unsupported. Please upgrade your build tool.",
+                     buildTool.c_str (),
+                     version.c_str () )
+{
+       BuildTool = buildTool;
+       Version  = version;
+}