ICU 66.1 66.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
28#include "unicode/uloc.h"
29#include "unicode/parseerr.h"
30#include <stdarg.h>
31
178U_STABLE int32_t U_EXPORT2
179u_formatMessage(const char *locale,
180 const UChar *pattern,
181 int32_t patternLength,
182 UChar *result,
183 int32_t resultLength,
184 UErrorCode *status,
185 ...);
186
205U_STABLE int32_t U_EXPORT2
206u_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
230U_STABLE void U_EXPORT2
231u_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
255U_STABLE void U_EXPORT2
256u_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
284U_STABLE int32_t U_EXPORT2
285u_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
313U_STABLE int32_t U_EXPORT2
314u_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
341U_STABLE void U_EXPORT2
342u_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
369U_STABLE void U_EXPORT2
370u_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 --------------------------- */
384typedef void* UMessageFormat;
385
386
399U_STABLE UMessageFormat* U_EXPORT2
400umsg_open( const UChar *pattern,
401 int32_t patternLength,
402 const char *locale,
403 UParseError *parseError,
404 UErrorCode *status);
405
412U_STABLE void U_EXPORT2
414
415#if U_SHOW_CPLUSPLUS_API
416
417U_NAMESPACE_BEGIN
418
429
430U_NAMESPACE_END
431
432#endif
433
442U_STABLE UMessageFormat U_EXPORT2
444 UErrorCode *status);
445
453U_STABLE void U_EXPORT2
455 const char* locale);
456
464U_STABLE const char* U_EXPORT2
466
479U_STABLE void U_EXPORT2
481 const UChar* pattern,
482 int32_t patternLength,
483 UParseError* parseError,
484 UErrorCode* status);
485
497U_STABLE int32_t U_EXPORT2
499 UChar* result,
500 int32_t resultLength,
501 UErrorCode* status);
502
518U_STABLE int32_t U_EXPORT2
520 UChar *result,
521 int32_t resultLength,
522 UErrorCode *status,
523 ...);
524
540U_STABLE int32_t U_EXPORT2
542 UChar *result,
543 int32_t resultLength,
544 va_list ap,
545 UErrorCode *status);
546
561U_STABLE void U_EXPORT2
563 const UChar *source,
564 int32_t sourceLength,
565 int32_t *count,
566 UErrorCode *status,
567 ...);
568
584U_STABLE void U_EXPORT2
586 const UChar *source,
587 int32_t sourceLength,
588 int32_t *count,
589 va_list ap,
590 UErrorCode *status);
591
592
616U_STABLE int32_t U_EXPORT2
618 int32_t patternLength,
619 UChar* dest,
620 int32_t destCapacity,
621 UErrorCode* ec);
622
623#endif /* #if !UCONFIG_NO_FORMATTING */
624
625#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:562
C API: Parse Error Information.
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:58
C API: Locale.
uint16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:378
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:111
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:384
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
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415