ICU-863 Don't use t_int32 or UFieldPosition in the examples
X-SVN-Rev: 3979
This commit is contained in:
parent
6c4bd1db2c
commit
746f7b4216
@ -33,15 +33,14 @@
|
||||
* <pre>
|
||||
* \code
|
||||
* UErrorCode status;
|
||||
* UFieldPosition pos;
|
||||
* UChar *myString;
|
||||
* t_int32 myStrlen=0;
|
||||
* int32_t myStrlen=0;
|
||||
* UDateFormat* dfmt = udat_open(UCAL_DEFAULT, UCAL_DEFAULT, NULL, "PST", &status);
|
||||
* myStrlen = udat_format(dfmt, myDate, NULL, myStrlen, &pos, &status);
|
||||
* myStrlen = udat_format(dfmt, myDate, NULL, myStrlen, NULL, &status);
|
||||
* if(status==U_BUFFER_OVERFLOW_ERROR){
|
||||
* status=U_ZERO_ERROR;
|
||||
* myString=(UChar*)malloc(sizeof(UChar) * (myStrlen+1) );
|
||||
* udat_format(dfmt, myDate, myString, myStrlen+1, &pos, &status);
|
||||
* status=U_ZERO_ERROR;
|
||||
* myString=(UChar*)malloc(sizeof(UChar) * (myStrlen+1) );
|
||||
* udat_format(dfmt, myDate, myString, myStrlen+1, NULL, &status);
|
||||
* }
|
||||
* \endcode
|
||||
* </pre>
|
||||
@ -50,7 +49,7 @@
|
||||
* information about the local language and country conventions multiple times.
|
||||
* <pre>
|
||||
* \code
|
||||
* t_int32 i, myStrlen=0;
|
||||
* int32_t i, myStrlen=0;
|
||||
* UChar* myString;
|
||||
* UDate myDateArr[] = { 0.0, 100000000.0, 2000000000.0 }; // test values
|
||||
* UDateFormat* df = udat_open(UCAL_DEFAULT, UCAL_DEFAULT, NULL, "GMT", &status);
|
||||
@ -77,7 +76,7 @@
|
||||
* <pre>
|
||||
* \code
|
||||
* UErrorCode status = U_ZERO_ERROR;
|
||||
* t_int32 parsepos=0;
|
||||
* int32_t parsepos=0;
|
||||
* UDate myDate = udat_parse(df, myString, u_strlen(myString), &parsepos, &status);
|
||||
* \endcode
|
||||
* </pre>
|
||||
|
@ -27,11 +27,12 @@
|
||||
* \code
|
||||
* UChar *result, *tzID, *str;
|
||||
* UChar pattern[100];
|
||||
* t_int32 resultLengthOut, resultlength;
|
||||
* int32_t resultLengthOut, resultlength;
|
||||
* UCalendar *cal;
|
||||
* UDate d1;
|
||||
* UDateFormat *def1;
|
||||
* UErrorCode status = U_ZERO_ERROR;
|
||||
*
|
||||
* str=(UChar*)malloc(sizeof(UChar) * (strlen("disturbance in force") +1));
|
||||
* u_uastrcpy(str, "disturbance in force");
|
||||
* tzID=(UChar*)malloc(sizeof(UChar) * 4);
|
||||
@ -62,22 +63,23 @@
|
||||
* UErrorCode status = U_ZERO_ERROR;
|
||||
* UChar *result;
|
||||
* UChar pattern[100];
|
||||
* t_int32 resultlength,resultLengthOut, i;
|
||||
* int32_t resultlength, resultLengthOut, i;
|
||||
* double testArgs= { 100.0, 1.0, 0.0};
|
||||
*
|
||||
* str=(UChar*)malloc(sizeof(UChar) * 10);
|
||||
* u_uastrcpy(str, "MyDisk");
|
||||
* u_uastrcpy(pattern, "The disk {1} contains {0,choice,0#no files|1#one file|1<{0,number,integer} files}");
|
||||
* for(i=0; i<3; i++){
|
||||
* resultlength=0;
|
||||
* resultLengthOut=u_formatMessage( "en_US", pattern, u_strlen(pattern), NULL, resultlength, &status, testArgs[i], str);
|
||||
* if(status==U_BUFFER_OVERFLOW_ERROR){
|
||||
* resultLengthOut=u_formatMessage( "en_US", pattern, u_strlen(pattern), NULL, resultlength, &status, testArgs[i], str);
|
||||
* if(status==U_BUFFER_OVERFLOW_ERROR){
|
||||
* status=U_ZERO_ERROR;
|
||||
* resultlength=resultLengthOut+1;
|
||||
* result=(UChar*)malloc(sizeof(UChar) * resultlength);
|
||||
* u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, testArgs[i], str);
|
||||
* }
|
||||
* printf("%s\n", austrdup(result) ); //austrdup( a function used to convert UChar* to char*)
|
||||
* free(result);
|
||||
* }
|
||||
* printf("%s\n", austrdup(result) ); //austrdup( a function used to convert UChar* to char*)
|
||||
* free(result);
|
||||
* }
|
||||
* // output, with different testArgs:
|
||||
* // output: The disk "MyDisk" contains 100 files.
|
||||
|
@ -37,11 +37,10 @@
|
||||
* <pre>
|
||||
* \code
|
||||
* UChar myString[20];
|
||||
* UFieldPosition pos=0;
|
||||
* double myNumber = 7.0;
|
||||
* UErrorCode success = U_ZERO_ERROR;
|
||||
* UNumberFormat* nf = unum_open(UNUM_DEFAULT, NULL, &success)
|
||||
* unum_formatDouble(nf, myNumber, myString, u_strlen(myString), &pos, &status);
|
||||
* unum_formatDouble(nf, myNumber, myString, u_strlen(myString), NULL, &status);
|
||||
* printf(" Example 1: %s\n", austrdup(myString) ); //austrdup( a function used to convert UChar* to char*)
|
||||
* \endcode
|
||||
* </pre>
|
||||
@ -52,20 +51,19 @@
|
||||
* <pre>
|
||||
* \code
|
||||
* UChar* myString;
|
||||
* t_int32 i, resultlength, reslenneeded;
|
||||
* int32_t i, resultlength, reslenneeded;
|
||||
* UErrorCode success = U_ZERO_ERROR;
|
||||
* UFieldPosition pos=0;
|
||||
* t_int32 a[] = { 123, 3333, -1234567 };
|
||||
* const t_int32 a_len = sizeof(a) / sizeof(a[0]);
|
||||
* int32_t a[] = { 123, 3333, -1234567 };
|
||||
* const int32_t a_len = sizeof(a) / sizeof(a[0]);
|
||||
* UNumberFormat* nf = unum_open(UNUM_DEFAULT, NULL, &success)
|
||||
* for (i = 0; i < a_len; i++) {
|
||||
* resultlength=0;
|
||||
* reslenneeded=unum_format(nf, a[i], NULL, resultlength, &pos, &status);
|
||||
* reslenneeded=unum_format(nf, a[i], NULL, resultlength, NULL, &status);
|
||||
* if(status==U_BUFFER_OVERFLOW_ERROR){
|
||||
* status=U_ZERO_ERROR;
|
||||
* resultlength=resultlengthneeded+1;
|
||||
* result=(UChar*)malloc(sizeof(UChar) * resultlength);
|
||||
* unum_format(nf, a[i], result, resultlength, &pos, &status);
|
||||
* unum_format(nf, a[i], result, resultlength, NULL, &status);
|
||||
* }
|
||||
* printf(" Example 2: %s\n", austrdup(result) );
|
||||
* free(result);
|
||||
@ -83,7 +81,7 @@
|
||||
* <pre>
|
||||
* \code
|
||||
* UErrorCode success;
|
||||
* t_int32 pos=0;
|
||||
* int32_t pos=0;
|
||||
* unum_parse(nf, result, u_strlen(result), &pos, &success);
|
||||
* \endcode
|
||||
* </pre>
|
||||
@ -214,12 +212,16 @@ unum_clone(const UNumberFormat *fmt,
|
||||
* @param number The number to format.
|
||||
* @param result A pointer to a buffer to receive the formatted number.
|
||||
* @param resultLength The maximum size of result.
|
||||
* @param pos If not 0, a UFieldPosition which will receive the information on a specific field.
|
||||
* @param position A pointer to a UFieldPosition. On input, position->field
|
||||
* is read. On output, position->beginIndex and position->endIndex indicate
|
||||
* the beginning and ending indices of field number position->field, if such
|
||||
* a field exists. This parameter may be NULL, in which case no field
|
||||
* @param status A pointer to an UErrorCode to receive any errors
|
||||
* @return The total buffer size needed; if greater than resultLength, the output was truncated.
|
||||
* @see unum_formatDouble
|
||||
* @see unum_parse
|
||||
* @see unum_parseDouble
|
||||
* @see UFieldPosition
|
||||
* @draft
|
||||
*/
|
||||
U_CAPI int32_t
|
||||
@ -237,12 +239,16 @@ unum_format( const UNumberFormat* fmt,
|
||||
* @param number The number to format.
|
||||
* @param result A pointer to a buffer to receive the formatted number.
|
||||
* @param resultLength The maximum size of result.
|
||||
* @param pos If not 0, a UFieldPosition which will receive the information on a specific field.
|
||||
* @param position A pointer to a UFieldPosition. On input, position->field
|
||||
* is read. On output, position->beginIndex and position->endIndex indicate
|
||||
* the beginning and ending indices of field number position->field, if such
|
||||
* a field exists. This parameter may be NULL, in which case no field
|
||||
* @param status A pointer to an UErrorCode to receive any errors
|
||||
* @return The total buffer size needed; if greater than resultLength, the output was truncated.
|
||||
* @see unum_format
|
||||
* @see unum_parse
|
||||
* @see unum_parseDouble
|
||||
* @see UFieldPosition
|
||||
* @draft
|
||||
*/
|
||||
U_CAPI int32_t
|
||||
|
Loading…
Reference in New Issue
Block a user