+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
* Copyright (C) 2014-2016, International Business Machines
#include "unicode/utypes.h"
#include "unicode/unistr.h"
-#ifndef U_HIDE_DRAFT_API
-
+#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
*
* @see MessageFormat
* @see UMessagePatternApostropheMode
- * @draft ICU 57
+ * @stable ICU 57
*/
class U_COMMON_API SimpleFormatter U_FINAL : public UMemory {
public:
/**
* Default constructor.
- * @draft ICU 57
+ * @stable ICU 57
*/
- SimpleFormatter() : compiledPattern((UChar)0) {}
+ SimpleFormatter() : compiledPattern((char16_t)0) {}
/**
* Constructs a formatter from the pattern string.
* @param errorCode ICU error code in/out parameter.
* Must fulfill U_SUCCESS before the function call.
* Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax.
- * @draft ICU 57
+ * @stable ICU 57
*/
SimpleFormatter(const UnicodeString& pattern, UErrorCode &errorCode) {
applyPattern(pattern, errorCode);
* Must fulfill U_SUCCESS before the function call.
* Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax and
* too few or too many arguments.
- * @draft ICU 57
+ * @stable ICU 57
*/
SimpleFormatter(const UnicodeString& pattern, int32_t min, int32_t max,
UErrorCode &errorCode) {
/**
* Copy constructor.
- * @draft ICU 57
+ * @stable ICU 57
*/
SimpleFormatter(const SimpleFormatter& other)
: compiledPattern(other.compiledPattern) {}
/**
* Assignment operator.
- * @draft ICU 57
+ * @stable ICU 57
*/
SimpleFormatter &operator=(const SimpleFormatter& other);
/**
* Destructor.
- * @draft ICU 57
+ * @stable ICU 57
*/
~SimpleFormatter();
* Must fulfill U_SUCCESS before the function call.
* Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax.
* @return TRUE if U_SUCCESS(errorCode).
- * @draft ICU 57
+ * @stable ICU 57
*/
UBool applyPattern(const UnicodeString &pattern, UErrorCode &errorCode) {
return applyPatternMinMaxArguments(pattern, 0, INT32_MAX, errorCode);
* Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax and
* too few or too many arguments.
* @return TRUE if U_SUCCESS(errorCode).
- * @draft ICU 57
+ * @stable ICU 57
*/
UBool applyPatternMinMaxArguments(const UnicodeString &pattern,
int32_t min, int32_t max, UErrorCode &errorCode);
/**
* @return The max argument number + 1.
- * @draft ICU 57
+ * @stable ICU 57
*/
int32_t getArgumentLimit() const {
return getArgumentLimit(compiledPattern.getBuffer(), compiledPattern.length());
* @param errorCode ICU error code in/out parameter.
* Must fulfill U_SUCCESS before the function call.
* @return appendTo
- * @draft ICU 57
+ * @stable ICU 57
*/
UnicodeString &format(
const UnicodeString &value0,
* @param errorCode ICU error code in/out parameter.
* Must fulfill U_SUCCESS before the function call.
* @return appendTo
- * @draft ICU 57
+ * @stable ICU 57
*/
UnicodeString &format(
const UnicodeString &value0,
* @param errorCode ICU error code in/out parameter.
* Must fulfill U_SUCCESS before the function call.
* @return appendTo
- * @draft ICU 57
+ * @stable ICU 57
*/
UnicodeString &format(
const UnicodeString &value0,
* @param errorCode ICU error code in/out parameter.
* Must fulfill U_SUCCESS before the function call.
* @return appendTo
- * @draft ICU 57
+ * @stable ICU 57
*/
UnicodeString &formatAndAppend(
const UnicodeString *const *values, int32_t valuesLength,
* @param errorCode ICU error code in/out parameter.
* Must fulfill U_SUCCESS before the function call.
* @return result
- * @draft ICU 57
+ * @stable ICU 57
*/
UnicodeString &formatAndReplace(
const UnicodeString *const *values, int32_t valuesLength,
/**
* Returns the pattern text with none of the arguments.
* Like formatting with all-empty string values.
- * @draft ICU 57
+ * @stable ICU 57
*/
UnicodeString getTextWithNoArguments() const {
return getTextWithNoArguments(compiledPattern.getBuffer(), compiledPattern.length());
*/
UnicodeString compiledPattern;
- static inline int32_t getArgumentLimit(const UChar *compiledPattern,
+ static inline int32_t getArgumentLimit(const char16_t *compiledPattern,
int32_t compiledPatternLength) {
return compiledPatternLength == 0 ? 0 : compiledPattern[0];
}
- static UnicodeString getTextWithNoArguments(const UChar *compiledPattern, int32_t compiledPatternLength);
+ static UnicodeString getTextWithNoArguments(const char16_t *compiledPattern, int32_t compiledPatternLength);
static UnicodeString &format(
- const UChar *compiledPattern, int32_t compiledPatternLength,
+ const char16_t *compiledPattern, int32_t compiledPatternLength,
const UnicodeString *const *values,
UnicodeString &result, const UnicodeString *resultCopy, UBool forbidResultAsValue,
int32_t *offsets, int32_t offsetsLength,
};
U_NAMESPACE_END
-
-#endif /* U_HIDE_DRAFT_API */
+#endif // U_SHOW_CPLUSPLUS_API
#endif // __SIMPLEFORMATTER_H__