You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

239 lines
9.0 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: pantheios/backends/bec.COMErrorObject.h
  3. *
  4. * Purpose: Declaration of the Pantheios COMErrorObject Stock Back-end API.
  5. *
  6. * Created: 21st June 2005
  7. * Updated: 30th April 2010
  8. *
  9. * Home: http://www.pantheios.org/
  10. *
  11. * Copyright (c) 2005-2010, Matthew Wilson and Synesis Software
  12. * All rights reserved.
  13. *
  14. * Redistribution and use in source and binary forms, with or without
  15. * modification, are permitted provided that the following conditions are
  16. * met:
  17. *
  18. * - Redistributions of source code must retain the above copyright notice,
  19. * this list of conditions and the following disclaimer.
  20. * - Redistributions in binary form must reproduce the above copyright
  21. * notice, this list of conditions and the following disclaimer in the
  22. * documentation and/or other materials provided with the distribution.
  23. * - Neither the name(s) of Matthew Wilson and Synesis Software nor the
  24. * names of any contributors may be used to endorse or promote products
  25. * derived from this software without specific prior written permission.
  26. *
  27. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  28. * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  29. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  30. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  31. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  32. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  33. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  34. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  35. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  36. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  37. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  38. *
  39. * ////////////////////////////////////////////////////////////////////// */
  40. /** \file pantheios/backends/bec.COMErrorObject.h
  41. *
  42. * [C, C++] Pantheios COM Error Object Back-end Common API
  43. */
  44. #ifndef PANTHEIOS_INCL_PANTHEIOS_BACKENDS_H_COMERROROBJECT
  45. #define PANTHEIOS_INCL_PANTHEIOS_BACKENDS_H_COMERROROBJECT
  46. /* /////////////////////////////////////////////////////////////////////////
  47. * Version information
  48. */
  49. #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
  50. # define PANTHEIOS_VER_PANTHEIOS_BACKENDS_H_BEC_COMERROROBJECT_MAJOR 3
  51. # define PANTHEIOS_VER_PANTHEIOS_BACKENDS_H_BEC_COMERROROBJECT_MINOR 1
  52. # define PANTHEIOS_VER_PANTHEIOS_BACKENDS_H_BEC_COMERROROBJECT_REVISION 1
  53. # define PANTHEIOS_VER_PANTHEIOS_BACKENDS_H_BEC_COMERROROBJECT_EDIT 22
  54. #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
  55. /* /////////////////////////////////////////////////////////////////////////
  56. * Includes
  57. */
  58. #ifndef PANTHEIOS_INCL_PANTHEIOS_H_PANTHEIOS
  59. # include <pantheios/pantheios.h>
  60. #endif /* !PANTHEIOS_INCL_PANTHEIOS_H_PANTHEIOS */
  61. #ifndef PANTHEIOS_INCL_PANTHEIOS_H_BACKEND
  62. # include <pantheios/backend.h>
  63. #endif /* !PANTHEIOS_INCL_PANTHEIOS_H_BACKEND */
  64. /* /////////////////////////////////////////////////////////////////////////
  65. * Documentation
  66. */
  67. /** \defgroup group__backend__stock_backends__COMErrorObject Pantheios COM Error Object Stock Back-end
  68. * \ingroup group__backend__stock_backends
  69. * Back-end library that sets the calling threads's COM error object.
  70. */
  71. /* /////////////////////////////////////////////////////////////////////////
  72. * Constants
  73. */
  74. /** \defgroup group__backend__stock_backends__COMErrorObject__flags Pantheios COM Error Object Stock Back-end Flags
  75. * \ingroup group__backend__stock_backends__COMErrorObject
  76. * Flags for the \ref group__backend__stock_backends__COMErrorObject
  77. */
  78. /** \def PANTHEIOS_BE_COMERROROBJECT_F_DONT_OVERWRITE_EXISTING
  79. * Prevents the \ref group__backend__stock_backends__COMErrorObject
  80. * from writing to the COM Error Object if there is an existing error
  81. * object set (for the calling thread). This is helpful when several
  82. * levels of code are handling and reporting errors, so as not to lose.
  83. * the innermost (and most exact) error report.
  84. * \ingroup group__backend__stock_backends__COMErrorObject__flags
  85. */
  86. #define PANTHEIOS_BE_COMERROROBJECT_F_DONT_OVERWRITE_EXISTING (0x00100000)
  87. /* /////////////////////////////////////////////////////////////////////////
  88. * Typedefs
  89. */
  90. /** Structure used for specifying initialisation information to the
  91. * be.COMErrorObject library.
  92. * \ingroup group__backend__stock_backends__COMErrorObject
  93. */
  94. struct pan_be_COMErrorObject_init_t
  95. {
  96. #if !defined(PANTHEIOS_DOCUMENTATION_SKIP_SECTION) && \
  97. !defined(PANTHEIOS_NO_NAMESPACE)
  98. typedef pantheios::pan_uint16_t pan_uint16_t;
  99. typedef pantheios::pan_uint32_t pan_uint32_t;
  100. #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION && !PANTHEIOS_NO_NAMESPACE */
  101. pan_uint32_t version; /*!< Must be initialised to the value of PANTHEIOS_VER */
  102. pan_uint32_t flags; /*!< \ref group__backend__stock_backends__COMErrorObject__flags "Flags" that control the information displayed. */
  103. #ifdef __cplusplus
  104. public: /* Construction */
  105. # ifndef PANTHEIOS_BE_INIT_NO_CPP_STRUCT_INIT
  106. pan_be_COMErrorObject_init_t();
  107. # endif /* !PANTHEIOS_BE_INIT_NO_CPP_STRUCT_INIT */
  108. #endif /* __cplusplus */
  109. };
  110. #ifndef __cplusplus
  111. typedef struct pan_be_COMErrorObject_init_t pan_be_COMErrorObject_init_t;
  112. #endif /* !__cplusplus */
  113. /* /////////////////////////////////////////////////////////////////////////
  114. * Application-defined functions
  115. */
  116. /** Callback function defined by the application, invoked when the
  117. * API is initialised with a NULL <code>init</code> parameter.
  118. *
  119. * \note When using explicit initialisation, this function must be defined,
  120. * but will not be invoked.
  121. */
  122. PANTHEIOS_CALL(void) pantheios_be_COMErrorObject_getAppInit(
  123. int backEndId
  124. , pan_be_COMErrorObject_init_t* init
  125. ) /* throw() */;
  126. /* /////////////////////////////////////////////////////////////////////////
  127. * API
  128. */
  129. /** Fills out a copy of the initialisation structure with default
  130. * values (representative of the default behaviour of the library),
  131. * ready to be customised and passed to the API initialiser function
  132. * pantheios_be_COMErrorObject_init().
  133. */
  134. PANTHEIOS_CALL(void) pantheios_be_COMErrorObject_getDefaultAppInit(
  135. pan_be_COMErrorObject_init_t* init
  136. ) /* throw() */;
  137. /** Implements the functionality for pantheios_be_init() over the COM Error Object API.
  138. * \ingroup group__backend__stock_backends__COMErrorObject
  139. */
  140. PANTHEIOS_CALL(int) pantheios_be_COMErrorObject_init(
  141. PAN_CHAR_T const* processIdentity
  142. , int id
  143. , pan_be_COMErrorObject_init_t const* init
  144. , void* reserved
  145. , void** ptoken
  146. );
  147. /** Implements the functionality for pantheios_be_uninit() over the COM Error Object API.
  148. * \ingroup group__backend__stock_backends__COMErrorObject
  149. */
  150. PANTHEIOS_CALL(void) pantheios_be_COMErrorObject_uninit(
  151. void* token
  152. );
  153. /** Implements the functionality for pantheios_be_logEntry() over the COM Error Object API.
  154. * \ingroup group__backend__stock_backends__COMErrorObject
  155. */
  156. PANTHEIOS_CALL(int) pantheios_be_COMErrorObject_logEntry(
  157. void* feToken
  158. , void* beToken
  159. , int severity
  160. , PAN_CHAR_T const* entry
  161. , size_t cchEntry
  162. );
  163. /** Parses the be.COMErrorObject back-end flags
  164. *
  165. * \ingroup group__backend
  166. *
  167. * Processes an argument list in the same way as
  168. * pantheios_be_parseStockArgs(), filling out the
  169. * pan_be_COMErrorObject_init_t in accordance with the arguments
  170. * found.
  171. *
  172. * Recognises the following standard argument names:
  173. * - "showProcessId" (Boolean)
  174. * - "showTime" (Boolean)
  175. * - "showSeverity" (Boolean)
  176. * - "useSystemTime" (Boolean)
  177. * - "showDetailsAtStart" (Boolean)
  178. * - "useUnixFormat" (Boolean)
  179. * - "showDate" (Boolean)
  180. * - "showTime" (Boolean)
  181. * - "highResolution" (Boolean)
  182. * - "lowResolution" (Boolean)
  183. *
  184. * Recognises the following back-end specific argument names:
  185. * - "overwriteExisting" (Boolean)
  186. */
  187. PANTHEIOS_CALL(int) pantheios_be_COMErrorObject_parseArgs(
  188. size_t numArgs
  189. #ifdef PANTHEIOS_NO_NAMESPACE
  190. , struct pan_slice_t* const args
  191. #else /* ? PANTHEIOS_NO_NAMESPACE */
  192. , pantheios::pan_slice_t* const args
  193. #endif /* PANTHEIOS_NO_NAMESPACE */
  194. , pan_be_COMErrorObject_init_t* init
  195. );
  196. /* ////////////////////////////////////////////////////////////////////// */
  197. #ifdef __cplusplus
  198. # ifndef PANTHEIOS_BE_INIT_NO_CPP_STRUCT_INIT
  199. inline pan_be_COMErrorObject_init_t::pan_be_COMErrorObject_init_t()
  200. {
  201. pantheios_be_COMErrorObject_getDefaultAppInit(this);
  202. }
  203. # endif /* !PANTHEIOS_BE_INIT_NO_CPP_STRUCT_INIT */
  204. #endif /* __cplusplus */
  205. /* ////////////////////////////////////////////////////////////////////// */
  206. #endif /* PANTHEIOS_INCL_PANTHEIOS_BACKENDS_H_COMERROROBJECT */
  207. /* ///////////////////////////// end of file //////////////////////////// */