// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** * Copyright (C) 2014-2016, International Business Machines * Corporation and others. All Rights Reserved. ****************************************************************************** * simpleformatter.h */ #ifndef __SIMPLEFORMATTER_H__ #define __SIMPLEFORMATTER_H__ /** * \file * \brief C++ API: Simple formatter, minimal subset of MessageFormat. */ #include "unicode/utypes.h" #if U_SHOW_CPLUSPLUS_API #include "unicode/unistr.h" U_NAMESPACE_BEGIN // Forward declaration: namespace number::impl { class SimpleModifier; } /** * Formats simple patterns like "{1} was born in {0}". * Minimal subset of MessageFormat; fast, simple, minimal dependencies. * Supports only numbered arguments with no type nor style parameters, * and formats only string values. * Quoting via ASCII apostrophe compatible with ICU MessageFormat default behavior. * * Factory methods set error codes for syntax errors * and for too few or too many arguments/placeholders. * * SimpleFormatter objects are thread-safe except for assignment and applying new patterns. * * Example: * <pre> * UErrorCode errorCode = U_ZERO_ERROR; * SimpleFormatter fmt("{1} '{born}' in {0}", errorCode); * UnicodeString result; * * // Output: "paul {born} in england" * fmt.format("england", "paul", result, errorCode); * </pre> * * This class is not intended for public subclassing. * * @see MessageFormat * @see UMessagePatternApostropheMode * @stable ICU 57 */ class U_COMMON_API SimpleFormatter final : public UMemory { … }; U_NAMESPACE_END #endif /* U_SHOW_CPLUSPLUS_API */ #endif // __SIMPLEFORMATTER_H__