ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

common/error.cpp

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #include "common/error.h"
00024 
00025 #include "common/translation.h"
00026 
00027 namespace Common {
00028 
00035 static String errorToString(ErrorCode errorCode) {
00036     switch (errorCode) {
00037     case kNoError:
00038         return _s("No error");
00039     case kNoGameDataFoundError:
00040         return _s("Game data not found");
00041     case kUnsupportedGameidError:
00042         return _s("Game id not supported");
00043     case kUnsupportedColorMode:
00044         return _s("Unsupported color mode");
00045     case kAudioDeviceInitFailed:
00046         return _s("Audio device initialization failed");
00047 
00048     case kReadPermissionDenied:
00049         return _s("Read permission denied");
00050     case kWritePermissionDenied:
00051         return _s("Write permission denied");
00052 
00053     case kPathDoesNotExist:
00054         return _s("Path does not exist");
00055     case kPathNotDirectory:
00056         return _s("Path not a directory");
00057     case kPathNotFile:
00058         return _s("Path not a file");
00059 
00060     case kCreatingFileFailed:
00061         return _s("Cannot create file");
00062     case kReadingFailed:
00063         return _s("Reading data failed");
00064     case kWritingFailed:
00065         return _s("Writing data failed");
00066 
00067     case kEnginePluginNotFound:
00068         return _s("Could not find suitable engine plugin");
00069     case kEnginePluginNotSupportSaves:
00070         return _s("Engine plugin does not support saved games");
00071 
00072     case kUserCanceled:
00073         return _s("User canceled");
00074 
00075     case kUnknownError:
00076     default:
00077         return _s("Unknown error");
00078     }
00079 }
00080 
00081 Error::Error(ErrorCode code)
00082     : _code(code), _desc(errorToString(code)) {
00083 }
00084 
00085 Error::Error(ErrorCode code, const String &desc)
00086     : _code(code), _desc(errorToString(code) + " (" + desc + ")") {
00087 }
00088 
00089 
00090 } // End of namespace Common


Generated on Sat May 25 2019 05:00:44 for ResidualVM by doxygen 1.7.1
curved edge   curved edge