Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:13:12

0001 // © 2016 and later: Unicode, Inc. and others.
0002 // License & terms of use: http://www.unicode.org/copyright.html
0003 /********************************************************************
0004  * COPYRIGHT: 
0005  * Copyright (c) 1997-2011, International Business Machines Corporation and
0006  * others. All Rights Reserved.
0007  * Copyright (C) 2010 , Yahoo! Inc. 
0008  ********************************************************************
0009  *
0010  *   file name:  umsg.h
0011  *   encoding:   UTF-8
0012  *   tab size:   8 (not used)
0013  *   indentation:4
0014  *
0015  *   Change history:
0016  *
0017  *   08/5/2001  Ram         Added C wrappers for C++ API.
0018  ********************************************************************/
0019 
0020 #ifndef UMSG_H
0021 #define UMSG_H
0022 
0023 #include "unicode/utypes.h"
0024 
0025 #if !UCONFIG_NO_FORMATTING
0026 
0027 #include "unicode/uloc.h"
0028 #include "unicode/parseerr.h"
0029 #include <stdarg.h>
0030 
0031 #if U_SHOW_CPLUSPLUS_API
0032 #include "unicode/localpointer.h"
0033 #endif   // U_SHOW_CPLUSPLUS_API
0034 
0035 /**
0036  * \file
0037  * \brief C API: MessageFormat
0038  *
0039  * <h2>MessageFormat C API </h2>
0040  *
0041  * <p>MessageFormat prepares strings for display to users,
0042  * with optional arguments (variables/placeholders).
0043  * The arguments can occur in any order, which is necessary for translation
0044  * into languages with different grammars.
0045  *
0046  * <p>The opaque UMessageFormat type is a thin C wrapper around
0047  * a C++ MessageFormat. It is constructed from a <em>pattern</em> string
0048  * with arguments in {curly braces} which will be replaced by formatted values.
0049  *
0050  * <p>Currently, the C API supports only numbered arguments.
0051  *
0052  * <p>For details about the pattern syntax and behavior,
0053  * especially about the ASCII apostrophe vs. the
0054  * real apostrophe (single quote) character \htmlonly&#x2019;\endhtmlonly (U+2019),
0055  * see the C++ MessageFormat class documentation.
0056  *
0057  * <p>Here are some examples of C API usage:
0058  * Example 1:
0059  * <pre>
0060  * \code
0061  *     UChar *result, *tzID, *str;
0062  *     UChar pattern[100];
0063  *     int32_t resultLengthOut, resultlength;
0064  *     UCalendar *cal;
0065  *     UDate d1;
0066  *     UDateFormat *def1;
0067  *     UErrorCode status = U_ZERO_ERROR;
0068  *
0069  *     str=(UChar*)malloc(sizeof(UChar) * (strlen("disturbance in force") +1));
0070  *     u_uastrcpy(str, "disturbance in force");
0071  *     tzID=(UChar*)malloc(sizeof(UChar) * 4);
0072  *     u_uastrcpy(tzID, "PST");
0073  *     cal=ucal_open(tzID, u_strlen(tzID), "en_US", UCAL_TRADITIONAL, &status);
0074  *     ucal_setDateTime(cal, 1999, UCAL_MARCH, 18, 0, 0, 0, &status);
0075  *     d1=ucal_getMillis(cal, &status);
0076  *     u_uastrcpy(pattern, "On {0, date, long}, there was a {1} on planet {2,number,integer}");
0077  *     resultlength=0;
0078  *     resultLengthOut=u_formatMessage( "en_US", pattern, u_strlen(pattern), NULL, resultlength, &status, d1, str, 7);
0079  *     if(status==U_BUFFER_OVERFLOW_ERROR){
0080  *         status=U_ZERO_ERROR;
0081  *         resultlength=resultLengthOut+1;
0082  *         result=(UChar*)realloc(result, sizeof(UChar) * resultlength);
0083  *         u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, d1, str, 7);
0084  *     }
0085  *     printf("%s\n", austrdup(result) );//austrdup( a function used to convert UChar* to char*)
0086  *     //output>: "On March 18, 1999, there was a disturbance in force on planet 7
0087  * \endcode
0088  * </pre>
0089  * Typically, the message format will come from resources, and the
0090  * arguments will be dynamically set at runtime.
0091  * <P>
0092  * Example 2:
0093  * <pre>
0094  * \code
0095  *     UChar* str;
0096  *     UErrorCode status = U_ZERO_ERROR;
0097  *     UChar *result;
0098  *     UChar pattern[100];
0099  *     int32_t resultlength, resultLengthOut, i;
0100  *     double testArgs= { 100.0, 1.0, 0.0};
0101  *
0102  *     str=(UChar*)malloc(sizeof(UChar) * 10);
0103  *     u_uastrcpy(str, "MyDisk");
0104  *     u_uastrcpy(pattern, "The disk {1} contains {0,choice,0#no files|1#one file|1<{0,number,integer} files}");
0105  *     for(i=0; i<3; i++){
0106  *       resultlength=0; 
0107  *       resultLengthOut=u_formatMessage( "en_US", pattern, u_strlen(pattern), NULL, resultlength, &status, testArgs[i], str); 
0108  *       if(status==U_BUFFER_OVERFLOW_ERROR){
0109  *         status=U_ZERO_ERROR;
0110  *         resultlength=resultLengthOut+1;
0111  *         result=(UChar*)malloc(sizeof(UChar) * resultlength);
0112  *         u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, testArgs[i], str);
0113  *       }
0114  *       printf("%s\n", austrdup(result) );  //austrdup( a function used to convert UChar* to char*)
0115  *       free(result);
0116  *     }
0117  *     // output, with different testArgs:
0118  *     // output: The disk "MyDisk" contains 100 files.
0119  *     // output: The disk "MyDisk" contains one file.
0120  *     // output: The disk "MyDisk" contains no files.
0121  * \endcode
0122  *  </pre>
0123  *
0124  *
0125  * Example 3:
0126  * <pre>
0127  * \code
0128  * UChar* str;
0129  * UChar* str1;
0130  * UErrorCode status = U_ZERO_ERROR;
0131  * UChar *result;
0132  * UChar pattern[100];
0133  * UChar expected[100];
0134  * int32_t resultlength,resultLengthOut;
0135 
0136  * str=(UChar*)malloc(sizeof(UChar) * 25);
0137  * u_uastrcpy(str, "Kirti");
0138  * str1=(UChar*)malloc(sizeof(UChar) * 25);
0139  * u_uastrcpy(str1, "female");
0140  * log_verbose("Testing message format with Select test #1\n:");
0141  * u_uastrcpy(pattern, "{0} est {1, select, female {all\\u00E9e} other {all\\u00E9}} \\u00E0 Paris.");
0142  * u_uastrcpy(expected, "Kirti est all\\u00E9e \\u00E0 Paris.");
0143  * resultlength=0;
0144  * resultLengthOut=u_formatMessage( "fr", pattern, u_strlen(pattern), NULL, resultlength, &status, str , str1);
0145  * if(status==U_BUFFER_OVERFLOW_ERROR)
0146  *  {
0147  *      status=U_ZERO_ERROR;
0148  *      resultlength=resultLengthOut+1;
0149  *      result=(UChar*)malloc(sizeof(UChar) * resultlength);
0150  *      u_formatMessage( "fr", pattern, u_strlen(pattern), result, resultlength, &status, str , str1);
0151  *      if(u_strcmp(result, expected)==0)
0152  *          log_verbose("PASS: MessagFormat successful on Select test#1\n");
0153  *      else{
0154  *          log_err("FAIL: Error in MessageFormat on Select test#1\n GOT %s EXPECTED %s\n", austrdup(result),
0155  *          austrdup(expected) );
0156  *      }
0157  *      free(result);
0158  * }
0159  * \endcode
0160  *  </pre>
0161  */
0162 
0163 /**
0164  * Format a message for a locale.
0165  * This function may perform re-ordering of the arguments depending on the
0166  * locale. For all numeric arguments, double is assumed unless the type is
0167  * explicitly integer.  All choice format arguments must be of type double.
0168  * @param locale The locale for which the message will be formatted
0169  * @param pattern The pattern specifying the message's format
0170  * @param patternLength The length of pattern
0171  * @param result A pointer to a buffer to receive the formatted message.
0172  * @param resultLength The maximum size of result.
0173  * @param status A pointer to an UErrorCode to receive any errors
0174  * @param ... A variable-length argument list containing the arguments specified
0175  * in pattern.
0176  * @return The total buffer size needed; if greater than resultLength, the
0177  * output was truncated.
0178  * @see u_parseMessage
0179  * @stable ICU 2.0
0180  */
0181 U_CAPI int32_t U_EXPORT2 
0182 u_formatMessage(const char  *locale,
0183                  const UChar *pattern,
0184                 int32_t     patternLength,
0185                 UChar       *result,
0186                 int32_t     resultLength,
0187                 UErrorCode  *status,
0188                 ...);
0189 
0190 /**
0191  * Format a message for a locale.
0192  * This function may perform re-ordering of the arguments depending on the
0193  * locale. For all numeric arguments, double is assumed unless the type is
0194  * explicitly integer.  All choice format arguments must be of type double.
0195  * @param locale The locale for which the message will be formatted
0196  * @param pattern The pattern specifying the message's format
0197  * @param patternLength The length of pattern
0198  * @param result A pointer to a buffer to receive the formatted message.
0199  * @param resultLength The maximum size of result.
0200  * @param ap A variable-length argument list containing the arguments specified
0201  * @param status A pointer to an UErrorCode to receive any errors
0202  * in pattern.
0203  * @return The total buffer size needed; if greater than resultLength, the
0204  * output was truncated.
0205  * @see u_parseMessage
0206  * @stable ICU 2.0
0207  */
0208 U_CAPI int32_t U_EXPORT2 
0209 u_vformatMessage(   const char  *locale,
0210                     const UChar *pattern,
0211                     int32_t     patternLength,
0212                     UChar       *result,
0213                     int32_t     resultLength,
0214                     va_list     ap,
0215                     UErrorCode  *status);
0216 
0217 /**
0218  * Parse a message.
0219  * For numeric arguments, this function will always use doubles.  Integer types
0220  * should not be passed.
0221  * This function is not able to parse all output from {@link #u_formatMessage }.
0222  * @param locale The locale for which the message is formatted
0223  * @param pattern The pattern specifying the message's format
0224  * @param patternLength The length of pattern
0225  * @param source The text to parse.
0226  * @param sourceLength The length of source, or -1 if null-terminated.
0227  * @param status A pointer to an UErrorCode to receive any errors
0228  * @param ... A variable-length argument list containing the arguments
0229  * specified in pattern.
0230  * @see u_formatMessage
0231  * @stable ICU 2.0
0232  */
0233 U_CAPI void U_EXPORT2 
0234 u_parseMessage( const char   *locale,
0235                 const UChar  *pattern,
0236                 int32_t      patternLength,
0237                 const UChar  *source,
0238                 int32_t      sourceLength,
0239                 UErrorCode   *status,
0240                 ...);
0241 
0242 /**
0243  * Parse a message.
0244  * For numeric arguments, this function will always use doubles.  Integer types
0245  * should not be passed.
0246  * This function is not able to parse all output from {@link #u_formatMessage }.
0247  * @param locale The locale for which the message is formatted
0248  * @param pattern The pattern specifying the message's format
0249  * @param patternLength The length of pattern
0250  * @param source The text to parse.
0251  * @param sourceLength The length of source, or -1 if null-terminated.
0252  * @param ap A variable-length argument list containing the arguments
0253  * @param status A pointer to an UErrorCode to receive any errors
0254  * specified in pattern.
0255  * @see u_formatMessage
0256  * @stable ICU 2.0
0257  */
0258 U_CAPI void U_EXPORT2 
0259 u_vparseMessage(const char  *locale,
0260                 const UChar *pattern,
0261                 int32_t     patternLength,
0262                 const UChar *source,
0263                 int32_t     sourceLength,
0264                 va_list     ap,
0265                 UErrorCode  *status);
0266 
0267 /**
0268  * Format a message for a locale.
0269  * This function may perform re-ordering of the arguments depending on the
0270  * locale. For all numeric arguments, double is assumed unless the type is
0271  * explicitly integer.  All choice format arguments must be of type double.
0272  * @param locale The locale for which the message will be formatted
0273  * @param pattern The pattern specifying the message's format
0274  * @param patternLength The length of pattern
0275  * @param result A pointer to a buffer to receive the formatted message.
0276  * @param resultLength The maximum size of result.
0277  * @param status A pointer to an UErrorCode to receive any errors
0278  * @param ... A variable-length argument list containing the arguments specified
0279  * in pattern.
0280  * @param parseError  A pointer to UParseError to receive information about errors
0281  *                     occurred during parsing.
0282  * @return The total buffer size needed; if greater than resultLength, the
0283  * output was truncated.
0284  * @see u_parseMessage
0285  * @stable ICU 2.0
0286  */
0287 U_CAPI int32_t U_EXPORT2 
0288 u_formatMessageWithError(   const char    *locale,
0289                             const UChar   *pattern,
0290                             int32_t       patternLength,
0291                             UChar         *result,
0292                             int32_t       resultLength,
0293                             UParseError   *parseError,
0294                             UErrorCode    *status,
0295                             ...);
0296 
0297 /**
0298  * Format a message for a locale.
0299  * This function may perform re-ordering of the arguments depending on the
0300  * locale. For all numeric arguments, double is assumed unless the type is
0301  * explicitly integer.  All choice format arguments must be of type double.
0302  * @param locale The locale for which the message will be formatted
0303  * @param pattern The pattern specifying the message's format
0304  * @param patternLength The length of pattern
0305  * @param result A pointer to a buffer to receive the formatted message.
0306  * @param resultLength The maximum size of result.
0307  * @param parseError  A pointer to UParseError to receive information about errors
0308  *                    occurred during parsing.
0309  * @param ap A variable-length argument list containing the arguments specified
0310  * @param status A pointer to an UErrorCode to receive any errors
0311  * in pattern.
0312  * @return The total buffer size needed; if greater than resultLength, the
0313  * output was truncated.
0314  * @stable ICU 2.0
0315  */
0316 U_CAPI int32_t U_EXPORT2 
0317 u_vformatMessageWithError(  const char   *locale,
0318                             const UChar  *pattern,
0319                             int32_t      patternLength,
0320                             UChar        *result,
0321                             int32_t      resultLength,
0322                             UParseError* parseError,
0323                             va_list      ap,
0324                             UErrorCode   *status);
0325 
0326 /**
0327  * Parse a message.
0328  * For numeric arguments, this function will always use doubles.  Integer types
0329  * should not be passed.
0330  * This function is not able to parse all output from {@link #u_formatMessage }.
0331  * @param locale The locale for which the message is formatted
0332  * @param pattern The pattern specifying the message's format
0333  * @param patternLength The length of pattern
0334  * @param source The text to parse.
0335  * @param sourceLength The length of source, or -1 if null-terminated.
0336  * @param parseError  A pointer to UParseError to receive information about errors
0337  *                     occurred during parsing.
0338  * @param status A pointer to an UErrorCode to receive any errors
0339  * @param ... A variable-length argument list containing the arguments
0340  * specified in pattern.
0341  * @see u_formatMessage
0342  * @stable ICU 2.0
0343  */
0344 U_CAPI void U_EXPORT2 
0345 u_parseMessageWithError(const char  *locale,
0346                         const UChar *pattern,
0347                         int32_t     patternLength,
0348                         const UChar *source,
0349                         int32_t     sourceLength,
0350                         UParseError *parseError,
0351                         UErrorCode  *status,
0352                         ...);
0353 
0354 /**
0355  * Parse a message.
0356  * For numeric arguments, this function will always use doubles.  Integer types
0357  * should not be passed.
0358  * This function is not able to parse all output from {@link #u_formatMessage }.
0359  * @param locale The locale for which the message is formatted
0360  * @param pattern The pattern specifying the message's format
0361  * @param patternLength The length of pattern
0362  * @param source The text to parse.
0363  * @param sourceLength The length of source, or -1 if null-terminated.
0364  * @param ap A variable-length argument list containing the arguments
0365  * @param parseError  A pointer to UParseError to receive information about errors
0366  *                     occurred during parsing.
0367  * @param status A pointer to an UErrorCode to receive any errors
0368  * specified in pattern.
0369  * @see u_formatMessage
0370  * @stable ICU 2.0
0371  */
0372 U_CAPI void U_EXPORT2 
0373 u_vparseMessageWithError(const char  *locale,
0374                          const UChar *pattern,
0375                          int32_t     patternLength,
0376                          const UChar *source,
0377                          int32_t     sourceLength,
0378                          va_list     ap,
0379                          UParseError *parseError,
0380                          UErrorCode* status);
0381 
0382 /*----------------------- New experimental API --------------------------- */
0383 /** 
0384  * The message format object
0385  * @stable ICU 2.0
0386  */
0387 typedef void* UMessageFormat;
0388 
0389 
0390 /**
0391  * Open a message formatter with given pattern and for the given locale.
0392  * @param pattern       A pattern specifying the format to use.
0393  * @param patternLength Length of the pattern to use
0394  * @param locale        The locale for which the messages are formatted.
0395  * @param parseError    A pointer to UParseError struct to receive any errors 
0396  *                      occurred during parsing. Can be NULL.
0397  * @param status        A pointer to an UErrorCode to receive any errors.
0398  * @return              A pointer to a UMessageFormat to use for formatting 
0399  *                      messages, or 0 if an error occurred. 
0400  * @stable ICU 2.0
0401  */
0402 U_CAPI UMessageFormat* U_EXPORT2 
0403 umsg_open(  const UChar     *pattern,
0404             int32_t         patternLength,
0405             const  char     *locale,
0406             UParseError     *parseError,
0407             UErrorCode      *status);
0408 
0409 /**
0410  * Close a UMessageFormat.
0411  * Once closed, a UMessageFormat may no longer be used.
0412  * @param format The formatter to close.
0413  * @stable ICU 2.0
0414  */
0415 U_CAPI void U_EXPORT2 
0416 umsg_close(UMessageFormat* format);
0417 
0418 #if U_SHOW_CPLUSPLUS_API
0419 
0420 U_NAMESPACE_BEGIN
0421 
0422 /**
0423  * \class LocalUMessageFormatPointer
0424  * "Smart pointer" class, closes a UMessageFormat via umsg_close().
0425  * For most methods see the LocalPointerBase base class.
0426  *
0427  * @see LocalPointerBase
0428  * @see LocalPointer
0429  * @stable ICU 4.4
0430  */
0431 U_DEFINE_LOCAL_OPEN_POINTER(LocalUMessageFormatPointer, UMessageFormat, umsg_close);
0432 
0433 U_NAMESPACE_END
0434 
0435 #endif
0436 
0437 /**
0438  * Open a copy of a UMessageFormat.
0439  * This function performs a deep copy.
0440  * @param fmt The formatter to copy
0441  * @param status A pointer to an UErrorCode to receive any errors.
0442  * @return A pointer to a UDateFormat identical to fmt.
0443  * @stable ICU 2.0
0444  */
0445 U_CAPI UMessageFormat U_EXPORT2 
0446 umsg_clone(const UMessageFormat *fmt,
0447            UErrorCode *status);
0448 
0449 /**
0450  * Sets the locale. This locale is used for fetching default number or date
0451  * format information.
0452  * @param fmt The formatter to set
0453  * @param locale The locale the formatter should use.
0454  * @stable ICU 2.0
0455  */
0456 U_CAPI void  U_EXPORT2 
0457 umsg_setLocale(UMessageFormat *fmt,
0458                const char* locale);
0459 
0460 /**
0461  * Gets the locale. This locale is used for fetching default number or date
0462  * format information.
0463  * @param fmt The formatter to querry
0464  * @return the locale.
0465  * @stable ICU 2.0
0466  */
0467 U_CAPI const char*  U_EXPORT2 
0468 umsg_getLocale(const UMessageFormat *fmt);
0469 
0470 /**
0471  * Sets the pattern.
0472  * @param fmt           The formatter to use
0473  * @param pattern       The pattern to be applied.
0474  * @param patternLength Length of the pattern to use
0475  * @param parseError    Struct to receive information on position 
0476  *                      of error if an error is encountered.Can be NULL.
0477  * @param status        Output param set to success/failure code on
0478  *                      exit. If the pattern is invalid, this will be
0479  *                      set to a failure result.
0480  * @stable ICU 2.0
0481  */
0482 U_CAPI void  U_EXPORT2 
0483 umsg_applyPattern( UMessageFormat *fmt,
0484                    const UChar* pattern,
0485                    int32_t patternLength,
0486                    UParseError* parseError,
0487                    UErrorCode* status);
0488 
0489 /**
0490  * Gets the pattern.
0491  * @param fmt          The formatter to use
0492  * @param result       A pointer to a buffer to receive the pattern.
0493  * @param resultLength The maximum size of result.
0494  * @param status       Output param set to success/failure code on
0495  *                     exit. If the pattern is invalid, this will be
0496  *                     set to a failure result.  
0497  * @return the pattern of the format
0498  * @stable ICU 2.0
0499  */
0500 U_CAPI int32_t  U_EXPORT2 
0501 umsg_toPattern(const UMessageFormat *fmt,
0502                UChar* result, 
0503                int32_t resultLength,
0504                UErrorCode* status);
0505 
0506 /**
0507  * Format a message for a locale.
0508  * This function may perform re-ordering of the arguments depending on the
0509  * locale. For all numeric arguments, double is assumed unless the type is
0510  * explicitly integer.  All choice format arguments must be of type double.
0511  * @param fmt           The formatter to use
0512  * @param result        A pointer to a buffer to receive the formatted message.
0513  * @param resultLength  The maximum size of result.
0514  * @param status        A pointer to an UErrorCode to receive any errors
0515  * @param ...           A variable-length argument list containing the arguments 
0516  *                      specified in pattern.
0517  * @return              The total buffer size needed; if greater than resultLength, 
0518  *                      the output was truncated.
0519  * @stable ICU 2.0
0520  */
0521 U_CAPI int32_t U_EXPORT2 
0522 umsg_format(    const UMessageFormat *fmt,
0523                 UChar          *result,
0524                 int32_t        resultLength,
0525                 UErrorCode     *status,
0526                 ...);
0527 
0528 /**
0529  * Format a message for a locale.
0530  * This function may perform re-ordering of the arguments depending on the
0531  * locale. For all numeric arguments, double is assumed unless the type is
0532  * explicitly integer.  All choice format arguments must be of type double.
0533  * @param fmt          The formatter to use 
0534  * @param result       A pointer to a buffer to receive the formatted message.
0535  * @param resultLength The maximum size of result.
0536  * @param ap           A variable-length argument list containing the arguments 
0537  * @param status       A pointer to an UErrorCode to receive any errors
0538  *                     specified in pattern.
0539  * @return             The total buffer size needed; if greater than resultLength, 
0540  *                     the output was truncated.
0541  * @stable ICU 2.0
0542  */
0543 U_CAPI int32_t U_EXPORT2 
0544 umsg_vformat(   const UMessageFormat *fmt,
0545                 UChar          *result,
0546                 int32_t        resultLength,
0547                 va_list        ap,
0548                 UErrorCode     *status);
0549 
0550 /**
0551  * Parse a message.
0552  * For numeric arguments, this function will always use doubles.  Integer types
0553  * should not be passed.
0554  * This function is not able to parse all output from {@link #umsg_format }.
0555  * @param fmt           The formatter to use 
0556  * @param source        The text to parse.
0557  * @param sourceLength  The length of source, or -1 if null-terminated.
0558  * @param count         Output param to receive number of elements returned.
0559  * @param status        A pointer to an UErrorCode to receive any errors
0560  * @param ...           A variable-length argument list containing the arguments
0561  *                      specified in pattern.
0562  * @stable ICU 2.0
0563  */
0564 U_CAPI void U_EXPORT2 
0565 umsg_parse( const UMessageFormat *fmt,
0566             const UChar    *source,
0567             int32_t        sourceLength,
0568             int32_t        *count,
0569             UErrorCode     *status,
0570             ...);
0571 
0572 /**
0573  * Parse a message.
0574  * For numeric arguments, this function will always use doubles.  Integer types
0575  * should not be passed.
0576  * This function is not able to parse all output from {@link #umsg_format }.
0577  * @param fmt           The formatter to use 
0578  * @param source        The text to parse.
0579  * @param sourceLength  The length of source, or -1 if null-terminated.
0580  * @param count         Output param to receive number of elements returned.
0581  * @param ap            A variable-length argument list containing the arguments
0582  * @param status        A pointer to an UErrorCode to receive any errors
0583  *                      specified in pattern.
0584  * @see u_formatMessage
0585  * @stable ICU 2.0
0586  */
0587 U_CAPI void U_EXPORT2 
0588 umsg_vparse(const UMessageFormat *fmt,
0589             const UChar    *source,
0590             int32_t        sourceLength,
0591             int32_t        *count,
0592             va_list        ap,
0593             UErrorCode     *status);
0594 
0595 
0596 /**
0597  * Convert an 'apostrophe-friendly' pattern into a standard
0598  * pattern.  Standard patterns treat all apostrophes as
0599  * quotes, which is problematic in some languages, e.g. 
0600  * French, where apostrophe is commonly used.  This utility
0601  * assumes that only an unpaired apostrophe immediately before
0602  * a brace is a true quote.  Other unpaired apostrophes are paired,
0603  * and the resulting standard pattern string is returned.
0604  *
0605  * <p><b>Note</b> it is not guaranteed that the returned pattern
0606  * is indeed a valid pattern.  The only effect is to convert
0607  * between patterns having different quoting semantics.
0608  *
0609  * @param pattern the 'apostrophe-friendly' patttern to convert
0610  * @param patternLength the length of pattern, or -1 if unknown and pattern is null-terminated
0611  * @param dest the buffer for the result, or NULL if preflight only
0612  * @param destCapacity the length of the buffer, or 0 if preflighting
0613  * @param ec the error code
0614  * @return the length of the resulting text, not including trailing null
0615  *        if buffer has room for the trailing null, it is provided, otherwise
0616  *        not
0617  * @stable ICU 3.4
0618  */
0619 U_CAPI int32_t U_EXPORT2 
0620 umsg_autoQuoteApostrophe(const UChar* pattern, 
0621                          int32_t patternLength,
0622                          UChar* dest,
0623                          int32_t destCapacity,
0624                          UErrorCode* ec);
0625 
0626 #endif /* #if !UCONFIG_NO_FORMATTING */
0627 
0628 #endif