hpdf_error.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*
  2. * << Haru Free PDF Library >> -- hpdf_error.h
  3. *
  4. * URL: http://libharu.org
  5. *
  6. * Copyright (c) 1999-2006 Takeshi Kanno <[email protected]>
  7. * Copyright (c) 2007-2009 Antony Dovgal <[email protected]>
  8. *
  9. * Permission to use, copy, modify, distribute and sell this software
  10. * and its documentation for any purpose is hereby granted without fee,
  11. * provided that the above copyright notice appear in all copies and
  12. * that both that copyright notice and this permission notice appear
  13. * in supporting documentation.
  14. * It is provided "as is" without express or implied warranty.
  15. *
  16. */
  17. #ifndef _HPDF_ERROR_H
  18. #define _HPDF_ERROR_H
  19. #include "hpdf_types.h"
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /* error-code */
  24. #define HPDF_ARRAY_COUNT_ERR 0x1001
  25. #define HPDF_ARRAY_ITEM_NOT_FOUND 0x1002
  26. #define HPDF_ARRAY_ITEM_UNEXPECTED_TYPE 0x1003
  27. #define HPDF_BINARY_LENGTH_ERR 0x1004
  28. #define HPDF_CANNOT_GET_PALLET 0x1005
  29. #define HPDF_DICT_COUNT_ERR 0x1007
  30. #define HPDF_DICT_ITEM_NOT_FOUND 0x1008
  31. #define HPDF_DICT_ITEM_UNEXPECTED_TYPE 0x1009
  32. #define HPDF_DICT_STREAM_LENGTH_NOT_FOUND 0x100A
  33. #define HPDF_DOC_ENCRYPTDICT_NOT_FOUND 0x100B
  34. #define HPDF_DOC_INVALID_OBJECT 0x100C
  35. /* 0x100D */
  36. #define HPDF_DUPLICATE_REGISTRATION 0x100E
  37. #define HPDF_EXCEED_JWW_CODE_NUM_LIMIT 0x100F
  38. /* 0x1010 */
  39. #define HPDF_ENCRYPT_INVALID_PASSWORD 0x1011
  40. /* 0x1012 */
  41. #define HPDF_ERR_UNKNOWN_CLASS 0x1013
  42. #define HPDF_EXCEED_GSTATE_LIMIT 0x1014
  43. #define HPDF_FAILD_TO_ALLOC_MEM 0x1015
  44. #define HPDF_FILE_IO_ERROR 0x1016
  45. #define HPDF_FILE_OPEN_ERROR 0x1017
  46. /* 0x1018 */
  47. #define HPDF_FONT_EXISTS 0x1019
  48. #define HPDF_FONT_INVALID_WIDTHS_TABLE 0x101A
  49. #define HPDF_INVALID_AFM_HEADER 0x101B
  50. #define HPDF_INVALID_ANNOTATION 0x101C
  51. /* 0x101D */
  52. #define HPDF_INVALID_BIT_PER_COMPONENT 0x101E
  53. #define HPDF_INVALID_CHAR_MATRICS_DATA 0x101F
  54. #define HPDF_INVALID_COLOR_SPACE 0x1020
  55. #define HPDF_INVALID_COMPRESSION_MODE 0x1021
  56. #define HPDF_INVALID_DATE_TIME 0x1022
  57. #define HPDF_INVALID_DESTINATION 0x1023
  58. /* 0x1024 */
  59. #define HPDF_INVALID_DOCUMENT 0x1025
  60. #define HPDF_INVALID_DOCUMENT_STATE 0x1026
  61. #define HPDF_INVALID_ENCODER 0x1027
  62. #define HPDF_INVALID_ENCODER_TYPE 0x1028
  63. /* 0x1029 */
  64. /* 0x102A */
  65. #define HPDF_INVALID_ENCODING_NAME 0x102B
  66. #define HPDF_INVALID_ENCRYPT_KEY_LEN 0x102C
  67. #define HPDF_INVALID_FONTDEF_DATA 0x102D
  68. #define HPDF_INVALID_FONTDEF_TYPE 0x102E
  69. #define HPDF_INVALID_FONT_NAME 0x102F
  70. #define HPDF_INVALID_IMAGE 0x1030
  71. #define HPDF_INVALID_JPEG_DATA 0x1031
  72. #define HPDF_INVALID_N_DATA 0x1032
  73. #define HPDF_INVALID_OBJECT 0x1033
  74. #define HPDF_INVALID_OBJ_ID 0x1034
  75. #define HPDF_INVALID_OPERATION 0x1035
  76. #define HPDF_INVALID_OUTLINE 0x1036
  77. #define HPDF_INVALID_PAGE 0x1037
  78. #define HPDF_INVALID_PAGES 0x1038
  79. #define HPDF_INVALID_PARAMETER 0x1039
  80. /* 0x103A */
  81. #define HPDF_INVALID_PNG_IMAGE 0x103B
  82. #define HPDF_INVALID_STREAM 0x103C
  83. #define HPDF_MISSING_FILE_NAME_ENTRY 0x103D
  84. /* 0x103E */
  85. #define HPDF_INVALID_TTC_FILE 0x103F
  86. #define HPDF_INVALID_TTC_INDEX 0x1040
  87. #define HPDF_INVALID_WX_DATA 0x1041
  88. #define HPDF_ITEM_NOT_FOUND 0x1042
  89. #define HPDF_LIBPNG_ERROR 0x1043
  90. #define HPDF_NAME_INVALID_VALUE 0x1044
  91. #define HPDF_NAME_OUT_OF_RANGE 0x1045
  92. /* 0x1046 */
  93. /* 0x1047 */
  94. #define HPDF_PAGE_INVALID_PARAM_COUNT 0x1048
  95. #define HPDF_PAGES_MISSING_KIDS_ENTRY 0x1049
  96. #define HPDF_PAGE_CANNOT_FIND_OBJECT 0x104A
  97. #define HPDF_PAGE_CANNOT_GET_ROOT_PAGES 0x104B
  98. #define HPDF_PAGE_CANNOT_RESTORE_GSTATE 0x104C
  99. #define HPDF_PAGE_CANNOT_SET_PARENT 0x104D
  100. #define HPDF_PAGE_FONT_NOT_FOUND 0x104E
  101. #define HPDF_PAGE_INVALID_FONT 0x104F
  102. #define HPDF_PAGE_INVALID_FONT_SIZE 0x1050
  103. #define HPDF_PAGE_INVALID_GMODE 0x1051
  104. #define HPDF_PAGE_INVALID_INDEX 0x1052
  105. #define HPDF_PAGE_INVALID_ROTATE_VALUE 0x1053
  106. #define HPDF_PAGE_INVALID_SIZE 0x1054
  107. #define HPDF_PAGE_INVALID_XOBJECT 0x1055
  108. #define HPDF_PAGE_OUT_OF_RANGE 0x1056
  109. #define HPDF_REAL_OUT_OF_RANGE 0x1057
  110. #define HPDF_STREAM_EOF 0x1058
  111. #define HPDF_STREAM_READLN_CONTINUE 0x1059
  112. /* 0x105A */
  113. #define HPDF_STRING_OUT_OF_RANGE 0x105B
  114. #define HPDF_THIS_FUNC_WAS_SKIPPED 0x105C
  115. #define HPDF_TTF_CANNOT_EMBEDDING_FONT 0x105D
  116. #define HPDF_TTF_INVALID_CMAP 0x105E
  117. #define HPDF_TTF_INVALID_FOMAT 0x105F
  118. #define HPDF_TTF_MISSING_TABLE 0x1060
  119. #define HPDF_UNSUPPORTED_FONT_TYPE 0x1061
  120. #define HPDF_UNSUPPORTED_FUNC 0x1062
  121. #define HPDF_UNSUPPORTED_JPEG_FORMAT 0x1063
  122. #define HPDF_UNSUPPORTED_TYPE1_FONT 0x1064
  123. #define HPDF_XREF_COUNT_ERR 0x1065
  124. #define HPDF_ZLIB_ERROR 0x1066
  125. #define HPDF_INVALID_PAGE_INDEX 0x1067
  126. #define HPDF_INVALID_URI 0x1068
  127. #define HPDF_PAGE_LAYOUT_OUT_OF_RANGE 0x1069
  128. #define HPDF_PAGE_MODE_OUT_OF_RANGE 0x1070
  129. #define HPDF_PAGE_NUM_STYLE_OUT_OF_RANGE 0x1071
  130. #define HPDF_ANNOT_INVALID_ICON 0x1072
  131. #define HPDF_ANNOT_INVALID_BORDER_STYLE 0x1073
  132. #define HPDF_PAGE_INVALID_DIRECTION 0x1074
  133. #define HPDF_INVALID_FONT 0x1075
  134. #define HPDF_PAGE_INSUFFICIENT_SPACE 0x1076
  135. #define HPDF_PAGE_INVALID_DISPLAY_TIME 0x1077
  136. #define HPDF_PAGE_INVALID_TRANSITION_TIME 0x1078
  137. #define HPDF_INVALID_PAGE_SLIDESHOW_TYPE 0x1079
  138. #define HPDF_EXT_GSTATE_OUT_OF_RANGE 0x1080
  139. #define HPDF_INVALID_EXT_GSTATE 0x1081
  140. #define HPDF_EXT_GSTATE_READ_ONLY 0x1082
  141. #define HPDF_INVALID_U3D_DATA 0x1083
  142. #define HPDF_NAME_CANNOT_GET_NAMES 0x1084
  143. #define HPDF_INVALID_ICC_COMPONENT_NUM 0x1085
  144. /*---------------------------------------------------------------------------*/
  145. /*---------------------------------------------------------------------------*/
  146. /*----- HPDF_Error ----------------------------------------------------------*/
  147. typedef struct _HPDF_Error_Rec *HPDF_Error;
  148. typedef struct _HPDF_Error_Rec {
  149. HPDF_STATUS error_no;
  150. HPDF_STATUS detail_no;
  151. HPDF_Error_Handler error_fn;
  152. void *user_data;
  153. } HPDF_Error_Rec;
  154. /* HPDF_Error_init
  155. *
  156. * if error_fn is NULL, the default-handlers are set as error-handler.
  157. * user_data is used to identify the object which threw an error.
  158. *
  159. */
  160. void
  161. HPDF_Error_Init (HPDF_Error error,
  162. void *user_data);
  163. void
  164. HPDF_Error_Reset (HPDF_Error error);
  165. HPDF_STATUS
  166. HPDF_Error_GetCode (HPDF_Error error);
  167. HPDF_STATUS
  168. HPDF_Error_GetDetailCode (HPDF_Error error);
  169. HPDF_STATUS
  170. HPDF_SetError (HPDF_Error error,
  171. HPDF_STATUS error_no,
  172. HPDF_STATUS detail_no);
  173. HPDF_STATUS
  174. HPDF_RaiseError (HPDF_Error error,
  175. HPDF_STATUS error_no,
  176. HPDF_STATUS detail_no);
  177. #ifdef __cplusplus
  178. }
  179. #endif /* __cplusplus */
  180. #endif /* _HPDF_ERROR_H */