Team Fortress 2 Source Code as on 22/4/2020
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.

90 lines
2.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. /*
  9. *
  10. * Copyright (c) 1998-9
  11. * Dr John Maddock
  12. *
  13. * Permission to use, copy, modify, distribute and sell this software
  14. * and its documentation for any purpose is hereby granted without fee,
  15. * provided that the above copyright notice appear in all copies and
  16. * that both that copyright notice and this permission notice appear
  17. * in supporting documentation. Dr John Maddock makes no representations
  18. * about the suitability of this software for any purpose.
  19. * It is provided "as is" without express or implied warranty.
  20. *
  21. */
  22. /*
  23. * FILE re_mss.h
  24. * VERSION 2.12
  25. * This is an internal header file, do not include directly.
  26. * Message helper functions, for regular
  27. * expression library.
  28. */
  29. #ifndef RE_MSS_H
  30. #define RE_MSS_H
  31. #ifndef JM_CFG_H
  32. #include <jm/jm_cfg.h>
  33. #endif
  34. JM_NAMESPACE(__JM)
  35. //
  36. // re_get_message
  37. // returns required buffer size if len is zero
  38. // otherwise fills in buf.
  39. //
  40. JM_IX_DECL unsigned int RE_CALL re_get_default_message(char* buf, unsigned int len, unsigned int id);
  41. JM_IX_DECL unsigned int RE_CALL __re_get_message(char* buf, unsigned int len, unsigned int id);
  42. template <class charT>
  43. unsigned int RE_CALL re_get_message(charT* buf, unsigned int len, unsigned int id)
  44. {
  45. unsigned int size = __re_get_message((char*)0, 0, id);
  46. if(len < size)
  47. return size;
  48. auto_array<char> cb(new char[size]);
  49. __re_get_message((char*)cb, size, id);
  50. size = re_strwiden(buf, len, (char*)cb);
  51. return size;
  52. }
  53. inline unsigned int RE_CALL re_get_message(char* buf, unsigned int len, unsigned int id)
  54. {
  55. return __re_get_message(buf, len, id);
  56. }
  57. //
  58. // declare message initialisers:
  59. //
  60. void RE_CALL re_message_init();
  61. void RE_CALL re_message_update();
  62. void RE_CALL re_message_free();
  63. #ifdef RE_LOCALE_CPP
  64. __JM_STD::messages<char>::string_type RE_CALL re_get_def_message(unsigned int i);
  65. __JM_STD::messages<wchar_t>::string_type RE_CALL re_get_def_message_w(unsigned int i);
  66. extern const char *re_default_error_messages[];
  67. #endif
  68. JM_END_NAMESPACE
  69. #endif