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