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