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.

160 lines
5.2 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: comstl/error/excepinfo_functions.h
  3. *
  4. * Purpose: EXCEPINFO functions.
  5. *
  6. * Created: 11th August 2007
  7. * Updated: 27th April 2010
  8. *
  9. * Home: http://stlsoft.org/
  10. *
  11. * Copyright (c) 2007-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 met:
  16. *
  17. * - Redistributions of source code must retain the above copyright notice, this
  18. * list of conditions and the following disclaimer.
  19. * - Redistributions in binary form must reproduce the above copyright notice,
  20. * this list of conditions and the following disclaimer in the documentation
  21. * and/or other materials provided with the distribution.
  22. * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of
  23. * any contributors may be used to endorse or promote products derived from
  24. * this software without specific prior written permission.
  25. *
  26. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  27. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  30. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  31. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  32. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  33. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  34. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  35. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  36. * POSSIBILITY OF SUCH DAMAGE.
  37. *
  38. * ////////////////////////////////////////////////////////////////////// */
  39. /** \file comstl/error/excepinfo_functions.h
  40. *
  41. * \brief [C, C++] Error info functions
  42. * (\ref group__library__error "Error" Library).
  43. */
  44. #ifndef COMSTL_INCL_COMSTL_ERROR_H_EXCEPINFO_FUNCTIONS
  45. #define COMSTL_INCL_COMSTL_ERROR_H_EXCEPINFO_FUNCTIONS
  46. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  47. # define COMSTL_VER_COMSTL_ERROR_H_EXCEPINFO_FUNCTIONS_MAJOR 1
  48. # define COMSTL_VER_COMSTL_ERROR_H_EXCEPINFO_FUNCTIONS_MINOR 0
  49. # define COMSTL_VER_COMSTL_ERROR_H_EXCEPINFO_FUNCTIONS_REVISION 3
  50. # define COMSTL_VER_COMSTL_ERROR_H_EXCEPINFO_FUNCTIONS_EDIT 4
  51. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  52. /* /////////////////////////////////////////////////////////////////////////
  53. * Includes
  54. */
  55. #ifndef COMSTL_INCL_COMSTL_H_COMSTL
  56. # include <comstl/comstl.h>
  57. #endif /* !COMSTL_INCL_COMSTL_H_COMSTL */
  58. #ifndef COMSTL_INCL_COMSTL_STRING_H_BSTR_FUNCTIONS
  59. # include <comstl/string/BSTR_functions.h>
  60. #endif /* !COMSTL_INCL_COMSTL_STRING_H_BSTR_FUNCTIONS */
  61. /* /////////////////////////////////////////////////////////////////////////
  62. * Namespace
  63. */
  64. #if !defined(_COMSTL_NO_NAMESPACE) && \
  65. !defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  66. # if defined(_STLSOFT_NO_NAMESPACE)
  67. /* There is no stlsoft namespace, so must define ::comstl */
  68. namespace comstl
  69. {
  70. # else
  71. /* Define stlsoft::comstl_project */
  72. namespace stlsoft
  73. {
  74. namespace comstl_project
  75. {
  76. # endif /* _STLSOFT_NO_NAMESPACE */
  77. #endif /* !_COMSTL_NO_NAMESPACE */
  78. /* /////////////////////////////////////////////////////////////////////////
  79. * C functions
  80. */
  81. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  82. STLSOFT_INLINE void comstl_c_EXCEPINFO_free(EXCEPINFO *pxi)
  83. {
  84. /* Precondition tests */
  85. COMSTL_ASSERT(NULL != pxi);
  86. comstl__bstr_destroy(pxi->bstrSource);
  87. pxi->bstrSource = NULL;
  88. comstl__bstr_destroy(pxi->bstrDescription);
  89. pxi->bstrDescription = NULL;
  90. comstl__bstr_destroy(pxi->bstrHelpFile);
  91. pxi->bstrHelpFile = NULL;
  92. }
  93. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  94. /* /////////////////////////////////////////////////////////////////////////
  95. * Namespace
  96. */
  97. #ifdef STLSOFT_DOCUMENTATION_SKIP_SECTION
  98. namespace comstl
  99. {
  100. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  101. /* /////////////////////////////////////////////////////////////////////////
  102. * C++ functions
  103. */
  104. #ifdef __cplusplus
  105. /** \brief Releases the resources associated with the EXCEPINFO instance.
  106. *
  107. * \ingroup group__library__error
  108. */
  109. inline void EXCEPINFO_free(EXCEPINFO* pxi)
  110. {
  111. comstl_c_EXCEPINFO_free(pxi);
  112. }
  113. #endif /* __cplusplus */
  114. /* /////////////////////////////////////////////////////////////////////////
  115. * Unit-testing
  116. */
  117. #ifdef STLSOFT_UNITTEST
  118. # include "./unittest/excepinfo_functions_unittest_.h"
  119. #endif /* STLSOFT_UNITTEST */
  120. /* ////////////////////////////////////////////////////////////////////// */
  121. #ifndef _COMSTL_NO_NAMESPACE
  122. # if defined(_STLSOFT_NO_NAMESPACE) || \
  123. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  124. } /* namespace comstl */
  125. # else
  126. } /* namespace comstl_project */
  127. } /* namespace stlsoft */
  128. # endif /* _STLSOFT_NO_NAMESPACE */
  129. #endif /* !_COMSTL_NO_NAMESPACE */
  130. /* ////////////////////////////////////////////////////////////////////// */
  131. #endif /* !COMSTL_INCL_COMSTL_ERROR_H_EXCEPINFO_FUNCTIONS */
  132. /* ///////////////////////////// end of file //////////////////////////// */