ICU 57.1 57.1
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
26#include "unicode/uloc.h"
27#include "unicode/parseerr.h"
28#include <stdarg.h>
29
157
176U_STABLE int32_t U_EXPORT2
177u_formatMessage(const char *locale,
178 const UChar *pattern,
179 int32_t patternLength,
180 UChar *result,
181 int32_t resultLength,
182 UErrorCode *status,
183 ...);
184
203U_STABLE int32_t U_EXPORT2
204u_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
228U_STABLE void U_EXPORT2
229u_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
253U_STABLE void U_EXPORT2
254u_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
282U_STABLE int32_t U_EXPORT2
283u_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
311U_STABLE int32_t U_EXPORT2
312u_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
339U_STABLE void U_EXPORT2
340u_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
367U_STABLE void U_EXPORT2
368u_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 --------------------------- */
382typedef void* UMessageFormat;
383
384
397U_STABLE UMessageFormat* U_EXPORT2
398umsg_open( const UChar *pattern,
399 int32_t patternLength,
400 const char *locale,
401 UParseError *parseError,
402 UErrorCode *status);
403
410U_STABLE void U_EXPORT2
412
413#if U_SHOW_CPLUSPLUS_API
414
416
427
429
430#endif
431
440U_STABLE UMessageFormat U_EXPORT2
442 UErrorCode *status);
443
451U_STABLE void U_EXPORT2
453 const char* locale);
454
462U_STABLE const char* U_EXPORT2
464
477U_STABLE void U_EXPORT2
479 const UChar* pattern,
480 int32_t patternLength,
481 UParseError* parseError,
482 UErrorCode* status);
483
495U_STABLE int32_t U_EXPORT2
497 UChar* result,
498 int32_t resultLength,
499 UErrorCode* status);
500
516U_STABLE int32_t U_EXPORT2
518 UChar *result,
519 int32_t resultLength,
520 UErrorCode *status,
521 ...);
522
538U_STABLE int32_t U_EXPORT2
540 UChar *result,
541 int32_t resultLength,
542 va_list ap,
543 UErrorCode *status);
544
559U_STABLE void U_EXPORT2
561 const UChar *source,
562 int32_t sourceLength,
563 int32_t *count,
564 UErrorCode *status,
565 ...);
566
582U_STABLE void U_EXPORT2
584 const UChar *source,
585 int32_t sourceLength,
586 int32_t *count,
587 va_list ap,
588 UErrorCode *status);
589
590
614U_STABLE int32_t U_EXPORT2
616 int32_t patternLength,
617 UChar* dest,
618 int32_t destCapacity,
619 UErrorCode* ec);
620
621#endif /* #if !UCONFIG_NO_FORMATTING */
622
623#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.
C API: Parse Error Information.
A UParseError struct is used to returned detailed information about parsing errors.
Definition parseerr.h:56
C API: Locale.
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:312
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition umachine.h:109
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.
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 u_formatMessage(const char *locale, const UChar *pattern, int32_t patternLength, UChar *result, int32_t resultLength, UErrorCode *status,...)
Format a message for a locale.
const char * umsg_getLocale(const UMessageFormat *fmt)
Gets the locale.
void umsg_vparse(const UMessageFormat *fmt, const UChar *source, int32_t sourceLength, int32_t *count, va_list ap, UErrorCode *status)
Parse a message.
void umsg_parse(const UMessageFormat *fmt, const UChar *source, int32_t sourceLength, int32_t *count, 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.
void umsg_close(UMessageFormat *format)
Close a UMessageFormat.
void umsg_setLocale(UMessageFormat *fmt, const char *locale)
Sets the locale.
UMessageFormat umsg_clone(const UMessageFormat *fmt, UErrorCode *status)
Open a copy of a UMessageFormat.
int32_t umsg_format(const UMessageFormat *fmt, UChar *result, int32_t resultLength, 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.
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.
void * UMessageFormat
The message format object.
Definition umsg.h:382
void umsg_applyPattern(UMessageFormat *fmt, const UChar *pattern, int32_t patternLength, UParseError *parseError, UErrorCode *status)
Sets the pattern.
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_parseMessageWithError(const char *locale, const UChar *pattern, int32_t patternLength, const UChar *source, int32_t sourceLength, UParseError *parseError, UErrorCode *status,...)
Parse a message.
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.
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.
int32_t umsg_toPattern(const UMessageFormat *fmt, UChar *result, int32_t resultLength, UErrorCode *status)
Gets the pattern.
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.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition utypes.h:476
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition uversion.h:130
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition uversion.h:129