messageimpl.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // © 2016 and later: Unicode, Inc. and others.
  2. // License & terms of use: http://www.unicode.org/copyright.html
  3. /*
  4. *******************************************************************************
  5. * Copyright (C) 2011, International Business Machines
  6. * Corporation and others. All Rights Reserved.
  7. *******************************************************************************
  8. * file name: messageimpl.h
  9. * encoding: UTF-8
  10. * tab size: 8 (not used)
  11. * indentation:4
  12. *
  13. * created on: 2011apr04
  14. * created by: Markus W. Scherer
  15. */
  16. #ifndef __MESSAGEIMPL_H__
  17. #define __MESSAGEIMPL_H__
  18. #include "unicode/utypes.h"
  19. #if !UCONFIG_NO_FORMATTING
  20. #include "unicode/messagepattern.h"
  21. U_NAMESPACE_BEGIN
  22. /**
  23. * Helper functions for use of MessagePattern.
  24. * In Java, these are package-private methods in MessagePattern itself.
  25. * In C++, they are declared here and implemented in messagepattern.cpp.
  26. */
  27. class U_COMMON_API MessageImpl {
  28. public:
  29. /**
  30. * @return TRUE if getApostropheMode()==UMSGPAT_APOS_DOUBLE_REQUIRED
  31. */
  32. static UBool jdkAposMode(const MessagePattern &msgPattern) {
  33. return msgPattern.getApostropheMode()==UMSGPAT_APOS_DOUBLE_REQUIRED;
  34. }
  35. /**
  36. * Appends the s[start, limit[ substring to sb, but with only half of the apostrophes
  37. * according to JDK pattern behavior.
  38. */
  39. static void appendReducedApostrophes(const UnicodeString &s, int32_t start, int32_t limit,
  40. UnicodeString &sb);
  41. /**
  42. * Appends the sub-message to the result string.
  43. * Omits SKIP_SYNTAX and appends whole arguments using appendReducedApostrophes().
  44. */
  45. static UnicodeString &appendSubMessageWithoutSkipSyntax(const MessagePattern &msgPattern,
  46. int32_t msgStart,
  47. UnicodeString &result);
  48. private:
  49. MessageImpl(); // no constructor: all static methods
  50. };
  51. U_NAMESPACE_END
  52. #endif // !UCONFIG_NO_FORMATTING
  53. #endif // __MESSAGEIMPL_H__