stringify load errors.

SVN revision: 44660
This commit is contained in:
Gustavo Sverzut Barbieri 2009-12-22 18:06:15 +00:00
parent 826ecfdccc
commit 9f082cc1d4
2 changed files with 27 additions and 0 deletions

View File

@ -216,6 +216,7 @@ typedef struct _Evas_Event_Key_Down Evas_Event_Key_Down; /**< Event structure
typedef struct _Evas_Event_Key_Up Evas_Event_Key_Up; /**< Event structure for #EVAS_CALLBACK_KEY_UP event callbacks */
typedef struct _Evas_Event_Hold Evas_Event_Hold; /**< Event structure for #EVAS_CALLBACK_HOLD event callbacks */
/* load error identifiers, see evas_load_error_str() */
#define EVAS_LOAD_ERROR_NONE 0 /**< No error on load */
#define EVAS_LOAD_ERROR_GENERIC 1 /**< A non-specific error occured */
#define EVAS_LOAD_ERROR_DOES_NOT_EXIST 2 /**< File (or file path) does not exist */
@ -1117,6 +1118,8 @@ extern "C" {
/**
* Utilities:
*/
EAPI const char *evas_load_error_str(int error);
/**
* Every subclass should provide this at the beginning of their own

View File

@ -1065,3 +1065,27 @@ _evas_unwalk(Evas *e)
e->walking_list--;
if ((e->walking_list == 0) && (e->delete_me)) evas_free(e);
}
EAPI const char *
evas_load_error_str(int error)
{
switch (error)
{
case EVAS_LOAD_ERROR_NONE:
return "No error on load";
case EVAS_LOAD_ERROR_GENERIC:
return "A non-specific error occured";
case EVAS_LOAD_ERROR_DOES_NOT_EXIST:
return "File (or file path) does not exist";
case EVAS_LOAD_ERROR_PERMISSION_DENIED:
return "Permission deinied to an existing file (or path)";
case EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED:
return "Allocation of resources failure prevented load";
case EVAS_LOAD_ERROR_CORRUPT_FILE:
return "File corrupt (but was detected as a known format)";
case EVAS_LOAD_ERROR_UNKNOWN_FORMAT:
return "File is not a known format";
default:
return "Unknown error";
}
}