11cb0ef41Sopenharmony_ci// © 2016 and later: Unicode, Inc. and others.
21cb0ef41Sopenharmony_ci// License & terms of use: http://www.unicode.org/copyright.html
31cb0ef41Sopenharmony_ci/*
41cb0ef41Sopenharmony_ci*******************************************************************************
51cb0ef41Sopenharmony_ci*   Copyright (C) 2011, International Business Machines
61cb0ef41Sopenharmony_ci*   Corporation and others.  All Rights Reserved.
71cb0ef41Sopenharmony_ci*******************************************************************************
81cb0ef41Sopenharmony_ci*   file name:  messageimpl.h
91cb0ef41Sopenharmony_ci*   encoding:   UTF-8
101cb0ef41Sopenharmony_ci*   tab size:   8 (not used)
111cb0ef41Sopenharmony_ci*   indentation:4
121cb0ef41Sopenharmony_ci*
131cb0ef41Sopenharmony_ci*   created on: 2011apr04
141cb0ef41Sopenharmony_ci*   created by: Markus W. Scherer
151cb0ef41Sopenharmony_ci*/
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ci#ifndef __MESSAGEIMPL_H__
181cb0ef41Sopenharmony_ci#define __MESSAGEIMPL_H__
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_ci#include "unicode/utypes.h"
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_ci#if !UCONFIG_NO_FORMATTING
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_ci#include "unicode/messagepattern.h"
251cb0ef41Sopenharmony_ci
261cb0ef41Sopenharmony_ciU_NAMESPACE_BEGIN
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_ci/**
291cb0ef41Sopenharmony_ci * Helper functions for use of MessagePattern.
301cb0ef41Sopenharmony_ci * In Java, these are package-private methods in MessagePattern itself.
311cb0ef41Sopenharmony_ci * In C++, they are declared here and implemented in messagepattern.cpp.
321cb0ef41Sopenharmony_ci */
331cb0ef41Sopenharmony_ciclass U_COMMON_API MessageImpl {
341cb0ef41Sopenharmony_cipublic:
351cb0ef41Sopenharmony_ci    /**
361cb0ef41Sopenharmony_ci     * @return true if getApostropheMode()==UMSGPAT_APOS_DOUBLE_REQUIRED
371cb0ef41Sopenharmony_ci     */
381cb0ef41Sopenharmony_ci    static UBool jdkAposMode(const MessagePattern &msgPattern) {
391cb0ef41Sopenharmony_ci        return msgPattern.getApostropheMode()==UMSGPAT_APOS_DOUBLE_REQUIRED;
401cb0ef41Sopenharmony_ci    }
411cb0ef41Sopenharmony_ci
421cb0ef41Sopenharmony_ci    /**
431cb0ef41Sopenharmony_ci     * Appends the s[start, limit[ substring to sb, but with only half of the apostrophes
441cb0ef41Sopenharmony_ci     * according to JDK pattern behavior.
451cb0ef41Sopenharmony_ci     */
461cb0ef41Sopenharmony_ci    static void appendReducedApostrophes(const UnicodeString &s, int32_t start, int32_t limit,
471cb0ef41Sopenharmony_ci                                         UnicodeString &sb);
481cb0ef41Sopenharmony_ci
491cb0ef41Sopenharmony_ci    /**
501cb0ef41Sopenharmony_ci     * Appends the sub-message to the result string.
511cb0ef41Sopenharmony_ci     * Omits SKIP_SYNTAX and appends whole arguments using appendReducedApostrophes().
521cb0ef41Sopenharmony_ci     */
531cb0ef41Sopenharmony_ci    static UnicodeString &appendSubMessageWithoutSkipSyntax(const MessagePattern &msgPattern,
541cb0ef41Sopenharmony_ci                                                            int32_t msgStart,
551cb0ef41Sopenharmony_ci                                                            UnicodeString &result);
561cb0ef41Sopenharmony_ci
571cb0ef41Sopenharmony_ciprivate:
581cb0ef41Sopenharmony_ci    MessageImpl() = delete;  // no constructor: all static methods
591cb0ef41Sopenharmony_ci};
601cb0ef41Sopenharmony_ci
611cb0ef41Sopenharmony_ciU_NAMESPACE_END
621cb0ef41Sopenharmony_ci
631cb0ef41Sopenharmony_ci#endif  // !UCONFIG_NO_FORMATTING
641cb0ef41Sopenharmony_ci
651cb0ef41Sopenharmony_ci#endif  // __MESSAGEIMPL_H__
66