Home | History | Annotate | Download | only in common
      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 
     17 #ifndef __MESSAGEIMPL_H__
     18 #define __MESSAGEIMPL_H__
     19 
     20 #include "unicode/utypes.h"
     21 
     22 #if !UCONFIG_NO_FORMATTING
     23 
     24 #include "unicode/messagepattern.h"
     25 
     26 U_NAMESPACE_BEGIN
     27 
     28 /**
     29  * Helper functions for use of MessagePattern.
     30  * In Java, these are package-private methods in MessagePattern itself.
     31  * In C++, they are declared here and implemented in messagepattern.cpp.
     32  */
     33 class U_COMMON_API MessageImpl {
     34 public:
     35     /**
     36      * @return TRUE if getApostropheMode()==UMSGPAT_APOS_DOUBLE_REQUIRED
     37      */
     38     static UBool jdkAposMode(const MessagePattern &msgPattern) {
     39         return msgPattern.getApostropheMode()==UMSGPAT_APOS_DOUBLE_REQUIRED;
     40     }
     41 
     42     /**
     43      * Appends the s[start, limit[ substring to sb, but with only half of the apostrophes
     44      * according to JDK pattern behavior.
     45      */
     46     static void appendReducedApostrophes(const UnicodeString &s, int32_t start, int32_t limit,
     47                                          UnicodeString &sb);
     48 
     49     /**
     50      * Appends the sub-message to the result string.
     51      * Omits SKIP_SYNTAX and appends whole arguments using appendReducedApostrophes().
     52      */
     53     static UnicodeString &appendSubMessageWithoutSkipSyntax(const MessagePattern &msgPattern,
     54                                                             int32_t msgStart,
     55                                                             UnicodeString &result);
     56 
     57 private:
     58     MessageImpl();  // no constructor: all static methods
     59 };
     60 
     61 U_NAMESPACE_END
     62 
     63 #endif  // !UCONFIG_NO_FORMATTING
     64 
     65 #endif  // __MESSAGEIMPL_H__
     66