/contrib/ntp/include/isc/msgcat.h

https://bitbucket.org/freebsd/freebsd-head/ · C++ Header · 132 lines · 14 code · 13 blank · 105 comment · 0 complexity · dfe9b448ed36b2068a3175b07e85d976 MD5 · raw file

  1. /*
  2. * Copyright (C) 1999-2001 Internet Software Consortium.
  3. *
  4. * Permission to use, copy, modify, and distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
  9. * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
  10. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
  11. * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
  12. * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
  13. * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  14. * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  15. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. /* $Id: msgcat.h,v 1.8 2001/01/09 21:57:13 bwelling Exp $ */
  18. #ifndef ISC_MSGCAT_H
  19. #define ISC_MSGCAT_H 1
  20. /*****
  21. ***** Module Info
  22. *****/
  23. /*
  24. * ISC Message Catalog
  25. *
  26. * Message catalogs aid internationalization of applications by allowing
  27. * messages to be retrieved from locale-specific files instead of
  28. * hardwiring them into the application. This allows translations of
  29. * messages appropriate to the locale to be supplied without recompiling
  30. * the application.
  31. *
  32. * Notes:
  33. * It's very important that message catalogs work, even if only the
  34. * default_text can be used.
  35. *
  36. * MP:
  37. * The caller must ensure appropriate synchronization of
  38. * isc_msgcat_open() and isc_msgcat_close(). isc_msgcat_get()
  39. * ensures appropriate synchronization.
  40. *
  41. * Reliability:
  42. * No anticipated impact.
  43. *
  44. * Resources:
  45. * <TBS>
  46. *
  47. * Security:
  48. * No anticipated impact.
  49. *
  50. * Standards:
  51. * None.
  52. */
  53. /*****
  54. ***** Imports
  55. *****/
  56. #include <isc/lang.h>
  57. #include <isc/types.h>
  58. ISC_LANG_BEGINDECLS
  59. /*****
  60. ***** Methods
  61. *****/
  62. void
  63. isc_msgcat_open(const char *name, isc_msgcat_t **msgcatp);
  64. /*
  65. * Open a message catalog.
  66. *
  67. * Notes:
  68. *
  69. * If memory cannot be allocated or other failures occur, *msgcatp
  70. * will be set to NULL. If a NULL msgcat is given to isc_msgcat_get(),
  71. * the default_text will be returned, ensuring that some message text
  72. * will be available, no matter what's going wrong.
  73. *
  74. * Requires:
  75. *
  76. * 'name' is a valid string.
  77. *
  78. * msgcatp != NULL && *msgcatp == NULL
  79. */
  80. void
  81. isc_msgcat_close(isc_msgcat_t **msgcatp);
  82. /*
  83. * Close a message catalog.
  84. *
  85. * Notes:
  86. *
  87. * Any string pointers returned by prior calls to isc_msgcat_get() are
  88. * invalid after isc_msgcat_close() has been called and must not be
  89. * used.
  90. *
  91. * Requires:
  92. *
  93. * *msgcatp is a valid message catalog or is NULL.
  94. *
  95. * Ensures:
  96. *
  97. * All resources associated with the message catalog are released.
  98. *
  99. * *msgcatp == NULL
  100. */
  101. const char *
  102. isc_msgcat_get(isc_msgcat_t *msgcat, int set, int message,
  103. const char *default_text);
  104. /*
  105. * Get message 'message' from message set 'set' in 'msgcat'. If it
  106. * is not available, use 'default_text'.
  107. *
  108. * Requires:
  109. *
  110. * 'msgcat' is a valid message catalog or is NULL.
  111. *
  112. * set > 0
  113. *
  114. * message > 0
  115. *
  116. * 'default_text' is a valid string.
  117. */
  118. ISC_LANG_ENDDECLS
  119. #endif /* ISC_MSGCAT_H */