ICU 59.1  59.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/localpointer.h"
28 #include "unicode/uloc.h"
29 #include "unicode/parseerr.h"
30 #include <stdarg.h>
31 
178 U_STABLE int32_t U_EXPORT2
179 u_formatMessage(const char *locale,
180  const UChar *pattern,
181  int32_t patternLength,
182  UChar *result,
183  int32_t resultLength,
184  UErrorCode *status,
185  ...);
186 
205 U_STABLE int32_t U_EXPORT2
206 u_vformatMessage( const char *locale,
207  const UChar *pattern,
208  int32_t patternLength,
209  UChar *result,
210  int32_t resultLength,
211  va_list ap,
212  UErrorCode *status);
213 
230 U_STABLE void U_EXPORT2
231 u_parseMessage( const char *locale,
232  const UChar *pattern,
233  int32_t patternLength,
234  const UChar *source,
235  int32_t sourceLength,
236  UErrorCode *status,
237  ...);
238 
255 U_STABLE void U_EXPORT2
256 u_vparseMessage(const char *locale,
257  const UChar *pattern,
258  int32_t patternLength,
259  const UChar *source,
260  int32_t sourceLength,
261  va_list ap,
262  UErrorCode *status);
263 
284 U_STABLE int32_t U_EXPORT2
285 u_formatMessageWithError( const char *locale,
286  const UChar *pattern,
287  int32_t patternLength,
288  UChar *result,
289  int32_t resultLength,
290  UParseError *parseError,
291  UErrorCode *status,
292  ...);
293 
313 U_STABLE int32_t U_EXPORT2
314 u_vformatMessageWithError( const char *locale,
315  const UChar *pattern,
316  int32_t patternLength,
317  UChar *result,
318  int32_t resultLength,
319  UParseError* parseError,
320  va_list ap,
321  UErrorCode *status);
322 
341 U_STABLE void U_EXPORT2
342 u_parseMessageWithError(const char *locale,
343  const UChar *pattern,
344  int32_t patternLength,
345  const UChar *source,
346  int32_t sourceLength,
347  UParseError *parseError,
348  UErrorCode *status,
349  ...);
350 
369 U_STABLE void U_EXPORT2
370 u_vparseMessageWithError(const char *locale,
371  const UChar *pattern,
372  int32_t patternLength,
373  const UChar *source,
374  int32_t sourceLength,
375  va_list ap,
376  UParseError *parseError,
377  UErrorCode* status);
378 
379 /*----------------------- New experimental API --------------------------- */
384 typedef void* UMessageFormat;
385 
386 
399 U_STABLE UMessageFormat* U_EXPORT2
400 umsg_open( const UChar *pattern,
401  int32_t patternLength,
402  const char *locale,
403  UParseError *parseError,
404  UErrorCode *status);
405 
412 U_STABLE void U_EXPORT2
413 umsg_close(UMessageFormat* format);
414 
415 #if U_SHOW_CPLUSPLUS_API
416 
418 
429 
431 
432 #endif
433 
442 U_STABLE UMessageFormat U_EXPORT2
443 umsg_clone(const UMessageFormat *fmt,
444  UErrorCode *status);
445 
453 U_STABLE void U_EXPORT2
455  const char* locale);
456 
464 U_STABLE const char* U_EXPORT2
465 umsg_getLocale(const UMessageFormat *fmt);
466 
479 U_STABLE void U_EXPORT2
481  const UChar* pattern,
482  int32_t patternLength,
483  UParseError* parseError,
484  UErrorCode* status);
485 
497 U_STABLE int32_t U_EXPORT2
498 umsg_toPattern(const UMessageFormat *fmt,
499  UChar* result,
500  int32_t resultLength,
501  UErrorCode* status);
502 
518 U_STABLE int32_t U_EXPORT2
519 umsg_format( const UMessageFormat *fmt,
520  UChar *result,
521  int32_t resultLength,
522  UErrorCode *status,
523  ...);
524 
540 U_STABLE int32_t U_EXPORT2
541 umsg_vformat( const UMessageFormat *fmt,
542  UChar *result,
543  int32_t resultLength,
544  va_list ap,
545  UErrorCode *status);
546 
561 U_STABLE void U_EXPORT2
562 umsg_parse( const UMessageFormat *fmt,
563  const UChar *source,
564  int32_t sourceLength,
565  int32_t *count,
566  UErrorCode *status,
567  ...);
568 
584 U_STABLE void U_EXPORT2
585 umsg_vparse(const UMessageFormat *fmt,
586  const UChar *source,
587  int32_t sourceLength,
588  int32_t *count,
589  va_list ap,
590  UErrorCode *status);
591 
592 
616 U_STABLE int32_t U_EXPORT2
617 umsg_autoQuoteApostrophe(const UChar* pattern,
618  int32_t patternLength,
619  UChar* dest,
620  int32_t destCapacity,
621  UErrorCode* ec);
622 
623 #endif /* #if !UCONFIG_NO_FORMATTING */
624 
625 #endif
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.
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.
void umsg_parse(const UMessageFormat *fmt, const UChar *source, int32_t sourceLength, int32_t *count, UErrorCode *status,...)
Parse a message.
int32_t umsg_autoQuoteApostrophe(const UChar *pattern, int32_t patternLength, UChar *dest, int32_t destCapacity, UErrorCode *ec)
Convert an &#39;apostrophe-friendly&#39; pattern into a standard pattern.
const char * umsg_getLocale(const UMessageFormat *fmt)
Gets the locale.
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.
int32_t umsg_vformat(const UMessageFormat *fmt, UChar *result, int32_t resultLength, va_list ap, UErrorCode *status)
Format a message for a locale.
void u_parseMessage(const char *locale, const UChar *pattern, int32_t patternLength, const UChar *source, int32_t sourceLength, UErrorCode *status,...)
Parse a message.
void umsg_close(UMessageFormat *format)
Close a UMessageFormat.
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
void umsg_vparse(const UMessageFormat *fmt, const UChar *source, int32_t sourceLength, int32_t *count, va_list ap, UErrorCode *status)
Parse a message.
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.
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:496
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
void * UMessageFormat
The message format object.
Definition: umsg.h:384
int32_t umsg_toPattern(const UMessageFormat *fmt, UChar *result, int32_t resultLength, UErrorCode *status)
Gets the pattern.
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.
void umsg_setLocale(UMessageFormat *fmt, const char *locale)
Sets the locale.
int32_t umsg_format(const UMessageFormat *fmt, UChar *result, int32_t resultLength, UErrorCode *status,...)
Format a message for a locale.
UMessageFormat umsg_clone(const UMessageFormat *fmt, UErrorCode *status)
Open a copy of a UMessageFormat.
uint16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:349
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
C API: Parse Error Information.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:396
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.
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:58
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.
Basic definitions for ICU, for both C and C++ APIs.
void umsg_applyPattern(UMessageFormat *fmt, const UChar *pattern, int32_t patternLength, UParseError *parseError, UErrorCode *status)
Sets the pattern.
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.
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:111
"Smart pointer" class, closes a UMessageFormat via umsg_close().
C API: Locale.