xkbcommon-errors.h.jinja 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * Copyright © 2026 Pierre Le Marre
  3. *
  4. * SPDX-License-Identifier: MIT
  5. *
  6. * Author: Pierre Le Marre <dev@wismill.eu>
  7. */
  8. #ifndef _XKBCOMMON_ERRORS_H_
  9. #define _XKBCOMMON_ERRORS_H_
  10. /* This file is autogenerated; please do not commit directly. */
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. /**
  15. * @file
  16. * @brief Error-handling related features
  17. */
  18. /**
  19. * @defgroup error-api Error handling
  20. * Error-handling related features
  21. *
  22. * @{
  23. */
  24. /**
  25. * @enum xkb_error_code
  26. * Error codes returned by the API.
  27. *
  28. * The numeric values are stable identifiers that are also used in logging.
  29. * See the @ref error-index for the full list of logging codes.
  30. *
  31. * <details>
  32. * <summary>About the numeric values</summary>
  33. *
  34. * Codes are small positive integers assigned *non-sequentially* by design:
  35. * it prevents callers from assuming adjacency implies relatedness.
  36. *
  37. * See [these guidelines] for further details on the methodology.
  38. *
  39. * The value -1 (`::XKB_ERROR_INVALID`) is reserved for pre-1.14
  40. * functions and does not follow the above scheme.
  41. * </details>
  42. *
  43. * @since 1.14.0
  44. *
  45. * [these guidelines]: https://github.com/haskellfoundation/error-message-index/blob/main/tool-developers.md#code-assignment-recommendations
  46. */
  47. enum xkb_error_code {
  48. /**
  49. * An unspecified error occurred.
  50. *
  51. * Reserved for pre-1.14 functions, which signal errors via -1 return
  52. * values documented per-function.
  53. *
  54. * @since 1.14.0
  55. */
  56. XKB_ERROR_INVALID = -1,
  57. /**
  58. * The operation completed successfully.
  59. *
  60. * @since 1.14.0
  61. */
  62. XKB_SUCCESS = 0,
  63. {# The next code are shared with the internal xkb_message_code enum #}
  64. {% for entry in entries %}
  65. /**
  66. * {{ entry.description }}
  67. *
  68. {% if entry.details %}
  69. {# Indent 2 times to avoid trailing space #}
  70. * {{ entry.details | trim | wordwrap(width=73) | indent(width=1, first=False, blank=False) | indent(width=" *", first=False, blank=True) }}
  71. *
  72. {% endif %}
  73. {% if entry.examples %}
  74. * @sa The [detailed entry](@ref {{ entry.message_code }}) in the error index.
  75. *
  76. {% endif %}
  77. * @since {{ entry.added_public }}
  78. */
  79. {{ entry.message_code_constant(visibility) }} = {{ entry.code }},
  80. {% endfor %}
  81. };
  82. /** @} */
  83. #ifdef __cplusplus
  84. } /* extern "C" */
  85. #endif
  86. #endif /* _XKBCOMMON_ERRORS_H_ */