ICU 50.1.2  50.1.2
umsg.h
Go to the documentation of this file.
1 /********************************************************************
2  * COPYRIGHT:
3  * Copyright (c) 1997-2011, International Business Machines Corporation and
4  * others. All Rights Reserved.
5  * Copyright (C) 2010 , Yahoo! Inc.
6  ********************************************************************
7  *
8  * file name: umsg.h
9  * encoding: US-ASCII
10  * tab size: 8 (not used)
11  * indentation:4
12  *
13  * Change history:
14  *
15  * 08/5/2001 Ram Added C wrappers for C++ API.
16  ********************************************************************/
17 
18 #ifndef UMSG_H
19 #define UMSG_H
20 
21 #include "unicode/utypes.h"
22 
23 #if !UCONFIG_NO_FORMATTING
24 
25 #include "unicode/localpointer.h"
26 #include "unicode/uloc.h"
27 #include "unicode/parseerr.h"
28 #include <stdarg.h>
29 
176 U_STABLE int32_t U_EXPORT2
177 u_formatMessage(const char *locale,
178  const UChar *pattern,
179  int32_t patternLength,
180  UChar *result,
181  int32_t resultLength,
182  UErrorCode *status,
183  ...);
184 
203 U_STABLE int32_t U_EXPORT2
204 u_vformatMessage( const char *locale,
205  const UChar *pattern,
206  int32_t patternLength,
207  UChar *result,
208  int32_t resultLength,
209  va_list ap,
210  UErrorCode *status);
211 
228 U_STABLE void U_EXPORT2
229 u_parseMessage( const char *locale,
230  const UChar *pattern,
231  int32_t patternLength,
232  const UChar *source,
233  int32_t sourceLength,
234  UErrorCode *status,
235  ...);
236 
253 U_STABLE void U_EXPORT2
254 u_vparseMessage(const char *locale,
255  const UChar *pattern,
256  int32_t patternLength,
257  const UChar *source,
258  int32_t sourceLength,
259  va_list ap,
260  UErrorCode *status);
261 
282 U_STABLE int32_t U_EXPORT2
283 u_formatMessageWithError( const char *locale,
284  const UChar *pattern,
285  int32_t patternLength,
286  UChar *result,
287  int32_t resultLength,
288  UParseError *parseError,
289  UErrorCode *status,
290  ...);
291 
311 U_STABLE int32_t U_EXPORT2
312 u_vformatMessageWithError( const char *locale,
313  const UChar *pattern,
314  int32_t patternLength,
315  UChar *result,
316  int32_t resultLength,
317  UParseError* parseError,
318  va_list ap,
319  UErrorCode *status);
320 
339 U_STABLE void U_EXPORT2
340 u_parseMessageWithError(const char *locale,
341  const UChar *pattern,
342  int32_t patternLength,
343  const UChar *source,
344  int32_t sourceLength,
345  UParseError *parseError,
346  UErrorCode *status,
347  ...);
348 
367 U_STABLE void U_EXPORT2
368 u_vparseMessageWithError(const char *locale,
369  const UChar *pattern,
370  int32_t patternLength,
371  const UChar *source,
372  int32_t sourceLength,
373  va_list ap,
374  UParseError *parseError,
375  UErrorCode* status);
376 
377 /*----------------------- New experimental API --------------------------- */
382 typedef void* UMessageFormat;
383 
384 
397 U_STABLE UMessageFormat* U_EXPORT2
398 umsg_open( const UChar *pattern,
399  int32_t patternLength,
400  const char *locale,
401  UParseError *parseError,
402  UErrorCode *status);
403 
410 U_STABLE void U_EXPORT2
411 umsg_close(UMessageFormat* format);
412 
413 #if U_SHOW_CPLUSPLUS_API
414 
416 
427 
429 
430 #endif
431 
440 U_STABLE UMessageFormat U_EXPORT2
441 umsg_clone(const UMessageFormat *fmt,
442  UErrorCode *status);
443 
451 U_STABLE void U_EXPORT2
453  const char* locale);
454 
462 U_STABLE const char* U_EXPORT2
463 umsg_getLocale(const UMessageFormat *fmt);
464 
477 U_STABLE void U_EXPORT2
479  const UChar* pattern,
480  int32_t patternLength,
481  UParseError* parseError,
482  UErrorCode* status);
483 
495 U_STABLE int32_t U_EXPORT2
496 umsg_toPattern(const UMessageFormat *fmt,
497  UChar* result,
498  int32_t resultLength,
499  UErrorCode* status);
500 
516 U_STABLE int32_t U_EXPORT2
517 umsg_format( const UMessageFormat *fmt,
518  UChar *result,
519  int32_t resultLength,
520  UErrorCode *status,
521  ...);
522 
538 U_STABLE int32_t U_EXPORT2
539 umsg_vformat( const UMessageFormat *fmt,
540  UChar *result,
541  int32_t resultLength,
542  va_list ap,
543  UErrorCode *status);
544 
559 U_STABLE void U_EXPORT2
560 umsg_parse( const UMessageFormat *fmt,
561  const UChar *source,
562  int32_t sourceLength,
563  int32_t *count,
564  UErrorCode *status,
565  ...);
566 
582 U_STABLE void U_EXPORT2
583 umsg_vparse(const UMessageFormat *fmt,
584  const UChar *source,
585  int32_t sourceLength,
586  int32_t *count,
587  va_list ap,
588  UErrorCode *status);
589 
590 
614 U_STABLE int32_t U_EXPORT2
615 umsg_autoQuoteApostrophe(const UChar* pattern,
616  int32_t patternLength,
617  UChar* dest,
618  int32_t destCapacity,
619  UErrorCode* ec);
620 
621 #endif /* #if !UCONFIG_NO_FORMATTING */
622 
623 #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:129
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)
&quot;Smart pointer&quot; definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:290
C++ API: &quot;Smart pointers&quot; for use with and in ICU4C C++ code.
void * UMessageFormat
The message format object.
Definition: umsg.h:382
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
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
Definition: umachine.h:278
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
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:476
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:56
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:109
&quot;Smart pointer&quot; class, closes a UMessageFormat via umsg_close().
C API: Locale.