kmediad 0.5.0a
A cross-platform Web-based audio player
klib_error.h
Go to the documentation of this file.
00001 #pragma once
00002 
00003 #include "klib_string.h"
00004 
00006 #define KLIB_ERROR_OK 0
00007 
00008 #define KLIB_ERROR_OPEN_WRITE 100
00009 
00010 #define KLIB_ERROR_OPEN_READ 101
00011 
00012 #define KLIB_ERROR_STAT 102
00013 
00014 #define KLIB_ERROR_NOTREG 103
00015 
00016 #define KLIB_ERROR_MEMORY 104
00017 
00018 #define KLIB_ERROR_NOT_DIR 105
00019 
00020 #define KLIB_ERROR_LS_DIR 106
00021 
00022 #define KLIB_ERROR_OPEN_SOCKET 107
00023 
00024 #define KLIB_ERROR_GETHOSTBYNAME 108
00025 
00026 #define KLIB_ERROR_CONNECT 109
00027 
00028 #define KLIB_ERROR_HTTPNOTOK 110
00029 
00030 #define KLIB_ERROR_JSON_SYNTAX 111
00031 
00032 
00047 typedef const char *(*klib_Error_PErrorFunc) (int code);
00048 
00050 struct _klib_Error
00051   {
00052   klib_Object base;
00055   klib_String *msg;
00057   int code;
00059   klib_Error_PErrorFunc perror_func;
00060   };
00061 
00062 typedef struct _klib_Error klib_Error; 
00063 
00064 // Protected
00066 void klib_error_dispose (klib_Error *self);
00068 void klib_error_construct (klib_Error *self, const char *class_name, 
00069   int code, klib_Error_PErrorFunc error_func, const char *msg);
00070 
00071 // Public
00073 klib_Error *klib_error_new (int code, klib_Error_PErrorFunc error_func, const char *fmt,...);
00074 
00077 klib_String *klib_error_full_message (const klib_Error *self); 
00078 
00079 // static
00081 const char *klib_error_default_perror (int code);
00082