umsg.h
Go to the documentation of this file.
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2011, International Business Machines Corporation and
* others. All Rights Reserved.
* Copyright (C) 2010 , Yahoo! Inc.
********************************************************************
*
* file name: umsg.h
* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
* Change history:
*
* 08/5/2001 Ram Added C wrappers for C++ API.
********************************************************************/
#ifndef UMSG_H
#define UMSG_H
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
#include "unicode/uloc.h"
#include "unicode/parseerr.h"
#include <stdarg.h>
#if U_SHOW_CPLUSPLUS_API
#include "unicode/localpointer.h"
#endif // U_SHOW_CPLUSPLUS_API
U_CAPI int32_t U_EXPORT2
u_formatMessage(const char *locale,
const UChar *pattern,
int32_t patternLength,
UChar *result,
int32_t resultLength,
UErrorCode *status,
...);
U_CAPI int32_t U_EXPORT2
u_vformatMessage( const char *locale,
const UChar *pattern,
int32_t patternLength,
UChar *result,
int32_t resultLength,
va_list ap,
UErrorCode *status);
U_CAPI void U_EXPORT2
u_parseMessage( const char *locale,
const UChar *pattern,
int32_t patternLength,
const UChar *source,
int32_t sourceLength,
UErrorCode *status,
...);
U_CAPI void U_EXPORT2
u_vparseMessage(const char *locale,
const UChar *pattern,
int32_t patternLength,
const UChar *source,
int32_t sourceLength,
va_list ap,
UErrorCode *status);
U_CAPI int32_t U_EXPORT2
u_formatMessageWithError( const char *locale,
const UChar *pattern,
int32_t patternLength,
UChar *result,
int32_t resultLength,
UParseError *parseError,
UErrorCode *status,
...);
U_CAPI int32_t U_EXPORT2
u_vformatMessageWithError( const char *locale,
const UChar *pattern,
int32_t patternLength,
UChar *result,
int32_t resultLength,
UParseError* parseError,
va_list ap,
UErrorCode *status);
U_CAPI void U_EXPORT2
u_parseMessageWithError(const char *locale,
const UChar *pattern,
int32_t patternLength,
const UChar *source,
int32_t sourceLength,
UParseError *parseError,
UErrorCode *status,
...);
U_CAPI void U_EXPORT2
u_vparseMessageWithError(const char *locale,
const UChar *pattern,
int32_t patternLength,
const UChar *source,
int32_t sourceLength,
va_list ap,
UParseError *parseError,
UErrorCode* status);
/*----------------------- New experimental API --------------------------- */
typedef void* UMessageFormat;
U_CAPI UMessageFormat* U_EXPORT2
umsg_open( const UChar *pattern,
int32_t patternLength,
const char *locale,
UParseError *parseError,
UErrorCode *status);
U_CAPI void U_EXPORT2
umsg_close(UMessageFormat* format);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
U_DEFINE_LOCAL_OPEN_POINTER(LocalUMessageFormatPointer, UMessageFormat, umsg_close);
U_NAMESPACE_END
#endif
U_CAPI UMessageFormat U_EXPORT2
umsg_clone(const UMessageFormat *fmt,
UErrorCode *status);
U_CAPI void U_EXPORT2
umsg_setLocale(UMessageFormat *fmt,
const char* locale);
U_CAPI const char* U_EXPORT2
umsg_getLocale(const UMessageFormat *fmt);
U_CAPI void U_EXPORT2
umsg_applyPattern( UMessageFormat *fmt,
const UChar* pattern,
int32_t patternLength,
UParseError* parseError,
UErrorCode* status);
U_CAPI int32_t U_EXPORT2
umsg_toPattern(const UMessageFormat *fmt,
UChar* result,
int32_t resultLength,
UErrorCode* status);
U_CAPI int32_t U_EXPORT2
umsg_format( const UMessageFormat *fmt,
UChar *result,
int32_t resultLength,
UErrorCode *status,
...);
U_CAPI int32_t U_EXPORT2
umsg_vformat( const UMessageFormat *fmt,
UChar *result,
int32_t resultLength,
va_list ap,
UErrorCode *status);
U_CAPI void U_EXPORT2
umsg_parse( const UMessageFormat *fmt,
const UChar *source,
int32_t sourceLength,
int32_t *count,
UErrorCode *status,
...);
U_CAPI void U_EXPORT2
umsg_vparse(const UMessageFormat *fmt,
const UChar *source,
int32_t sourceLength,
int32_t *count,
va_list ap,
UErrorCode *status);
U_CAPI int32_t U_EXPORT2
umsg_autoQuoteApostrophe(const UChar* pattern,
int32_t patternLength,
UChar* dest,
int32_t destCapacity,
UErrorCode* ec);
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif
LocalUMessageFormatPointer
"Smart pointer" class, closes a UMessageFormat via umsg_close().
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
U_DEFINE_LOCAL_OPEN_POINTER
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:550
parseerr.h
C API: Parse Error Information.
UParseError
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:58
uloc.h
C API: Locale ID functionality similar to C++ class Locale.
U_CAPI
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:110
UChar
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:378
umsg_autoQuoteApostrophe
U_CAPI int32_t umsg_autoQuoteApostrophe(const UChar *pattern, int32_t patternLength, UChar *dest, int32_t destCapacity, UErrorCode *ec)
Convert an 'apostrophe-friendly' pattern into a standard pattern.
u_parseMessageWithError
U_CAPI void u_parseMessageWithError(const char *locale, const UChar *pattern, int32_t patternLength, const UChar *source, int32_t sourceLength, UParseError *parseError, UErrorCode *status,...)
Parse a message.
umsg_close
U_CAPI void umsg_close(UMessageFormat *format)
Close a UMessageFormat.
umsg_clone
U_CAPI UMessageFormat umsg_clone(const UMessageFormat *fmt, UErrorCode *status)
Open a copy of a UMessageFormat.
umsg_applyPattern
U_CAPI void umsg_applyPattern(UMessageFormat *fmt, const UChar *pattern, int32_t patternLength, UParseError *parseError, UErrorCode *status)
Sets the pattern.
u_parseMessage
U_CAPI void u_parseMessage(const char *locale, const UChar *pattern, int32_t patternLength, const UChar *source, int32_t sourceLength, UErrorCode *status,...)
Parse a message.
umsg_toPattern
U_CAPI int32_t umsg_toPattern(const UMessageFormat *fmt, UChar *result, int32_t resultLength, UErrorCode *status)
Gets the pattern.
umsg_vformat
U_CAPI int32_t umsg_vformat(const UMessageFormat *fmt, UChar *result, int32_t resultLength, va_list ap, UErrorCode *status)
Format a message for a locale.
umsg_format
U_CAPI int32_t umsg_format(const UMessageFormat *fmt, UChar *result, int32_t resultLength, UErrorCode *status,...)
Format a message for a locale.
umsg_setLocale
U_CAPI void umsg_setLocale(UMessageFormat *fmt, const char *locale)
Sets the locale.
u_vparseMessageWithError
U_CAPI void u_vparseMessageWithError(const char *locale, const UChar *pattern, int32_t patternLength, const UChar *source, int32_t sourceLength, va_list ap, UParseError *parseError, UErrorCode *status)
Parse a message.
u_vformatMessageWithError
U_CAPI int32_t u_vformatMessageWithError(const char *locale, const UChar *pattern, int32_t patternLength, UChar *result, int32_t resultLength, UParseError *parseError, va_list ap, UErrorCode *status)
Format a message for a locale.
u_formatMessageWithError
U_CAPI int32_t u_formatMessageWithError(const char *locale, const UChar *pattern, int32_t patternLength, UChar *result, int32_t resultLength, UParseError *parseError, UErrorCode *status,...)
Format a message for a locale.
umsg_getLocale
U_CAPI const char * umsg_getLocale(const UMessageFormat *fmt)
Gets the locale.
umsg_open
U_CAPI UMessageFormat * umsg_open(const UChar *pattern, int32_t patternLength, const char *locale, UParseError *parseError, UErrorCode *status)
Open a message formatter with given pattern and for the given locale.
u_vformatMessage
U_CAPI int32_t u_vformatMessage(const char *locale, const UChar *pattern, int32_t patternLength, UChar *result, int32_t resultLength, va_list ap, UErrorCode *status)
Format a message for a locale.
umsg_parse
U_CAPI void umsg_parse(const UMessageFormat *fmt, const UChar *source, int32_t sourceLength, int32_t *count, UErrorCode *status,...)
Parse a message.
UMessageFormat
void * UMessageFormat
The message format object.
Definition: umsg.h:387
u_vparseMessage
U_CAPI void u_vparseMessage(const char *locale, const UChar *pattern, int32_t patternLength, const UChar *source, int32_t sourceLength, va_list ap, UErrorCode *status)
Parse a message.
u_formatMessage
U_CAPI int32_t u_formatMessage(const char *locale, const UChar *pattern, int32_t patternLength, UChar *result, int32_t resultLength, UErrorCode *status,...)
Format a message for a locale.
umsg_vparse
U_CAPI void umsg_vparse(const UMessageFormat *fmt, const UChar *source, int32_t sourceLength, int32_t *count, va_list ap, UErrorCode *status)
Parse a message.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415