ICU 70.1  70.1
umsg.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /********************************************************************
4  * COPYRIGHT:
5  * Copyright (c) 1997-2011, International Business Machines Corporation and
6  * others. All Rights Reserved.
7  * Copyright (C) 2010 , Yahoo! Inc.
8  ********************************************************************
9  *
10  * file name: umsg.h
11  * encoding: UTF-8
12  * tab size: 8 (not used)
13  * indentation:4
14  *
15  * Change history:
16  *
17  * 08/5/2001 Ram Added C wrappers for C++ API.
18  ********************************************************************/
19 
20 #ifndef UMSG_H
21 #define UMSG_H
22 
23 #include "unicode/utypes.h"
24 
25 #if !UCONFIG_NO_FORMATTING
26 
27 #include "unicode/uloc.h"
28 #include "unicode/parseerr.h"
29 #include <stdarg.h>
30 
31 #if U_SHOW_CPLUSPLUS_API
32 #include "unicode/localpointer.h"
33 #endif // U_SHOW_CPLUSPLUS_API
34 
181 U_CAPI int32_t U_EXPORT2
182 u_formatMessage(const char *locale,
183  const UChar *pattern,
184  int32_t patternLength,
185  UChar *result,
186  int32_t resultLength,
187  UErrorCode *status,
188  ...);
189 
208 U_CAPI int32_t U_EXPORT2
209 u_vformatMessage( const char *locale,
210  const UChar *pattern,
211  int32_t patternLength,
212  UChar *result,
213  int32_t resultLength,
214  va_list ap,
215  UErrorCode *status);
216 
233 U_CAPI void U_EXPORT2
234 u_parseMessage( const char *locale,
235  const UChar *pattern,
236  int32_t patternLength,
237  const UChar *source,
238  int32_t sourceLength,
239  UErrorCode *status,
240  ...);
241 
258 U_CAPI void U_EXPORT2
259 u_vparseMessage(const char *locale,
260  const UChar *pattern,
261  int32_t patternLength,
262  const UChar *source,
263  int32_t sourceLength,
264  va_list ap,
265  UErrorCode *status);
266 
287 U_CAPI int32_t U_EXPORT2
288 u_formatMessageWithError( const char *locale,
289  const UChar *pattern,
290  int32_t patternLength,
291  UChar *result,
292  int32_t resultLength,
293  UParseError *parseError,
294  UErrorCode *status,
295  ...);
296 
316 U_CAPI int32_t U_EXPORT2
317 u_vformatMessageWithError( const char *locale,
318  const UChar *pattern,
319  int32_t patternLength,
320  UChar *result,
321  int32_t resultLength,
322  UParseError* parseError,
323  va_list ap,
324  UErrorCode *status);
325 
344 U_CAPI void U_EXPORT2
345 u_parseMessageWithError(const char *locale,
346  const UChar *pattern,
347  int32_t patternLength,
348  const UChar *source,
349  int32_t sourceLength,
350  UParseError *parseError,
351  UErrorCode *status,
352  ...);
353 
372 U_CAPI void U_EXPORT2
373 u_vparseMessageWithError(const char *locale,
374  const UChar *pattern,
375  int32_t patternLength,
376  const UChar *source,
377  int32_t sourceLength,
378  va_list ap,
379  UParseError *parseError,
380  UErrorCode* status);
381 
382 /*----------------------- New experimental API --------------------------- */
387 typedef void* UMessageFormat;
388 
389 
402 U_CAPI UMessageFormat* U_EXPORT2
403 umsg_open( const UChar *pattern,
404  int32_t patternLength,
405  const char *locale,
406  UParseError *parseError,
407  UErrorCode *status);
408 
415 U_CAPI void U_EXPORT2
417 
418 #if U_SHOW_CPLUSPLUS_API
419 
420 U_NAMESPACE_BEGIN
421 
432 
433 U_NAMESPACE_END
434 
435 #endif
436 
445 U_CAPI UMessageFormat U_EXPORT2
447  UErrorCode *status);
448 
456 U_CAPI void U_EXPORT2
458  const char* locale);
459 
467 U_CAPI const char* U_EXPORT2
469 
482 U_CAPI void U_EXPORT2
484  const UChar* pattern,
485  int32_t patternLength,
486  UParseError* parseError,
487  UErrorCode* status);
488 
500 U_CAPI int32_t U_EXPORT2
502  UChar* result,
503  int32_t resultLength,
504  UErrorCode* status);
505 
521 U_CAPI int32_t U_EXPORT2
523  UChar *result,
524  int32_t resultLength,
525  UErrorCode *status,
526  ...);
527 
543 U_CAPI int32_t U_EXPORT2
545  UChar *result,
546  int32_t resultLength,
547  va_list ap,
548  UErrorCode *status);
549 
564 U_CAPI void U_EXPORT2
566  const UChar *source,
567  int32_t sourceLength,
568  int32_t *count,
569  UErrorCode *status,
570  ...);
571 
587 U_CAPI void U_EXPORT2
589  const UChar *source,
590  int32_t sourceLength,
591  int32_t *count,
592  va_list ap,
593  UErrorCode *status);
594 
595 
619 U_CAPI int32_t U_EXPORT2
621  int32_t patternLength,
622  UChar* dest,
623  int32_t destCapacity,
624  UErrorCode* ec);
625 
626 #endif /* #if !UCONFIG_NO_FORMATTING */
627 
628 #endif
"Smart pointer" class, closes a UMessageFormat via umsg_close().
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:550
C API: Parse Error Information.
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:58
C API: Locale.
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:110
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:418
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_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.
U_CAPI void umsg_close(UMessageFormat *format)
Close a UMessageFormat.
U_CAPI UMessageFormat umsg_clone(const UMessageFormat *fmt, UErrorCode *status)
Open a copy of a UMessageFormat.
U_CAPI void umsg_applyPattern(UMessageFormat *fmt, const UChar *pattern, int32_t patternLength, UParseError *parseError, UErrorCode *status)
Sets the pattern.
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.
U_CAPI int32_t umsg_toPattern(const UMessageFormat *fmt, UChar *result, int32_t resultLength, UErrorCode *status)
Gets the pattern.
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.
U_CAPI int32_t umsg_format(const UMessageFormat *fmt, UChar *result, int32_t resultLength, UErrorCode *status,...)
Format a message for a locale.
U_CAPI void umsg_setLocale(UMessageFormat *fmt, const char *locale)
Sets the locale.
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_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_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.
U_CAPI const char * umsg_getLocale(const UMessageFormat *fmt)
Gets the locale.
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_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.
U_CAPI void umsg_parse(const UMessageFormat *fmt, const UChar *source, int32_t sourceLength, int32_t *count, UErrorCode *status,...)
Parse a message.
void * UMessageFormat
The message format object.
Definition: umsg.h:387
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_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.
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.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415