From e2a99295e9178dc3aec9b30837891cd0954bd13a Mon Sep 17 00:00:00 2001 From: Ram Viswanadha Date: Fri, 8 Dec 2000 18:46:55 +0000 Subject: [PATCH] ICU-647 Chaged documentation in header files for compliance with Doxygen X-SVN-Rev: 3171 --- icu4c/source/i18n/unicode/brkiter.h | 174 +++++++++++---------- icu4c/source/i18n/unicode/choicfmt.h | 114 ++++++++------ icu4c/source/i18n/unicode/coleitr.h | 40 +++-- icu4c/source/i18n/unicode/coll.h | 4 + icu4c/source/i18n/unicode/datefmt.h | 36 +++-- icu4c/source/i18n/unicode/dcfmtsym.h | 22 +-- icu4c/source/i18n/unicode/decimfmt.h | 148 +++++++++--------- icu4c/source/i18n/unicode/fieldpos.h | 64 ++++---- icu4c/source/i18n/unicode/format.h | 4 +- icu4c/source/i18n/unicode/gregocal.h | 137 +++++++++-------- icu4c/source/i18n/unicode/msgfmt.h | 170 ++++++++++---------- icu4c/source/i18n/unicode/numfmt.h | 50 +++--- icu4c/source/i18n/unicode/smpdtfmt.h | 106 +++++++------ icu4c/source/i18n/unicode/sortkey.h | 28 ++-- icu4c/source/i18n/unicode/tblcoll.h | 222 +++++++++++++++------------ icu4c/source/i18n/unicode/ubrk.h | 173 +++++++++++---------- icu4c/source/i18n/unicode/ucal.h | 11 +- icu4c/source/i18n/unicode/ucol.h | 9 +- icu4c/source/i18n/unicode/udat.h | 79 ++++++---- icu4c/source/i18n/unicode/umsg.h | 171 +++++++++++---------- icu4c/source/i18n/unicode/unum.h | 73 +++++---- 21 files changed, 1012 insertions(+), 823 deletions(-) diff --git a/icu4c/source/i18n/unicode/brkiter.h b/icu4c/source/i18n/unicode/brkiter.h index 967d7603359..3492b6d0f28 100644 --- a/icu4c/source/i18n/unicode/brkiter.h +++ b/icu4c/source/i18n/unicode/brkiter.h @@ -63,104 +63,118 @@ *

* Helper function to output text *

- * .   void printTextRange( BreakIterator& iterator, UTextOffset start, UTextOffset end )
- * .   {
- * .       UnicodeString textBuffer, temp;
- * .       CharacterIterator *strIter = iterator.createText();
- * .       strIter->getText(temp);
- * .       cout << " " << start << " " << end << " |" 
- * .            << temp.extractBetween(start, end, textBuffer)
- * .            << "|" << endl;
- * .       delete strIter;
- * .   }
+ * \code 
+ *    void printTextRange( BreakIterator& iterator, UTextOffset start, UTextOffset end )
+ *    {
+ *        UnicodeString textBuffer, temp;
+ *        CharacterIterator *strIter = iterator.createText();
+ *        strIter->getText(temp);
+ *        cout << " " << start << " " << end << " |" 
+ *             << temp.extractBetween(start, end, textBuffer)
+ *             << "|" << endl;
+ *        delete strIter;
+ *    }
+ * \endcode
  * 
* Print each element in order: *
- * .   void printEachForward( BreakIterator& boundary)
- * .   {
- * .      UTextOffset start = boundary.first();
- * .      for (UTextOffset end = boundary.next();
- * .        end != BreakIterator::DONE;
- * .        start = end, end = boundary.next())
- * .        {
- * .            printTextRange( boundary, start, end );
- * .        }
- * .   }
+ * \code
+ *    void printEachForward( BreakIterator& boundary)
+ *    {
+ *       UTextOffset start = boundary.first();
+ *       for (UTextOffset end = boundary.next();
+ *         end != BreakIterator::DONE;
+ *         start = end, end = boundary.next())
+ *         {
+ *             printTextRange( boundary, start, end );
+ *         }
+ *    }
+ * \code
  * 
* Print each element in reverse order: *
- * .   void printEachBackward( BreakIterator& boundary)
- * .   {
- * .      UTextOffset end = boundary.last();
- * .      for (UTextOffset start = boundary.previous();
- * .        start != BreakIterator::DONE;
- * .        end = start, start = boundary.previous())
- * .        {
- * .            printTextRange( boundary, start, end );
- * .        }
- * .   }
+ * \code
+ *    void printEachBackward( BreakIterator& boundary)
+ *    {
+ *       UTextOffset end = boundary.last();
+ *       for (UTextOffset start = boundary.previous();
+ *         start != BreakIterator::DONE;
+ *         end = start, start = boundary.previous())
+ *         {
+ *             printTextRange( boundary, start, end );
+ *         }
+ *    }
+ * \endcode
  * 
* Print first element *
- * .   void printFirst(BreakIterator& boundary)
- * .   {
- * .       UTextOffset start = boundary.first();
- * .       UTextOffset end = boundary.next();
- * .       printTextRange( boundary, start, end );
- * .   }
+ * \code
+ *    void printFirst(BreakIterator& boundary)
+ *    {
+ *        UTextOffset start = boundary.first();
+ *        UTextOffset end = boundary.next();
+ *        printTextRange( boundary, start, end );
+ *    }
+ * \endcode
  * 
* Print last element *
- * .   void printLast(BreakIterator& boundary)
- * .   {
- * .       UTextOffset end = boundary.last();
- * .       UTextOffset start = boundary.previous();
- * .       printTextRange( boundary, start, end );
- * .   }
+ *  \code
+ *    void printLast(BreakIterator& boundary)
+ *    {
+ *        UTextOffset end = boundary.last();
+ *        UTextOffset start = boundary.previous();
+ *        printTextRange( boundary, start, end );
+ *    }
+ * \endcode
  * 
* Print the element at a specified position *
- * .   void printAt(BreakIterator &boundary, UTextOffset pos )
- * .   {
- * .       UTextOffset end = boundary.following(pos);
- * .       UTextOffset start = boundary.previous();
- * .       printTextRange( boundary, start, end );
- * .   }
+ * \code
+ *    void printAt(BreakIterator &boundary, UTextOffset pos )
+ *    {
+ *        UTextOffset end = boundary.following(pos);
+ *        UTextOffset start = boundary.previous();
+ *        printTextRange( boundary, start, end );
+ *    }
+ * \endcode
  * 
* Creating and using text boundaries *
- * .      void BreakIterator_Example( void )
- * .      {
- * .          BreakIterator* boundary;
- * .          UnicodeString stringToExamine("Aaa bbb ccc. Ddd eee fff.");
- * .          cout << "Examining: " << stringToExamine << endl;
- * .
- * .          //print each sentence in forward and reverse order
- * .          boundary = BreakIterator::createSentenceInstance( Locale::US );
- * .          boundary->setText(stringToExamine);
- * .          cout << "----- forward: -----------" << endl;
- * .          printEachForward(*boundary);
- * .          cout << "----- backward: ----------" << endl;
- * .          printEachBackward(*boundary);
- * .          delete boundary;
- * .
- * .          //print each word in order
- * .          boundary = BreakIterator::createWordInstance();
- * .          boundary->setText(stringToExamine);
- * .          cout << "----- forward: -----------" << endl;
- * .          printEachForward(*boundary);
- * .          //print first element
- * .          cout << "----- first: -------------" << endl;
- * .          printFirst(*boundary);
- * .          //print last element
- * .          cout << "----- last: --------------" << endl;
- * .          printLast(*boundary);
- * .          //print word at charpos 10
- * .          cout << "----- at pos 10: ---------" << endl;
- * .          printAt(*boundary, 10 );
- * .
- * .          delete boundary;
- * .      }
+ * \code
+ *       void BreakIterator_Example( void )
+ *       {
+ *           BreakIterator* boundary;
+ *           UnicodeString stringToExamine("Aaa bbb ccc. Ddd eee fff.");
+ *           cout << "Examining: " << stringToExamine << endl;
+ * 
+ *           //print each sentence in forward and reverse order
+ *           boundary = BreakIterator::createSentenceInstance( Locale::US );
+ *           boundary->setText(stringToExamine);
+ *           cout << "----- forward: -----------" << endl;
+ *           printEachForward(*boundary);
+ *           cout << "----- backward: ----------" << endl;
+ *           printEachBackward(*boundary);
+ *           delete boundary;
+ * 
+ *           //print each word in order
+ *           boundary = BreakIterator::createWordInstance();
+ *           boundary->setText(stringToExamine);
+ *           cout << "----- forward: -----------" << endl;
+ *           printEachForward(*boundary);
+ *           //print first element
+ *           cout << "----- first: -------------" << endl;
+ *           printFirst(*boundary);
+ *           //print last element
+ *           cout << "----- last: --------------" << endl;
+ *           printLast(*boundary);
+ *           //print word at charpos 10
+ *           cout << "----- at pos 10: ---------" << endl;
+ *           printAt(*boundary, 10 );
+ * 
+ *           delete boundary;
+ *       }
+ * \endcode
  * 
*/ class U_I18N_API BreakIterator { diff --git a/icu4c/source/i18n/unicode/choicfmt.h b/icu4c/source/i18n/unicode/choicfmt.h index 757a58c5d0b..67ad186b0af 100644 --- a/icu4c/source/i18n/unicode/choicfmt.h +++ b/icu4c/source/i18n/unicode/choicfmt.h @@ -36,68 +36,76 @@ * The choice is specified with an ascending list of doubles, where each item * specifies a half-open interval up to the next item: *
- * .    X matches j if and only if limit[j] <= X < limit[j+1]
+ * \code
+ *     X matches j if and only if limit[j] <= X < limit[j+1]
+ * \endcode
  * 
* If there is no match, then either the first or last index is used, depending * on whether the number is too low or too high. The length of the array of * formats must be the same as the length of the array of limits. * For example, *
- * .     {1,2,3,4,5,6,7},
- * .          {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"}
- * .     {0, 1, ChoiceFormat::nextDouble(1)},
- * .          {"no files", "one file", "many files"}
+ * \code
+ *      {1,2,3,4,5,6,7},
+ *           {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"}
+ *      {0, 1, ChoiceFormat::nextDouble(1)},
+ *           {"no files", "one file", "many files"}
+ *  \endcode
  * 
* (nextDouble can be used to get the next higher double, to make the half-open * interval.) *

* Here is a simple example that shows formatting and parsing: *

- * .  void SimpleChoiceExample( void )
- * .  {
- * .      double limits[] = {1,2,3,4,5,6,7};
- * .      UnicodeString monthNames[] = {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"};
- * .      ChoiceFormat* form = new ChoiceFormat(limits, monthNames, 7 );
- * .      ParsePosition* status = new ParsePosition(0);
- * .      UnicodeString str;
- * .      FieldPosition f1(0), f2(0);
- * .      for (double i = 0.0; i <= 8.0; ++i) {
- * .          status->setIndex(0);
- * .          Formattable parseResult;
- * .          str.remove();
- * .          cout << i << " -> " << form->format(i,str, f1) 
- * .                    << " -> " << parseResult << endl;
- * .      }
- * .      delete form;
- * .      delete status;
- * .      cout << endl;
- * .  }
+ * \code
+ *   void SimpleChoiceExample( void )
+ *   {
+ *       double limits[] = {1,2,3,4,5,6,7};
+ *       UnicodeString monthNames[] = {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"};
+ *       ChoiceFormat* form = new ChoiceFormat(limits, monthNames, 7 );
+ *       ParsePosition* status = new ParsePosition(0);
+ *       UnicodeString str;
+ *       FieldPosition f1(0), f2(0);
+ *       for (double i = 0.0; i <= 8.0; ++i) {
+ *           status->setIndex(0);
+ *           Formattable parseResult;
+ *           str.remove();
+ *           cout << i << " -> " << form->format(i,str, f1) 
+ *                     << " -> " << parseResult << endl;
+ *       }
+ *       delete form;
+ *       delete status;
+ *       cout << endl;
+ *   }
+ * \endcode
  * 
* Here is a more complex example, with a pattern format. *
- * .  void ComplexChoiceExample( void )
- * .  {
- * .      double filelimits[] = {0,1,2};
- * .      UnicodeString filepart[] = {"are no files","is one file","are {2} files"};
- * .      ChoiceFormat* fileform = new ChoiceFormat(filelimits, filepart, 3 );
- * .      UErrorCode success = U_ZERO_ERROR;
- * .      const Format* testFormats[] = { fileform, NULL, NumberFormat::createInstance(success) };
- * .      MessageFormat* pattform = new MessageFormat("There {0} on {1}", success );
- * .      pattform->setFormats( testFormats, 3 );
- * .      Formattable testArgs[] = {0L, "Disk_A", 0L};
- * .      FieldPosition fp(0);
- * .      UnicodeString str;
- * .      for (int32_t i = 0; i < 4; ++i) {
- * .          Formattable fInt(i);
- * .          testArgs[0] = fInt;
- * .          testArgs[2] = testArgs[0];
- * .          str.remove();
- * .          pattform->format(testArgs, 3, str, fp, success );
- * .          cout << "Output for i=" << i << " : " << str << endl;
- * .      }
- * .      delete pattform;
- * .      cout << endl;
- * .  }
+ * \code
+ *   void ComplexChoiceExample( void )
+ *   {
+ *       double filelimits[] = {0,1,2};
+ *       UnicodeString filepart[] = {"are no files","is one file","are {2} files"};
+ *       ChoiceFormat* fileform = new ChoiceFormat(filelimits, filepart, 3 );
+ *       UErrorCode success = U_ZERO_ERROR;
+ *       const Format* testFormats[] = { fileform, NULL, NumberFormat::createInstance(success) };
+ *       MessageFormat* pattform = new MessageFormat("There {0} on {1}", success );
+ *       pattform->setFormats( testFormats, 3 );
+ *       Formattable testArgs[] = {0L, "Disk_A", 0L};
+ *       FieldPosition fp(0);
+ *       UnicodeString str;
+ *       for (int32_t i = 0; i < 4; ++i) {
+ *           Formattable fInt(i);
+ *           testArgs[0] = fInt;
+ *           testArgs[2] = testArgs[0];
+ *           str.remove();
+ *           pattform->format(testArgs, 3, str, fp, success );
+ *           cout << "Output for i=" << i << " : " << str << endl;
+ *       }
+ *       delete pattform;
+ *       cout << endl;
+ *   }
+ * \endcode
  * 
* ChoiceFormat objects may be converted to and from patterns. The * syntax of these patterns is [TODO fill in this section with detail]. @@ -106,13 +114,17 @@ * You can either do this programmatically, as in the above example, * or by using a pattern (see ChoiceFormat for more information) as in: *
- * .       "0#are no files|1#is one file|1<are many files"
+ * \code
+ *        "0#are no files|1#is one file|1<are many files"
+ * \endcode
  * 
* Here the notation is: *
- * .       <number> "#"  Specifies a limit value.
- * .       <number> "<"  Specifies a limit of nextDouble(<number>).
- * .       <number> ">"  Specifies a limit of previousDouble(<number>).
+ *  \code
+ *         "#"  Specifies a limit value.
+ *         "<"  Specifies a limit of nextDouble(<number>).
+ *         ">"  Specifies a limit of previousDouble(<number>).
+ *  \endcode
  * 
* Each limit value is followed by a string, which is terminated by * a vertical bar character ("|"), except for the last string, which diff --git a/icu4c/source/i18n/unicode/coleitr.h b/icu4c/source/i18n/unicode/coleitr.h index cb579f11c57..0e55f35cbcc 100644 --- a/icu4c/source/i18n/unicode/coleitr.h +++ b/icu4c/source/i18n/unicode/coleitr.h @@ -45,13 +45,17 @@ typedef void * UCollator; * collated in the given collation object. * For example, consider the following in Spanish: *
- * .       "ca" -> the first key is key('c') and second key is key('a').
- * .       "cha" -> the first key is key('ch') and second key is key('a').
+ * \code
+ *        "ca" -> the first key is key('c') and second key is key('a').
+ *        "cha" -> the first key is key('ch') and second key is key('a').
+ * \endcode
  * 
* And in German, *
- * .       "æb"-> the first key is key('a'), the second key is key('e'), and
- * .       the third key is key('b').
+ * \code
+ *        "æb"-> the first key is key('a'), the second key is key('e'), and
+ *        the third key is key('b').
+* \endcode
  * 
* The key of a character, is an integer composed of primary order(short), * secondary order(char), and tertiary order(char). Java strictly defines @@ -60,19 +64,21 @@ typedef void * UCollator; * to ensure the correctness of the key value. *

Example of the iterator usage: (without error checking) *

- * .  void CollationElementIterator_Example()
- * .  {
- * .      UnicodeString str = "This is a test";
- * .      UErrorCode success = U_ZERO_ERROR;
- * .      RuleBasedCollator* rbc =
- * .          (RuleBasedCollator*) RuleBasedCollator::createInstance(success);
- * .      CollationElementIterator* c =
- * .          rbc->createCollationElementIterator( str );
- * .      int32_t order = c->next(success);
- * .      int32_t primaryOrder = CollationElementIterator::primaryOrder( order );
- * .      delete c;
- * .      delete rbc;
- * .  }
+ * \code
+ *   void CollationElementIterator_Example()
+ *   {
+ *       UnicodeString str = "This is a test";
+ *       UErrorCode success = U_ZERO_ERROR;
+ *       RuleBasedCollator* rbc =
+ *           (RuleBasedCollator*) RuleBasedCollator::createInstance(success);
+ *       CollationElementIterator* c =
+ *           rbc->createCollationElementIterator( str );
+ *       int32_t order = c->next(success);
+ *       int32_t primaryOrder = CollationElementIterator::primaryOrder( order );
+ *       delete c;
+ *       delete rbc;
+ *   }
+ * \endcode
  * 
*

* CollationElementIterator::next returns the collation order of the next diff --git a/icu4c/source/i18n/unicode/coll.h b/icu4c/source/i18n/unicode/coll.h index a10c02cbc1c..bff13727514 100644 --- a/icu4c/source/i18n/unicode/coll.h +++ b/icu4c/source/i18n/unicode/coll.h @@ -79,6 +79,7 @@ class CollationKey; * the Collator for the default locale. *

*
+ * \code
  * // Compare two strings in the default locale
  * UErrorCode success = U_ZERO_ERROR;
  * Collator* myCollator = Collator::createInstance(success);
@@ -87,6 +88,7 @@ class CollationKey;
  * }else{
  *     cout << "abc is greater than or equal to ABC" << endl;
  * }
+ * \endcode
  * 
*
* @@ -103,6 +105,7 @@ class CollationKey; * US English. *
*
+ * \code
  * //Get the Collator for US English and set its strength to PRIMARY
  * UErrorCode success = U_ZERO_ERROR;
  * Collator* usCollator = Collator::createInstance(Locale::US, success);
@@ -110,6 +113,7 @@ class CollationKey;
  * if( usCollator->compare("abc", "ABC") == 0 ) {
  *     cout << "'abc' and 'ABC' strings are equivalent with strength PRIMARY" << endl;
  * }
+ * \endcode
  * 
*
*

diff --git a/icu4c/source/i18n/unicode/datefmt.h b/icu4c/source/i18n/unicode/datefmt.h index 71041bb4d72..f069b0d60e2 100644 --- a/icu4c/source/i18n/unicode/datefmt.h +++ b/icu4c/source/i18n/unicode/datefmt.h @@ -42,32 +42,40 @@ class TimeZone; * To format a date for the current Locale, use one of the static factory * methods: *

- * .    DateFormat* dfmt = DateFormat::createDateInstance();
- * .    UnicodeString myString;
- * .    myString = dfmt->format( myDate, myString );
+ * \code
+ *     DateFormat* dfmt = DateFormat::createDateInstance();
+ *     UnicodeString myString;
+ *     myString = dfmt->format( myDate, myString );
+ * \endcode
  * 
* If you are formatting multiple numbers, it is more efficient to get the * format and use it multiple times so that the system doesn't have to fetch the * information about the local language and country conventions multiple times. *
- * .    DateFormat* df = DateFormat::createDateInstance();
- * .    UnicodeString myString;
- * .    UDate myDateArr[] = { 0.0, 100000000.0, 2000000000.0 }; // test values
- * .    for (int32_t i = 0; i < 3; ++i) {
- * .        myString.remove();
- * .        cout << df->format( myDateArr[i], myString ) << endl;
- * .    }
+ * \code
+ *     DateFormat* df = DateFormat::createDateInstance();
+ *     UnicodeString myString;
+ *     UDate myDateArr[] = { 0.0, 100000000.0, 2000000000.0 }; // test values
+ *     for (int32_t i = 0; i < 3; ++i) {
+ *         myString.remove();
+ *         cout << df->format( myDateArr[i], myString ) << endl;
+ *     }
+ * \endcode
  * 
* To format a date for a different Locale, specify it in the call to * getDateInstance(). *
- * .       DateFormat* df =
- * .          DateFormat::createDateInstance( DateFormat::SHORT, Locale::FRANCE);
+ * \code
+ *        DateFormat* df =
+ *           DateFormat::createDateInstance( DateFormat::SHORT, Locale::FRANCE);
+ * \endcode
  * 
* You can use a DateFormat to parse also. *
- * .       UErrorCode status = U_ZERO_ERROR;
- * .       UDate myDate = df->parse(myString, status);
+ * \code
+ *        UErrorCode status = U_ZERO_ERROR;
+ *        UDate myDate = df->parse(myString, status);
+ * \endcode
  * 
* Use createDateInstance() to produce the normal date format for that country. * There are other static factory methods available. Use createTimeInstance() diff --git a/icu4c/source/i18n/unicode/dcfmtsym.h b/icu4c/source/i18n/unicode/dcfmtsym.h index 10b2f820561..ce7bc854198 100644 --- a/icu4c/source/i18n/unicode/dcfmtsym.h +++ b/icu4c/source/i18n/unicode/dcfmtsym.h @@ -38,16 +38,18 @@ * Here are the special characters used in the parts of the * subpattern, with notes on their usage. *
- * .       Symbol   Meaning
- * .         0      a digit
- * .         #      a digit, zero shows as absent
- * .         .      placeholder for decimal separator
- * .         ,      placeholder for grouping separator.
- * .         ;      separates formats.
- * .         -      default negative prefix.
- * .         %      divide by 100 and show as percentage
- * .         X      any other characters can be used in the prefix or suffix
- * .         '      used to quote special characters in a prefix or suffix.
+ * \code
+ *        Symbol   Meaning
+ *          0      a digit
+ *          #      a digit, zero shows as absent
+ *          .      placeholder for decimal separator
+ *          ,      placeholder for grouping separator.
+ *          ;      separates formats.
+ *          -      default negative prefix.
+ *          %      divide by 100 and show as percentage
+ *          X      any other characters can be used in the prefix or suffix
+ *          '      used to quote special characters in a prefix or suffix.
+ * \endcode
  *  
* [Notes] *

diff --git a/icu4c/source/i18n/unicode/decimfmt.h b/icu4c/source/i18n/unicode/decimfmt.h index 54621f9e1b7..0a2af7a1cc8 100644 --- a/icu4c/source/i18n/unicode/decimfmt.h +++ b/icu4c/source/i18n/unicode/decimfmt.h @@ -56,65 +56,69 @@ class DigitList; *

* [Example:] *

- * .    // normally we would have a GUI with a menu for this
- * .    int32_t locCount;
- * .    const Locale* locales = NumberFormat::getAvailableLocales(locCount);
- * .    if (locCount > 12) locCount = 12;  //limit output
- * .
- * .    double myNumber = -1234.56;
- * .    UErrorCode success = U_ZERO_ERROR;
- * .    NumberFormat* form; //= NumberFormat::createInstance(success);
- * .
- * .    // just for fun, we print out a number with the locale number, currency
- * .    // and percent format for each locale we can.
- * .    UnicodeString countryName;
- * .    UnicodeString displayName;
- * .    UnicodeString str;
- * .    UnicodeString pattern;
- * .    Formattable fmtable;
- * .    for (int32_t j = 0; j < 3; ++j) {
- * .        cout << endl << "FORMAT " << j << endl;
- * .        for (int32_t i = 0; i < locCount; ++i) {
- * .            if (locales[i].getCountry(countryName).size() == 0) {
- * .                // skip language-only
- * .                continue;
- * .            }
- * .            switch (j) {
- * .            default:
- * .                form = NumberFormat::createInstance(locales[i], success ); break;
- * .            case 1:
- * .                form = NumberFormat::createCurrencyInstance(locales[i], success ); break;
- * .            case 0:
- * .                form = NumberFormat::createPercentInstance(locales[i], success ); break;
- * .            }
- * .            if (form) {
- * .                str.remove();
- * .                pattern = ((DecimalFormat*)form)->toPattern(pattern);
- * .                cout << locales[i].getDisplayName(displayName) << ": " << pattern;
- * .                cout << "  ->  " << form->format(myNumber,str) << endl;
- * .                form->parse(form->format(myNumber,str), fmtable, success);
- * .                //cout << "   parsed: " << fmtable << endl;
- * .                delete form;  
- * .            }
- * .        }
- * .    }
+ * \code
+ *     // normally we would have a GUI with a menu for this
+ *     int32_t locCount;
+ *     const Locale* locales = NumberFormat::getAvailableLocales(locCount);
+ *     if (locCount > 12) locCount = 12;  //limit output
+ * 
+ *     double myNumber = -1234.56;
+ *     UErrorCode success = U_ZERO_ERROR;
+ *     NumberFormat* form; //= NumberFormat::createInstance(success);
+ * 
+ *     // just for fun, we print out a number with the locale number, currency
+ *     // and percent format for each locale we can.
+ *     UnicodeString countryName;
+ *     UnicodeString displayName;
+ *     UnicodeString str;
+ *     UnicodeString pattern;
+ *     Formattable fmtable;
+ *     for (int32_t j = 0; j < 3; ++j) {
+ *         cout << endl << "FORMAT " << j << endl;
+ *         for (int32_t i = 0; i < locCount; ++i) {
+ *             if (locales[i].getCountry(countryName).size() == 0) {
+ *                 // skip language-only
+ *                 continue;
+ *             }
+ *             switch (j) {
+ *             default:
+ *                 form = NumberFormat::createInstance(locales[i], success ); break;
+ *             case 1:
+ *                 form = NumberFormat::createCurrencyInstance(locales[i], success ); break;
+ *             case 0:
+ *                 form = NumberFormat::createPercentInstance(locales[i], success ); break;
+ *             }
+ *             if (form) {
+ *                 str.remove();
+ *                 pattern = ((DecimalFormat*)form)->toPattern(pattern);
+ *                 cout << locales[i].getDisplayName(displayName) << ": " << pattern;
+ *                 cout << "  ->  " << form->format(myNumber,str) << endl;
+ *                 form->parse(form->format(myNumber,str), fmtable, success);
+ *                 //cout << "   parsed: " << fmtable << endl;
+ *                 delete form;  
+ *             }
+ *         }
+ *     }
+ * \endcode
  * 
* [The following shows the structure of the pattern.] *
- * .    pattern    := subpattern{;subpattern}
- * .    subpattern := {prefix}integer{.fraction}{suffix}
- * .    
- * .    prefix     := '\\u0000'..'\\uFFFD' - specialCharacters
- * .    suffix     := '\\u0000'..'\\uFFFD' - specialCharacters
- * .    integer    := '#'* '0'* '0'
- * .    fraction   := '0'* '#'*
- *    
+ * \code
+ *     pattern    := subpattern{;subpattern}
+ *     subpattern := {prefix}integer{.fraction}{suffix}
+ *     
+ *     prefix     := '\\u0000'..'\\uFFFD' - specialCharacters
+ *     suffix     := '\\u0000'..'\\uFFFD' - specialCharacters
+ *     integer    := '#'* '0'* '0'
+ *     fraction   := '0'* '#'*
+ *   
  *  Notation:
- * .    X*       0 or more instances of X
- * .    (X | Y)  either X or Y.
- * .    X..Y     any character from X up to Y, inclusive.
- * .    S - T    characters in S, except those in T
- * 
+ * X* 0 or more instances of X + * (X | Y) either X or Y. + * X..Y any character from X up to Y, inclusive. + * S - T characters in S, except those in T + * \code + * /pre> * The first subpattern is for positive numbers. The second (optional) * subpattern is used for negative numbers. (In both cases, ',' can * occur inside the integer portion--it is just too messy to indicate @@ -124,22 +128,24 @@ class DigitList; * Here are the special characters used in the parts of the * subpattern, with notes on their usage. *
- * .    Symbol   Meaning
- * .      0      a digit, showing up a zero if it is zero
- * .      #      a digit, supressed if zero
- * .      .      placeholder for decimal separator
- * .      ,      placeholder for grouping separator.
- * .      E      separates mantissa and exponent for exponential formats.
- * .      ;      separates formats.
- * .      -      default negative prefix.
- * .      %      multiply by 100 and show as percentage
- * .      \u2030 multiply by 1000 and show as per mille
- * .      \u00A4 currency sign; replaced by currency symbol; if
- * .             doubled, replaced by international currency symbol.
- * .             If present in a pattern, the monetary decimal separator
- * .             is used instead of the decimal separator.
- * .      X      any other characters can be used in the prefix or suffix
- * .      '      used to quote special characters in a prefix or suffix.
+ * \code
+ *     Symbol   Meaning
+ *       0      a digit, showing up a zero if it is zero
+ *       #      a digit, supressed if zero
+ *       .      placeholder for decimal separator
+ *       ,      placeholder for grouping separator.
+ *       E      separates mantissa and exponent for exponential formats.
+ *       ;      separates formats.
+ *       -      default negative prefix.
+ *       %      multiply by 100 and show as percentage
+ *       \u2030 multiply by 1000 and show as per mille
+ *       \u00A4 currency sign; replaced by currency symbol; if
+ *              doubled, replaced by international currency symbol.
+ *              If present in a pattern, the monetary decimal separator
+ *              is used instead of the decimal separator.
+ *       X      any other characters can be used in the prefix or suffix
+ *       '      used to quote special characters in a prefix or suffix.
+ * \endcode
  * 
* [Notes] *

diff --git a/icu4c/source/i18n/unicode/fieldpos.h b/icu4c/source/i18n/unicode/fieldpos.h index e57ec3c6aa9..38c26983acf 100644 --- a/icu4c/source/i18n/unicode/fieldpos.h +++ b/icu4c/source/i18n/unicode/fieldpos.h @@ -49,40 +49,44 @@ * alignment of an array of formatted floating-point numbers on * their decimal points: *

- * .      double doubleNum[] = {123456789.0, -12345678.9, 1234567.89, -123456.789,
- * .                 12345.6789, -1234.56789, 123.456789, -12.3456789, 1.23456789};
- * .      int dNumSize = (int)(sizeof(doubleNum)/sizeof(double));
- * .      
- * .      UErrorCode status = U_ZERO_ERROR;
- * .      DecimalFormat* fmt = (DecimalFormat*) NumberFormat::createInstance(status);
- * .      fmt->setDecimalSeparatorAlwaysShown(true);
- * .      
- * .      const int tempLen = 20;
- * .      char temp[tempLen];
- * .      
- * .      for (int i=0; i<dNumSize; i++) {
- * .          FieldPosition pos(NumberFormat::INTEGER_FIELD);
- * .          UnicodeString buf;
- * .          char fmtText[tempLen];
- * .          ToCharString(fmt->format(doubleNum[i], buf, pos), fmtText);
- * .          for (int j=0; j<tempLen; j++) temp[j] = ' '; // clear with spaces
- * .          temp[__min(tempLen, tempLen-pos.getEndIndex())] = '\0';
- * .          cout << temp << fmtText   << endl;
- * .      }
- * .      delete fmt;
+ * \code
+ *       double doubleNum[] = {123456789.0, -12345678.9, 1234567.89, -123456.789,
+ *                  12345.6789, -1234.56789, 123.456789, -12.3456789, 1.23456789};
+ *       int dNumSize = (int)(sizeof(doubleNum)/sizeof(double));
+ *       
+ *       UErrorCode status = U_ZERO_ERROR;
+ *       DecimalFormat* fmt = (DecimalFormat*) NumberFormat::createInstance(status);
+ *       fmt->setDecimalSeparatorAlwaysShown(true);
+ *       
+ *       const int tempLen = 20;
+ *       char temp[tempLen];
+ *       
+ *       for (int i=0; i<dNumSize; i++) {
+ *           FieldPosition pos(NumberFormat::INTEGER_FIELD);
+ *           UnicodeString buf;
+ *           char fmtText[tempLen];
+ *           ToCharString(fmt->format(doubleNum[i], buf, pos), fmtText);
+ *           for (int j=0; j<tempLen; j++) temp[j] = ' '; // clear with spaces
+ *           temp[__min(tempLen, tempLen-pos.getEndIndex())] = '\0';
+ *           cout << temp << fmtText   << endl;
+ *       }
+ *       delete fmt;
+ * \endcode
  * 
*

* The code will generate the following output: *

- * .          123,456,789.000
- * .          -12,345,678.900
- * .            1,234,567.880
- * .             -123,456.789
- * .               12,345.678
- * .               -1,234.567
- * .                  123.456
- * .                  -12.345
- * .                    1.234
+ * \code
+ *           123,456,789.000
+ *           -12,345,678.900
+ *             1,234,567.880
+ *              -123,456.789
+ *                12,345.678
+ *                -1,234.567
+ *                   123.456
+ *                   -12.345
+ *                     1.234
+ *  \endcode
  * 
*/ class U_I18N_API FieldPosition { diff --git a/icu4c/source/i18n/unicode/format.h b/icu4c/source/i18n/unicode/format.h index 352cbf8f92b..87a90dacd04 100644 --- a/icu4c/source/i18n/unicode/format.h +++ b/icu4c/source/i18n/unicode/format.h @@ -76,7 +76,9 @@ * [Subclassing.] All base classes that provide static functions that * create objects for Locales must implement the following static: *
- * .      public static const Locale* getAvailableLocales(long&)
+ * \code
+ *       public static const Locale* getAvailableLocales(long&)
+ * \endcode
  * 
*/ class U_I18N_API Format { diff --git a/icu4c/source/i18n/unicode/gregocal.h b/icu4c/source/i18n/unicode/gregocal.h index 886df669d10..8b8a1d81898 100644 --- a/icu4c/source/i18n/unicode/gregocal.h +++ b/icu4c/source/i18n/unicode/gregocal.h @@ -59,74 +59,75 @@ * *

Example for using GregorianCalendar: *

- * .    // get the supported ids for GMT-08:00 (Pacific Standard Time)
- * .    int32_t idsCount;
- * .    const UnicodeString** ids = TimeZone::createAvailableIDs(-8 * 60 * 60 * 1000, idsCount);
- * .    // if no ids were returned, something is wrong. get out.
- * .    if (idsCount == 0) {
- * .        return;
- * .    }
- * .
- * .    // begin output
- * .    cout << "Current Time" << endl;
- * .
- * .    // create a Pacific Standard Time time zone
- * .    SimpleTimeZone* pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, *(ids[0]));
- * .    
- * .    // set up rules for daylight savings time
- * .    pdt->setStartRule(Calendar::APRIL, 1, Calendar::SUNDAY, 2 * 60 * 60 * 1000);
- * .    pdt->setEndRule(Calendar::OCTOBER, -1, Calendar::SUNDAY, 2 * 60 * 60 * 1000);
- * .    
- * .    // create a GregorianCalendar with the Pacific Daylight time zone
- * .    // and the current date and time
- * .    UErrorCode success = U_ZERO_ERROR;
- * .    Calendar* calendar = new GregorianCalendar( pdt, success );
- * .    
- * .    // print out a bunch of interesting things
- * .    cout << "ERA: " << calendar->get( Calendar::ERA, success ) << endl;
- * .    cout << "YEAR: " << calendar->get( Calendar::YEAR, success ) << endl;
- * .    cout << "MONTH: " << calendar->get( Calendar::MONTH, success ) << endl;
- * .    cout << "WEEK_OF_YEAR: " << calendar->get( Calendar::WEEK_OF_YEAR, success ) << endl;
- * .    cout << "WEEK_OF_MONTH: " << calendar->get( Calendar::WEEK_OF_MONTH, success ) << endl;
- * .    cout << "DATE: " << calendar->get( Calendar::DATE, success ) << endl;
- * .    cout << "DAY_OF_MONTH: " << calendar->get( Calendar::DAY_OF_MONTH, success ) << endl;
- * .    cout << "DAY_OF_YEAR: " << calendar->get( Calendar::DAY_OF_YEAR, success ) << endl;
- * .    cout << "DAY_OF_WEEK: " << calendar->get( Calendar::DAY_OF_WEEK, success ) << endl;
- * .    cout << "DAY_OF_WEEK_IN_MONTH: " << calendar->get( Calendar::DAY_OF_WEEK_IN_MONTH, success ) << endl;
- * .    cout << "AM_PM: " << calendar->get( Calendar::AM_PM, success ) << endl;
- * .    cout << "HOUR: " << calendar->get( Calendar::HOUR, success ) << endl;
- * .    cout << "HOUR_OF_DAY: " << calendar->get( Calendar::HOUR_OF_DAY, success ) << endl;
- * .    cout << "MINUTE: " << calendar->get( Calendar::MINUTE, success ) << endl;
- * .    cout << "SECOND: " << calendar->get( Calendar::SECOND, success ) << endl;
- * .    cout << "MILLISECOND: " << calendar->get( Calendar::MILLISECOND, success ) << endl;
- * .    cout << "ZONE_OFFSET: " << (calendar->get( Calendar::ZONE_OFFSET, success )/(60*60*1000)) << endl;
- * .    cout << "DST_OFFSET: " << (calendar->get( Calendar::DST_OFFSET, success )/(60*60*1000)) << endl;
- * .
- * .    cout << "Current Time, with hour reset to 3" << endl;
- * .    calendar->clear(Calendar::HOUR_OF_DAY); // so doesn't override
- * .    calendar->set(Calendar::HOUR, 3);
- * .    cout << "ERA: " << calendar->get( Calendar::ERA, success ) << endl;
- * .    cout << "YEAR: " << calendar->get( Calendar::YEAR, success ) << endl;
- * .    cout << "MONTH: " << calendar->get( Calendar::MONTH, success ) << endl;
- * .    cout << "WEEK_OF_YEAR: " << calendar->get( Calendar::WEEK_OF_YEAR, success ) << endl;
- * .    cout << "WEEK_OF_MONTH: " << calendar->get( Calendar::WEEK_OF_MONTH, success ) << endl;
- * .    cout << "DATE: " << calendar->get( Calendar::DATE, success ) << endl;
- * .    cout << "DAY_OF_MONTH: " << calendar->get( Calendar::DAY_OF_MONTH, success ) << endl;
- * .    cout << "DAY_OF_YEAR: " << calendar->get( Calendar::DAY_OF_YEAR, success ) << endl;
- * .    cout << "DAY_OF_WEEK: " << calendar->get( Calendar::DAY_OF_WEEK, success ) << endl;
- * .    cout << "DAY_OF_WEEK_IN_MONTH: " << calendar->get( Calendar::DAY_OF_WEEK_IN_MONTH, success ) << endl;
- * .    cout << "AM_PM: " << calendar->get( Calendar::AM_PM, success ) << endl;
- * .    cout << "HOUR: " << calendar->get( Calendar::HOUR, success ) << endl;
- * .    cout << "HOUR_OF_DAY: " << calendar->get( Calendar::HOUR_OF_DAY, success ) << endl;
- * .    cout << "MINUTE: " << calendar->get( Calendar::MINUTE, success ) << endl;
- * .    cout << "SECOND: " << calendar->get( Calendar::SECOND, success ) << endl;
- * .    cout << "MILLISECOND: " << calendar->get( Calendar::MILLISECOND, success ) << endl;
- * .    cout << "ZONE_OFFSET: " << (calendar->get( Calendar::ZONE_OFFSET, success )/(60*60*1000)) << endl; // in hours
- * .    cout << "DST_OFFSET: " << (calendar->get( Calendar::DST_OFFSET, success )/(60*60*1000)) << endl; // in hours
- * .
- * .    delete[] ids;
- * .    delete calendar; // also deletes pdt
- * .
+ * \code
+ *     // get the supported ids for GMT-08:00 (Pacific Standard Time)
+ *     int32_t idsCount;
+ *     const UnicodeString** ids = TimeZone::createAvailableIDs(-8 * 60 * 60 * 1000, idsCount);
+ *     // if no ids were returned, something is wrong. get out.
+ *     if (idsCount == 0) {
+ *         return;
+ *     }
+ * 
+ *     // begin output
+ *     cout << "Current Time" << endl;
+ * 
+ *     // create a Pacific Standard Time time zone
+ *     SimpleTimeZone* pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, *(ids[0]));
+ *     
+ *     // set up rules for daylight savings time
+ *     pdt->setStartRule(Calendar::APRIL, 1, Calendar::SUNDAY, 2 * 60 * 60 * 1000);
+ *     pdt->setEndRule(Calendar::OCTOBER, -1, Calendar::SUNDAY, 2 * 60 * 60 * 1000);
+ *     
+ *     // create a GregorianCalendar with the Pacific Daylight time zone
+ *     // and the current date and time
+ *     UErrorCode success = U_ZERO_ERROR;
+ *     Calendar* calendar = new GregorianCalendar( pdt, success );
+ *     
+ *     // print out a bunch of interesting things
+ *     cout << "ERA: " << calendar->get( Calendar::ERA, success ) << endl;
+ *     cout << "YEAR: " << calendar->get( Calendar::YEAR, success ) << endl;
+ *     cout << "MONTH: " << calendar->get( Calendar::MONTH, success ) << endl;
+ *     cout << "WEEK_OF_YEAR: " << calendar->get( Calendar::WEEK_OF_YEAR, success ) << endl;
+ *     cout << "WEEK_OF_MONTH: " << calendar->get( Calendar::WEEK_OF_MONTH, success ) << endl;
+ *     cout << "DATE: " << calendar->get( Calendar::DATE, success ) << endl;
+ *     cout << "DAY_OF_MONTH: " << calendar->get( Calendar::DAY_OF_MONTH, success ) << endl;
+ *     cout << "DAY_OF_YEAR: " << calendar->get( Calendar::DAY_OF_YEAR, success ) << endl;
+ *     cout << "DAY_OF_WEEK: " << calendar->get( Calendar::DAY_OF_WEEK, success ) << endl;
+ *     cout << "DAY_OF_WEEK_IN_MONTH: " << calendar->get( Calendar::DAY_OF_WEEK_IN_MONTH, success ) << endl;
+ *     cout << "AM_PM: " << calendar->get( Calendar::AM_PM, success ) << endl;
+ *     cout << "HOUR: " << calendar->get( Calendar::HOUR, success ) << endl;
+ *     cout << "HOUR_OF_DAY: " << calendar->get( Calendar::HOUR_OF_DAY, success ) << endl;
+ *     cout << "MINUTE: " << calendar->get( Calendar::MINUTE, success ) << endl;
+ *     cout << "SECOND: " << calendar->get( Calendar::SECOND, success ) << endl;
+ *     cout << "MILLISECOND: " << calendar->get( Calendar::MILLISECOND, success ) << endl;
+ *     cout << "ZONE_OFFSET: " << (calendar->get( Calendar::ZONE_OFFSET, success )/(60*60*1000)) << endl;
+ *     cout << "DST_OFFSET: " << (calendar->get( Calendar::DST_OFFSET, success )/(60*60*1000)) << endl;
+ * 
+ *     cout << "Current Time, with hour reset to 3" << endl;
+ *     calendar->clear(Calendar::HOUR_OF_DAY); // so doesn't override
+ *     calendar->set(Calendar::HOUR, 3);
+ *     cout << "ERA: " << calendar->get( Calendar::ERA, success ) << endl;
+ *     cout << "YEAR: " << calendar->get( Calendar::YEAR, success ) << endl;
+ *     cout << "MONTH: " << calendar->get( Calendar::MONTH, success ) << endl;
+ *     cout << "WEEK_OF_YEAR: " << calendar->get( Calendar::WEEK_OF_YEAR, success ) << endl;
+ *     cout << "WEEK_OF_MONTH: " << calendar->get( Calendar::WEEK_OF_MONTH, success ) << endl;
+ *     cout << "DATE: " << calendar->get( Calendar::DATE, success ) << endl;
+ *     cout << "DAY_OF_MONTH: " << calendar->get( Calendar::DAY_OF_MONTH, success ) << endl;
+ *     cout << "DAY_OF_YEAR: " << calendar->get( Calendar::DAY_OF_YEAR, success ) << endl;
+ *     cout << "DAY_OF_WEEK: " << calendar->get( Calendar::DAY_OF_WEEK, success ) << endl;
+ *     cout << "DAY_OF_WEEK_IN_MONTH: " << calendar->get( Calendar::DAY_OF_WEEK_IN_MONTH, success ) << endl;
+ *     cout << "AM_PM: " << calendar->get( Calendar::AM_PM, success ) << endl;
+ *     cout << "HOUR: " << calendar->get( Calendar::HOUR, success ) << endl;
+ *     cout << "HOUR_OF_DAY: " << calendar->get( Calendar::HOUR_OF_DAY, success ) << endl;
+ *     cout << "MINUTE: " << calendar->get( Calendar::MINUTE, success ) << endl;
+ *     cout << "SECOND: " << calendar->get( Calendar::SECOND, success ) << endl;
+ *     cout << "MILLISECOND: " << calendar->get( Calendar::MILLISECOND, success ) << endl;
+ *     cout << "ZONE_OFFSET: " << (calendar->get( Calendar::ZONE_OFFSET, success )/(60*60*1000)) << endl; // in hours
+ *     cout << "DST_OFFSET: " << (calendar->get( Calendar::DST_OFFSET, success )/(60*60*1000)) << endl; // in hours
+ * 
+ *     delete[] ids;
+ *     delete calendar; // also deletes pdt
+ * \endcode
  * 
*/ class U_I18N_API GregorianCalendar: public Calendar { diff --git a/icu4c/source/i18n/unicode/msgfmt.h b/icu4c/source/i18n/unicode/msgfmt.h index d5c5c8e572b..2960ec58436 100644 --- a/icu4c/source/i18n/unicode/msgfmt.h +++ b/icu4c/source/i18n/unicode/msgfmt.h @@ -34,74 +34,82 @@ class NumberFormat; * Here are some examples of usage: * Example 1: *
- * .    UErrorCode success = U_ZERO_ERROR;
- * .    GregorianCalendar cal(success);
- * .    Formattable arguments[] = {
- * .        7L,
- * .        Formattable( (Date) cal.getTime(success), Formattable::kIsDate),
- * .        "a disturbance in the Force"
- * .    };
- * .    
- * .    UnicodeString result;
- * .    MessageFormat::format(
- * .         "At {1,time} on {1,date}, there was {2} on planet {0,number}.",
- * .         arguments, 3, result, success );
- * .    
- * .    cout << "result: " << result << endl;
- * .    //<output>: At 4:34:20 PM on 23-Mar-98, there was a disturbance
- * .    //             in the Force on planet 7.
+ * \code
+ *     UErrorCode success = U_ZERO_ERROR;
+ *     GregorianCalendar cal(success);
+ *     Formattable arguments[] = {
+ *         7L,
+ *         Formattable( (Date) cal.getTime(success), Formattable::kIsDate),
+ *         "a disturbance in the Force"
+ *     };
+ *     
+ *     UnicodeString result;
+ *     MessageFormat::format(
+ *          "At {1,time} on {1,date}, there was {2} on planet {0,number}.",
+ *          arguments, 3, result, success );
+ *     
+ *     cout << "result: " << result << endl;
+ *     //<output>: At 4:34:20 PM on 23-Mar-98, there was a disturbance
+ *     //             in the Force on planet 7.
+ * \endcode
  * 
* Typically, the message format will come from resources, and the * arguments will be dynamically set at runtime. *

* Example 2: *

- * .    success = U_ZERO_ERROR;
- * .    Formattable testArgs[] = {3L, "MyDisk"};
- * .   
- * .    MessageFormat* form = new MessageFormat(
- * .        "The disk \"{1}\" contains {0} file(s).", success );
- * .        
- * .    UnicodeString string;
- * .    FieldPosition fpos = 0;
- * .    cout << "format: " << form->format(testArgs, 2, string, fpos, success ) << endl;
- * .
- * .    // output, with different testArgs:
- * .    // output: The disk "MyDisk" contains 0 file(s).
- * .    // output: The disk "MyDisk" contains 1 file(s).
- * .    // output: The disk "MyDisk" contains 1,273 file(s).
- * .    de lete form;
+ *  \code
+ *     success = U_ZERO_ERROR;
+ *     Formattable testArgs[] = {3L, "MyDisk"};
+ *    
+ *     MessageFormat* form = new MessageFormat(
+ *         "The disk \"{1}\" contains {0} file(s).", success );
+ *         
+ *     UnicodeString string;
+ *     FieldPosition fpos = 0;
+ *     cout << "format: " << form->format(testArgs, 2, string, fpos, success ) << endl;
+ * 
+ *     // output, with different testArgs:
+ *     // output: The disk "MyDisk" contains 0 file(s).
+ *     // output: The disk "MyDisk" contains 1 file(s).
+ *     // output: The disk "MyDisk" contains 1,273 file(s).
+ *     delete form;
+ *  \endcode
  *  
* * The pattern is of the following form. Legend: *
- * .      {optional item}
- * .      (group that may be repeated)*
+ * \code
+ *       {optional item}
+ *       (group that may be repeated)*
+ * \endcode
  *  
* Do not confuse optional items with items inside quotes braces, such * as this: "{". Quoted braces are literals. *
- * .      messageFormatPattern := string ( "{" messageFormatElement "}" string )*
- * .       
- * .      messageFormatElement := argument { "," elementFormat }
- * .       
- * .      elementFormat := "time" { "," datetimeStyle }
- * .                     | "date" { "," datetimeStyle }
- * .                     | "number" { "," numberStyle }
- * .                     | "choice" "," choiceStyle
- * .  
- * .      datetimeStyle := "short"
- * .                     | "medium"
- * .                     | "long"
- * .                     | "full"
- * .                     | dateFormatPattern
- * .
- * .      numberStyle :=   "currency"
- * .                     | "percent"
- * .                     | "integer"
- * .                     | numberFormatPattern
- * . 
- * .      choiceStyle :=   choiceFormatPattern
+ *  \code
+ *       messageFormatPattern := string ( "{" messageFormatElement "}" string )*
+ *        
+ *       messageFormatElement := argument { "," elementFormat }
+ *        
+ *       elementFormat := "time" { "," datetimeStyle }
+ *                      | "date" { "," datetimeStyle }
+ *                      | "number" { "," numberStyle }
+ *                      | "choice" "," choiceStyle
+ *   
+ *       datetimeStyle := "short"
+ *                      | "medium"
+ *                      | "long"
+ *                      | "full"
+ *                      | dateFormatPattern
+ * 
+ *       numberStyle :=   "currency"
+ *                      | "percent"
+ *                      | "integer"
+ *                      | numberFormatPattern
+ *  
+ *       choiceStyle :=   choiceFormatPattern
+ * \endcode
  * 
* If there is no elementFormat, then the argument must be a string, * which is substituted. If there is no dateTimeStyle or numberStyle, @@ -130,29 +138,33 @@ class NumberFormat; * For more sophisticated patterns, you can use a ChoiceFormat to get * output such as: *
- * .    UErrorCode success = U_ZERO_ERROR;
- * .    MessageFormat* form = new MessageFormat("The disk \"{1}\" contains {0}.", success);
- * .    double filelimits[] = {0,1,2};
- * .    UnicodeString filepart[] = {"no files","one file","{0,number} files"};
- * .    ChoiceFormat* fileform = new ChoiceFormat(filelimits, filepart, 3);
- * .    form->setFormat(1, *fileform); // NOT zero, see below
- * .    
- * .    Formattable testArgs[] = {1273L, "MyDisk"};
- * .     
- * .    UnicodeString string;
- * .    FieldPosition fpos = 0;
- * .    cout << form->format(testArgs, 2, string, fpos, success) << endl;
- * .    
- * .    // output, with different testArgs
- * .    // output: The disk "MyDisk" contains no files.
- * .    // output: The disk "MyDisk" contains one file.
- * .    // output: The disk "MyDisk" contains 1,273 files.
+ * \code
+ *     UErrorCode success = U_ZERO_ERROR;
+ *     MessageFormat* form = new MessageFormat("The disk \"{1}\" contains {0}.", success);
+ *     double filelimits[] = {0,1,2};
+ *     UnicodeString filepart[] = {"no files","one file","{0,number} files"};
+ *     ChoiceFormat* fileform = new ChoiceFormat(filelimits, filepart, 3);
+ *     form->setFormat(1, *fileform); // NOT zero, see below
+ *     
+ *     Formattable testArgs[] = {1273L, "MyDisk"};
+ *      
+ *     UnicodeString string;
+ *     FieldPosition fpos = 0;
+ *     cout << form->format(testArgs, 2, string, fpos, success) << endl;
+ *     
+ *     // output, with different testArgs
+ *     // output: The disk "MyDisk" contains no files.
+ *     // output: The disk "MyDisk" contains one file.
+ *     // output: The disk "MyDisk" contains 1,273 files.
+ * \endcode
  * 
* You can either do this programmatically, as in the above example, * or by using a pattern (see ChoiceFormat for more information) as in: *
- * .   form->applyPattern(
- * .     "There {0,choice,0#are no files|1#is one file|1<are {0,number,integer} files}.");
+ * \code
+ *    form->applyPattern(
+ *      "There {0,choice,0#are no files|1#is one file|1<are {0,number,integer} files}.");
+ * \endcode
  * 
*

* [Note:] As we see above, the string produced by a ChoiceFormat in @@ -165,11 +177,13 @@ class NumberFormat; * [Note:] Formats are numbered by order of variable in the string. * This is [not] the same as the argument numbering! *

- * .   For example: with "abc{2}def{3}ghi{0}...",
- * .   
- * .   format0 affects the first variable {2}
- * .   format1 affects the second variable {3}
- * .   format2 affects the second variable {0}
+ * \code
+ *    For example: with "abc{2}def{3}ghi{0}...",
+ *    
+ *    format0 affects the first variable {2}
+ *    format1 affects the second variable {3}
+ *    format2 affects the second variable {0}
+ * \endcode
  * 
* and so on. */ diff --git a/icu4c/source/i18n/unicode/numfmt.h b/icu4c/source/i18n/unicode/numfmt.h index d69d090e009..4f325b4190d 100644 --- a/icu4c/source/i18n/unicode/numfmt.h +++ b/icu4c/source/i18n/unicode/numfmt.h @@ -40,40 +40,48 @@ class Locale; * To format a number for the current Locale, use one of the static * factory methods: *
- * .   double myNumber = 7.0;
- * .   UnicodeString myString;
- * .   UErrorCode success = U_ZERO_ERROR;
- * .   NumberFormat* nf = NumberFormat::createInstance(success)
- * .   nf->format(myNumber, myString);
- * .   cout << " Example 1: " << myString << endl;
+ * \code
+ *    double myNumber = 7.0;
+ *    UnicodeString myString;
+ *    UErrorCode success = U_ZERO_ERROR;
+ *    NumberFormat* nf = NumberFormat::createInstance(success)
+ *    nf->format(myNumber, myString);
+ *    cout << " Example 1: " << myString << endl;
+ * \endcode
  * 
* If you are formatting multiple numbers, it is more efficient to get * the format and use it multiple times so that the system doesn't * have to fetch the information about the local language and country * conventions multiple times. *
- * .    UnicodeString myString;
- * .    UErrorCode success = U_ZERO_ERROR;
- * .    nf = NumberFormat::createInstance( success );
- * .    int32_t a[] = { 123, 3333, -1234567 };
- * .    const int32_t a_len = sizeof(a) / sizeof(a[0]);
- * .    myString.remove();
- * .    for (int32_t i = 0; i < a_len; i++) {
- * .        nf->format(a[i], myString);
- * .        myString += " ; ";
- * .    }
- * .    cout << " Example 2: " << myString << endl;
+ * \code 
+ *     UnicodeString myString;
+ *     UErrorCode success = U_ZERO_ERROR;
+ *     nf = NumberFormat::createInstance( success );
+ *     int32_t a[] = { 123, 3333, -1234567 };
+ *     const int32_t a_len = sizeof(a) / sizeof(a[0]);
+ *     myString.remove();
+ *     for (int32_t i = 0; i < a_len; i++) {
+ *         nf->format(a[i], myString);
+ *         myString += " ; ";
+ *     }
+ *     cout << " Example 2: " << myString << endl;
+ * \endcide
  * 
* To format a number for a different Locale, specify it in the * call to createInstance(). *
- * .    nf = NumberFormat::createInstance( Locale::FRENCH, success );
+ * \code
+ *     nf = NumberFormat::createInstance( Locale::FRENCH, success );
+ * \endcode
  * 
* You can use a NumberFormat to parse also. *
- * .   UErrorCode success;
- * .   Formattable result(-999);  // initialized with error code
- * .   nf->parse(myString, result, success);
+ * \code
+ *    UErrorCode success;
+ *    Formattable result(-999);  // initialized with error code
+ *    nf->parse(myString, result, success);
+ * \endcode
  * 
* Use createInstance to get the normal number format for that country. * There are other static factory methods available. Use getCurrency diff --git a/icu4c/source/i18n/unicode/smpdtfmt.h b/icu4c/source/i18n/unicode/smpdtfmt.h index 63df5330a83..8caa340dcc4 100644 --- a/icu4c/source/i18n/unicode/smpdtfmt.h +++ b/icu4c/source/i18n/unicode/smpdtfmt.h @@ -49,30 +49,32 @@ class DateFormat; * pattern, all ASCII letters are reserved as pattern letters, which are defined * as the following: *
- * .   Symbol   Meaning                 Presentation       Example
- * .   ------   -------                 ------------       -------
- * .   G        era designator          (Text)             AD
- * .   y        year                    (Number)           1996
- * .   Y        year/week of year       (Number)           1996
- * .   M        month in year           (Text & Number)    July & 07
- * .   d        day in month            (Number)           10
- * .   h        hour in am/pm (1~12)    (Number)           12
- * .   H        hour in day (0~23)      (Number)           0
- * .   m        minute in hour          (Number)           30
- * .   s        second in minute        (Number)           55
- * .   S        millisecond             (Number)           978
- * .   E        day of week             (Text)             Tuesday
- * .   e        day of week/local (1~7) (Number)           2
- * .   D        day of year             (Number)           189
- * .   F        day of week in month    (Number)           2 (2nd Wed in July)
- * .   w        week in year            (Number)           27
- * .   W        week in month           (Number)           2
- * .   a        am/pm marker            (Text)             PM
- * .   k        hour in day (1~24)      (Number)           24
- * .   K        hour in am/pm (0~11)    (Number)           0
- * .   z        time zone               (Text)             Pacific Standard Time
- * .   '        escape for text
- * .   ''       single quote                               '
+ * \code
+ *    Symbol   Meaning                 Presentation       Example
+ *    ------   -------                 ------------       -------
+ *    G        era designator          (Text)             AD
+ *    y        year                    (Number)           1996
+ *    Y        year/week of year       (Number)           1996
+ *    M        month in year           (Text & Number)    July & 07
+ *    d        day in month            (Number)           10
+ *    h        hour in am/pm (1~12)    (Number)           12
+ *    H        hour in day (0~23)      (Number)           0
+ *    m        minute in hour          (Number)           30
+ *    s        second in minute        (Number)           55
+ *    S        millisecond             (Number)           978
+ *    E        day of week             (Text)             Tuesday
+ *    e        day of week/local (1~7) (Number)           2
+ *    D        day of year             (Number)           189
+ *    F        day of week in month    (Number)           2 (2nd Wed in July)
+ *    w        week in year            (Number)           27
+ *    W        week in month           (Number)           2
+ *    a        am/pm marker            (Text)             PM
+ *    k        hour in day (1~24)      (Number)           24
+ *    K        hour in am/pm (0~11)    (Number)           0
+ *    z        time zone               (Text)             Pacific Standard Time
+ *    '        escape for text
+ *    ''       single quote                               '
+ * \endcode
  * 
* The count of pattern letters determine the format. *

@@ -97,35 +99,39 @@ class DateFormat; *

* Examples using the US locale: *

- * .   Format Pattern                         Result
- * .   --------------                         -------
- * .   "yyyy.MM.dd G 'at' HH:mm:ss z"    ->>  1996.07.10 AD at 15:08:56 PDT
- * .   "EEE, MMM d, ''yy"                ->>  Wed, July 10, '96
- * .   "h:mm a"                          ->>  12:08 PM
- * .   "hh 'o''clock' a, zzzz"           ->>  12 o'clock PM, Pacific Daylight Time
- * .   "K:mm a, z"                       ->>  0:00 PM, PST
- * .   "yyyyy.MMMMM.dd GGG hh:mm aaa"    ->>  1996.July.10 AD 12:08 PM
+ * \code
+ *    Format Pattern                         Result
+ *    --------------                         -------
+ *    "yyyy.MM.dd G 'at' HH:mm:ss z"    ->>  1996.07.10 AD at 15:08:56 PDT
+ *    "EEE, MMM d, ''yy"                ->>  Wed, July 10, '96
+ *    "h:mm a"                          ->>  12:08 PM
+ *    "hh 'o''clock' a, zzzz"           ->>  12 o'clock PM, Pacific Daylight Time
+ *    "K:mm a, z"                       ->>  0:00 PM, PST
+ *    "yyyyy.MMMMM.dd GGG hh:mm aaa"    ->>  1996.July.10 AD 12:08 PM
+ * \endcode
  * 
* Code Sample: *
- * .    UErrorCode success = U_ZERO_ERROR;
- * .    SimpleTimeZone* pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, "PST");
- * .    pdt->setStartRule( Calendar::APRIL, 1, Calendar::SUNDAY, 2*60*60*1000);
- * .    pdt->setEndRule( Calendar::OCTOBER, -1, Calendar::SUNDAY, 2*60*60*1000);
- * .    
- * .    // Format the current time.
- * .    SimpleDateFormat* formatter
- * .        = new SimpleDateFormat ("yyyy.MM.dd G 'at' hh:mm:ss a zzz", success );
- * .    GregorianCalendar cal(success);
- * .    UDate currentTime_1 = cal.getTime(success);
- * .    FieldPosition fp(0);
- * .    UnicodeString dateString;
- * .    formatter->format( currentTime_1, dateString, fp );
- * .    cout << "result: " << dateString << endl;
- * .    
- * .    // Parse the previous string back into a Date.
- * .    ParsePosition pp(0);
- * .    UDate currentTime_2 = formatter->parse(dateString, pp );
+ * \code
+ *     UErrorCode success = U_ZERO_ERROR;
+ *     SimpleTimeZone* pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, "PST");
+ *     pdt->setStartRule( Calendar::APRIL, 1, Calendar::SUNDAY, 2*60*60*1000);
+ *     pdt->setEndRule( Calendar::OCTOBER, -1, Calendar::SUNDAY, 2*60*60*1000);
+ *     
+ *     // Format the current time.
+ *     SimpleDateFormat* formatter
+ *         = new SimpleDateFormat ("yyyy.MM.dd G 'at' hh:mm:ss a zzz", success );
+ *     GregorianCalendar cal(success);
+ *     UDate currentTime_1 = cal.getTime(success);
+ *     FieldPosition fp(0);
+ *     UnicodeString dateString;
+ *     formatter->format( currentTime_1, dateString, fp );
+ *     cout << "result: " << dateString << endl;
+ *     
+ *     // Parse the previous string back into a Date.
+ *     ParsePosition pp(0);
+ *     UDate currentTime_2 = formatter->parse(dateString, pp );
+ * \endcode
  * 
* In the above example, the time value "currentTime_2" obtained from parsing * will be equal to currentTime_1. However, they may not be equal if the am/pm diff --git a/icu4c/source/i18n/unicode/sortkey.h b/icu4c/source/i18n/unicode/sortkey.h index 99ef7978c51..a06983939e5 100644 --- a/icu4c/source/i18n/unicode/sortkey.h +++ b/icu4c/source/i18n/unicode/sortkey.h @@ -49,19 +49,21 @@ class RuleBasedCollator; * *

Example of use: *

- * .    UErrorCode success = U_ZERO_ERROR;
- * .    Collator* myCollator = Collator::createInstance(success);
- * .    CollationKey* keys = new CollationKey [3];
- * .    myCollator->getCollationKey("Tom", keys[0], success );
- * .    myCollator->getCollationKey("Dick", keys[1], success );
- * .    myCollator->getCollationKey("Harry", keys[2], success );
- * . 
- * .    // Inside body of sort routine, compare keys this way:
- * .    CollationKey tmp;
- * .    if(keys[0].compareTo( keys[1] ) > 0 ) {
- * .        tmp = keys[0]; keys[0] = keys[1]; keys[1] = tmp;
- * .    }
- * .    //...
+ * \code
+ *     UErrorCode success = U_ZERO_ERROR;
+ *     Collator* myCollator = Collator::createInstance(success);
+ *     CollationKey* keys = new CollationKey [3];
+ *     myCollator->getCollationKey("Tom", keys[0], success );
+ *     myCollator->getCollationKey("Dick", keys[1], success );
+ *     myCollator->getCollationKey("Harry", keys[2], success );
+ *  
+ *     // Inside body of sort routine, compare keys this way:
+ *     CollationKey tmp;
+ *     if(keys[0].compareTo( keys[1] ) > 0 ) {
+ *         tmp = keys[0]; keys[0] = keys[1]; keys[1] = tmp;
+ *     }
+ *     //...
+ * \endcode
  * 
*

Because Collator::compare()'s algorithm is complex, it is faster to sort * long lists of words by retrieving collation keys with Collator::getCollationKey(). diff --git a/icu4c/source/i18n/unicode/tblcoll.h b/icu4c/source/i18n/unicode/tblcoll.h index 9b220f8d7d3..0c5bf6453df 100644 --- a/icu4c/source/i18n/unicode/tblcoll.h +++ b/icu4c/source/i18n/unicode/tblcoll.h @@ -92,9 +92,11 @@ typedef void * UCollator; *

The collation table is composed of a list of collation rules, where each * rule is of three forms: *

- * .    < modifier >
- * .    < relation > < text-argument >
- * .    < reset > < text-argument >
+ * \code
+ *     
+ *      < text-argument >
+ *      < text-argument >
+ * \endcode
  * 
* The following demonstrates how to create your own collation rules: * * *

* This sounds more complicated than it is in practice. For example, the * following are equivalent ways of expressing the same thing: *

- * .    a < b < c
- * .    a < b & b < c
- * .    a < c & a < b
+ * \code
+ *     a < b < c
+ *     a < b & b  < c
+ *     a < c & a  < b
+ * \endcode
  * 
* Notice that the order is important, as the subsequent item goes immediately * after the text-argument. The following are not equivalent: *
- * .    a < b & a < c
- * .    a < c & a < b
+ * \code
+ *     a <  b & a  < c
+ *     a <  c & a  < b
+ * \endcode
  * 
* Either the text-argument must already be present in the sequence, or some * initial substring of the text-argument must be present. (e.g. "a < b & ae < @@ -172,142 +179,167 @@ typedef void * UCollator; * (e.g. "a < b & e < f") * *
- * .    Examples:
- * .    Simple:     "< a < b < c < d"
- * .    Norwegian:  "< a,A< b,B< c,C< d,D< e,E< f,F< g,G< h,H< i,I< j,J
- * .                 < k,K< l,L< m,M< n,N< o,O< p,P< q,Q< r,R< s,S< t,T
- * .                 < u,U< v,V< w,W< x,X< y,Y< z,Z
- * .                 < å=a°,Å=A°
- * .                 ;aa,AA< æ,Æ< ø,Ø"
+ * \code
+ *     Examples:
+ *     Simple:     "< a < b < c < d"
+ *     Norwegian:  "< a,A< b,B< c,C< d,D< e,E< f,F< g,G< h,H< i,I< j,J
+ *                  < k,K< l,L< m,M< n,N< o,O< p,P< q,Q< r,R< s,S< t,T
+ *                  < u,U< v,V< w,W< x,X< y,Y< z,Z
+ *                  < å=a°,Å=A°
+ *                  ;aa,AA< æ,Æ< ø,Ø"
+ * \endcode
  * 
*

To create a table-based collation object, simply supply the collation * rules to the RuleBasedCollator contructor. For example: *

- * .    UErrorCode status = U_ZERO_ERROR;
- * .    RuleBasedCollator *mySimple = new RuleBasedCollator(Simple, status);
+ * \code
+ *     UErrorCode status = U_ZERO_ERROR;
+ *     RuleBasedCollator *mySimple = new RuleBasedCollator(Simple, status);
+ * \endcode
  * 
*

Another example: *

- * .    UErrorCode status = U_ZERO_ERROR;
- * .    RuleBasedCollator *myNorwegian = new RuleBasedCollator(Norwegian, status);
+ * \code
+ *     UErrorCode status = U_ZERO_ERROR;
+ *     RuleBasedCollator *myNorwegian = new RuleBasedCollator(Norwegian, status);
+ * \endcode
  * 
* To add rules on top of an existing table, simply supply the orginal rules * and modifications to RuleBasedCollator constructor. For example, *
- * .     Traditional Spanish (fragment): ... & C < ch , cH , Ch , CH ...
- * .     German (fragment) : ...< y , Y < z , Z
- * .                         & AE, Ä & AE, ä 
- * .                         & OE , Ö & OE, ö 
- * .                         & UE , Ü & UE, ü 
- * .     Symbols (fragment): ...< y, Y < z , Z
- * .                         & Question-mark ; '?'
- * .                         & Ampersand ; '&'
- * .                         & Dollar-sign ; '$'
+ * \code
+ *      Traditional Spanish (fragment): ... & C < ch , cH , Ch , CH ...
+ *      German (fragment) : ...< y , Y < z , Z
+ *                          & AE, Ä & AE, ä
+ *                          & OE , Ö & OE, ö
+ *                          & UE , Ü & UE, ü
+ *      Symbols (fragment): ...< y, Y < z , Z
+ *                          & Question-mark ; '?'
+ *                          & Ampersand ; '&'
+ *                          & Dollar-sign ; '$'
+ * \endcode
+ * 
*

To create a collation object for traditional Spanish, the user can take * the English collation rules and add the additional rules to the table. * For example: *

- * .     UErrorCode status = U_ZERO_ERROR;
- * .     UnicodeString rules(DEFAULTRULES);
- * .     rules += "& C < ch, cH, Ch, CH";
- * .     RuleBasedCollator *mySpanish = new RuleBasedCollator(rules, status);
+ * \code
+ *      UErrorCode status = U_ZERO_ERROR;
+ *      UnicodeString rules(DEFAULTRULES);
+ *      rules += "& C < ch, cH, Ch, CH";
+ *      RuleBasedCollator *mySpanish = new RuleBasedCollator(rules, status);
+ * \endcode
  * 
*

In order to sort symbols in the similiar order of sorting their * alphabetic equivalents, you can do the following, *

- * .     UErrorCode status = U_ZERO_ERROR;
- * .     UnicodeString rules(DEFAULTRULES);
- * .     rules += "& Question-mark ; '?' & Ampersand ; '&' & Dollar-sign ; '$' ";
- * .     RuleBasedCollator *myTable = new RuleBasedCollator(rules, status);
+ * \code
+ *      UErrorCode status = U_ZERO_ERROR;
+ *      UnicodeString rules(DEFAULTRULES);
+ *      rules += "& Question-mark ; '?' & Ampersand ; '&' & Dollar-sign ; '$' ";
+ *      RuleBasedCollator *myTable = new RuleBasedCollator(rules, status);
+ * \endcode
  * 
*

Another way of creating the table-based collation object, mySimple, * is: *

- * .     UErrorCode status = U_ZERO_ERROR;
- * .     RuleBasedCollator *mySimple = new
- * .           RuleBasedCollator(" < a < b & b < c & c < d", status);
+ * \code
+ *      UErrorCode status = U_ZERO_ERROR;
+ *      RuleBasedCollator *mySimple = new
+ *            RuleBasedCollator(" < a < b & b < c & c < d", status);
+ * \endcode
  * 
* Or, *
- * .     UErrorCode status = U_ZERO_ERROR;
- * .     RuleBasedCollator *mySimple = new
- * .           RuleBasedCollator(" < a < b < d & b < c", status);
+ * \code
+ *      UErrorCode status = U_ZERO_ERROR;
+ *      RuleBasedCollator *mySimple = new
+ *            RuleBasedCollator(" < a < b < d & b < c", status);
+ * \endcode
  * 
* Because " < a < b < c < d" is the same as "a < b < d & b < c" or * "< a < b & b < c & c < d". * *

To combine collations from two locales, (without error handling for clarity) *

- * .    // Create an en_US Collator object
- * .    Locale locale_en_US("en", "US", "");
- * .    RuleBasedCollator* en_USCollator = (RuleBasedCollator*)
- * .        Collator::createInstance( locale_en_US, success );
- * .
- * .    // Create a da_DK Collator object
- * .    Locale locale_da_DK("da", "DK", "");
- * .    RuleBasedCollator* da_DKCollator = (RuleBasedCollator*)
- * .        Collator::createInstance( locale_da_DK, success );
- * .
- * .    // Combine the two
- * .    // First, get the collation rules from en_USCollator
- * .    UnicodeString rules = en_USCollator->getRules();
- * .    // Second, get the collation rules from da_DKCollator
- * .    rules += da_DKCollator->getRules();
- * .    RuleBasedCollator* newCollator = new RuleBasedCollator( rules, success );
- * .    // newCollator has the combined rules
+ * \code
+ *     // Create an en_US Collator object
+ *     Locale locale_en_US("en", "US", "");
+ *     RuleBasedCollator* en_USCollator = (RuleBasedCollator*)
+ *         Collator::createInstance( locale_en_US, success );
+ * 
+ *     // Create a da_DK Collator object
+ *     Locale locale_da_DK("da", "DK", "");
+ *     RuleBasedCollator* da_DKCollator = (RuleBasedCollator*)
+ *         Collator::createInstance( locale_da_DK, success );
+ * 
+ *     // Combine the two
+ *     // First, get the collation rules from en_USCollator
+ *     UnicodeString rules = en_USCollator->getRules();
+ *     // Second, get the collation rules from da_DKCollator
+ *     rules += da_DKCollator->getRules();
+ *     RuleBasedCollator* newCollator = new RuleBasedCollator( rules, success );
+ *     // newCollator has the combined rules
+ * \endcode
  * 
*

Another more interesting example would be to make changes on an existing * table to create a new collation object. For example, add * "& C < ch, cH, Ch, CH" to the en_USCollation object to create your own * English collation object, *

- * .    // Create a new Collator object with additional rules
- * .    rules = en_USCollator->getRules();
- * .    rules += "& C < ch, cH, Ch, CH";
- * .    RuleBasedCollator* myCollator = new RuleBasedCollator( rules, success );
- * .    // myCollator contains the new rules
+ * \code
+ *     // Create a new Collator object with additional rules
+ *     rules = en_USCollator->getRules();
+ *     rules += "& C < ch, cH, Ch, CH";
+ *     RuleBasedCollator* myCollator = new RuleBasedCollator( rules, success );
+ *     // myCollator contains the new rules
+ * \endcode
  * 
* *

The following example demonstrates how to change the order of * non-spacing accents, *

- * .     UChar contents[] = {
- * .         '=', 0x0301, ';', 0x0300, ';', 0x0302,
- * .         ';', 0x0308, ';', 0x0327, ',', 0x0303,    // main accents
- * .         ';', 0x0304, ';', 0x0305, ';', 0x0306,    // main accents
- * .         ';', 0x0307, ';', 0x0309, ';', 0x030A,    // main accents
- * .         ';', 0x030B, ';', 0x030C, ';', 0x030D,    // main accents
- * .         ';', 0x030E, ';', 0x030F, ';', 0x0310,    // main accents
- * .         ';', 0x0311, ';', 0x0312,                 // main accents
- * .         '<', 'a', ',', 'A', ';', 'a', 'e', ',', 'A', 'E',
- * .         ';', 0x00e6, ',', 0x00c6, '<', 'b', ',', 'B',
- * .         '<', 'c', ',', 'C', '<', 'e', ',', 'E', '&', 
- * .         'C', '<', 'd', ',', 'D', 0 };
- * .     UnicodeString oldRules(contents);
- * .     UErrorCode status = U_ZERO_ERROR;
- * .     // change the order of accent characters
- * .     UChar addOn[] = { '&', ',', 0x0300, ';', 0x0308, ';', 0x0302, 0 };
- * .     oldRules += addOn;
- * .     RuleBasedCollator *myCollation = new RuleBasedCollator(oldRules, status);
+ * \code
+ *      UChar contents[] = {
+ *          '=', 0x0301, ';', 0x0300, ';', 0x0302,
+ *          ';', 0x0308, ';', 0x0327, ',', 0x0303,    // main accents
+ *          ';', 0x0304, ';', 0x0305, ';', 0x0306,    // main accents
+ *          ';', 0x0307, ';', 0x0309, ';', 0x030A,    // main accents
+ *          ';', 0x030B, ';', 0x030C, ';', 0x030D,    // main accents
+ *          ';', 0x030E, ';', 0x030F, ';', 0x0310,    // main accents
+ *          ';', 0x0311, ';', 0x0312,                 // main accents
+ *          '<', 'a', ',', 'A', ';', 'a', 'e', ',', 'A', 'E',
+ *          ';', 0x00e6, ',', 0x00c6, '<', 'b', ',', 'B',
+ *          '<', 'c', ',', 'C', '<', 'e', ',', 'E', '&', 
+ *          'C', '<', 'd', ',', 'D', 0 };
+ *      UnicodeString oldRules(contents);
+ *      UErrorCode status = U_ZERO_ERROR;
+ *      // change the order of accent characters
+ *      UChar addOn[] = { '&', ',', 0x0300, ';', 0x0308, ';', 0x0302, 0 };
+ *      oldRules += addOn;
+ *      RuleBasedCollator *myCollation = new RuleBasedCollator(oldRules, status);
+ *  \endcode
  * 
* *

The last example shows how to put new primary ordering in before the * default setting. For example, in Japanese collation, you can either sort * English characters before or after Japanese characters, *

- * .     UErrorCode status = U_ZERO_ERROR;
- * .     // get en_US collation rules
- * .     RuleBasedCollator* en_USCollation = 
- * .         (RuleBasedCollator*) Collator::createInstance(Locale::US, status);
- * .     // Always check the error code after each call.
- * .     if (U_FAILURE(status)) return;
- * .     // add a few Japanese character to sort before English characters
- * .     // suppose the last character before the first base letter 'a' in
- * .     // the English collation rule is 0x2212
- * .     UChar jaString[] = { '&', 0x2212, '<', 0x3041, ',', 0x3042, '<', 0x3043, ',', 0x3044, 0 };
- * .     UnicodeString rules( en_USCollation->getRules() );
- * .     rules += jaString;
- * .     RuleBasedCollator *myJapaneseCollation = new RuleBasedCollator(rules, status);
+ * \code
+ *      UErrorCode status = U_ZERO_ERROR;
+ *      // get en_US collation rules
+ *      RuleBasedCollator* en_USCollation = 
+ *          (RuleBasedCollator*) Collator::createInstance(Locale::US, status);
+ *      // Always check the error code after each call.
+ *      if (U_FAILURE(status)) return;
+ *      // add a few Japanese character to sort before English characters
+ *      // suppose the last character before the first base letter 'a' in
+ *      // the English collation rule is 0x2212
+ *      UChar jaString[] = { '&', 0x2212, '<', 0x3041, ',', 0x3042, '<', 0x3043, ',', 0x3044, 0 };
+ *      UnicodeString rules( en_USCollation->getRules() );
+ *      rules += jaString;
+ *      RuleBasedCollator *myJapaneseCollation = new RuleBasedCollator(rules, status);
+ * \endcode
  * 
*

NOTE: Typically, a collation object is created with * Collator::createInstance(). diff --git a/icu4c/source/i18n/unicode/ubrk.h b/icu4c/source/i18n/unicode/ubrk.h index 8228081cdbb..ed9af274441 100644 --- a/icu4c/source/i18n/unicode/ubrk.h +++ b/icu4c/source/i18n/unicode/ubrk.h @@ -8,7 +8,10 @@ #include "unicode/utypes.h" /** - * @name BreakIterator C API + * \file + * \brief Description of BreakIterator C API + * + *

BreakIterator C API

* * The BreakIterator C API defines methods for finding the location * of boundaries in text. Pointer to a UBreakIterator maintain a @@ -44,101 +47,115 @@ *

* Helper function to output text *

- * .   void printTextRange(UChar* str, UTextOffset start, UTextOffset end ) {
- * .        UChar* result;
- * .        UChar* temp;
- * .        const char* res;
- * .        temp=(UChar*)malloc(sizeof(UChar) * ((u_strlen(str)-start)+1));
- * .        result=(UChar*)malloc(sizeof(UChar) * ((end-start)+1));
- * .        u_strcpy(temp, &str[start]);
- * .        u_strncpy(result, temp, end-start);
- * .        res=(char*)malloc(sizeof(char) * (u_strlen(result)+1));
- * .        u_austrcpy(res, result);
- * .        printf("%s\n", res); 
- * .   }
+ * \code
+ *    void printTextRange(UChar* str, UTextOffset start, UTextOffset end ) {
+ *         UChar* result;
+ *         UChar* temp;
+ *         const char* res;
+ *         temp=(UChar*)malloc(sizeof(UChar) * ((u_strlen(str)-start)+1));
+ *         result=(UChar*)malloc(sizeof(UChar) * ((end-start)+1));
+ *         u_strcpy(temp, &str[start]);
+ *         u_strncpy(result, temp, end-start);
+ *         res=(char*)malloc(sizeof(char) * (u_strlen(result)+1));
+ *         u_austrcpy(res, result);
+ *         printf("%s\n", res); 
+ *    }
+ * \endcode
  * 
* Print each element in order: *
- * .   void printEachForward( UBreakIterator* boundary, UChar* str) {
- * .      UTextOffset end;
- * .      UTextOffset start = ubrk_first(boundary);
- * .      for (end = ubrk_next(boundary)); end != UBRK_DONE; start = end, end = ubrk_next(boundary)) {
- * .            printTextRange(str, start, end );
- * .        }
- * .   }
+ * \code
+ *    void printEachForward( UBreakIterator* boundary, UChar* str) {
+ *       UTextOffset end;
+ *       UTextOffset start = ubrk_first(boundary);
+ *       for (end = ubrk_next(boundary)); end != UBRK_DONE; start = end, end = ubrk_next(boundary)) {
+ *             printTextRange(str, start, end );
+ *         }
+ *    }
+ * \endcode
  * 
* Print each element in reverse order: *
- * .   void printEachBackward( UBreakIterator* boundary, UChar* str) {
- * .      UTextOffset start;
- * .      UTextOffset end = ubrk_last(boundary);
- * .      for (start = ubrk_previous(boundary); start != UBRK_DONE;  end = start, start =ubrk_previous(boundary)) {
- * .            printTextRange( str, start, end );
- * .        }
- * .   }
+ * \code
+ *    void printEachBackward( UBreakIterator* boundary, UChar* str) {
+ *       UTextOffset start;
+ *       UTextOffset end = ubrk_last(boundary);
+ *       for (start = ubrk_previous(boundary); start != UBRK_DONE;  end = start, start =ubrk_previous(boundary)) {
+ *             printTextRange( str, start, end );
+ *         }
+ *    }
+ * \endcode
  * 
* Print first element *
- * .   void printFirst(UBreakIterator* boundary, UChar* str) {
- * .       UTextOffset end;
- * .       UTextOffset start = ubrk_first(boundary);
- * .       end = ubrk_next(boundary);
- * .       printTextRange( str, start, end );
- * .   }
+ * \code
+ *    void printFirst(UBreakIterator* boundary, UChar* str) {
+ *        UTextOffset end;
+ *        UTextOffset start = ubrk_first(boundary);
+ *        end = ubrk_next(boundary);
+ *        printTextRange( str, start, end );
+ *    }
+ * \endcode
  * 
* Print last element *
- * .   void printLast(UBreakIterator* boundary, UChar* str) {
- * .       UTextOffset start;
- * .       UTextOffset end = ubrk_last(boundary);
- * .       start = ubrk_previous(boundary);
- * .       printTextRange(str, start, end );
- * .   }
+ * \code
+ *    void printLast(UBreakIterator* boundary, UChar* str) {
+ *        UTextOffset start;
+ *        UTextOffset end = ubrk_last(boundary);
+ *        start = ubrk_previous(boundary);
+ *        printTextRange(str, start, end );
+ *    }
+ * \endcode
  * 
* Print the element at a specified position *
- * .   void printAt(UBreakIterator* boundary, UTextOffset pos , UChar* str) {
- * .       UTextOffset start;
- * .       UTextOffset end = ubrk_following(boundary, pos);
- * .       start = ubrk_previous(boundary);
- * .       printTextRange(str, start, end );
- * .   }
+ * \code
+ *    void printAt(UBreakIterator* boundary, UTextOffset pos , UChar* str) {
+ *        UTextOffset start;
+ *        UTextOffset end = ubrk_following(boundary, pos);
+ *        start = ubrk_previous(boundary);
+ *        printTextRange(str, start, end );
+ *    }
+ * \endcode
  * 
* Creating and using text boundaries *
- * .      void BreakIterator_Example( void ) {
- * .          UBreakIterator* boundary;
- * .          UChar *stringToExamine;
- * .          stringToExamine=(UChar*)malloc(sizeof(UChar) * (strlen("Aaa bbb ccc. Ddd eee fff.")+1) );
- * .          u_uastrcpy(stringToExamine, "Aaa bbb ccc. Ddd eee fff.");
- * .          printf("Examining: "Aaa bbb ccc. Ddd eee fff.");
- * .
- * .          //print each sentence in forward and reverse order
- * .          boundary = ubrk_open(UBRK_SENTENCE, "en_us", stringToExamine, u_strlen(stringToExamine), &status);
- * .          printf("----- forward: -----------\n"); 
- * .          printEachForward(boundary, stringToExamine);
- * .          printf("----- backward: ----------\n");
- * .          printEachBackward(boundary, stringToExamine);
- * .          ubrk_close(boundary);
- * .
- * .          //print each word in order
- * .          boundary = ubrk_open(UBRK_WORD, "en_us", stringToExamine, u_strlen(stringToExamine), &status);
- * .          printf("----- forward: -----------\n"); 
- * .          printEachForward(boundary, stringToExamine);
- * .          printf("----- backward: ----------\n");
- * .          printEachBackward(boundary, stringToExamine);
- * .          //print first element
- * .          printf("----- first: -------------\n");
- * .          printFirst(boundary, stringToExamine);
- * .          //print last element
- * .          printf("----- last: --------------\n");
- * .          printLast(boundary, stringToExamine);
- * .          //print word at charpos 10
- * .          printf("----- at pos 10: ---------\n");
- * .          printAt(boundary, 10 , stringToExamine);
- * .
- * .          ubrk_close(boundary);
- * .      }
+ * \code
+ *       void BreakIterator_Example( void ) {
+ *           UBreakIterator* boundary;
+ *           UChar *stringToExamine;
+ *           stringToExamine=(UChar*)malloc(sizeof(UChar) * (strlen("Aaa bbb ccc. Ddd eee fff.")+1) );
+ *           u_uastrcpy(stringToExamine, "Aaa bbb ccc. Ddd eee fff.");
+ *           printf("Examining: "Aaa bbb ccc. Ddd eee fff.");
+ * 
+ *           //print each sentence in forward and reverse order
+ *           boundary = ubrk_open(UBRK_SENTENCE, "en_us", stringToExamine, u_strlen(stringToExamine), &status);
+ *           printf("----- forward: -----------\n"); 
+ *           printEachForward(boundary, stringToExamine);
+ *           printf("----- backward: ----------\n");
+ *           printEachBackward(boundary, stringToExamine);
+ *           ubrk_close(boundary);
+ * 
+ *           //print each word in order
+ *           boundary = ubrk_open(UBRK_WORD, "en_us", stringToExamine, u_strlen(stringToExamine), &status);
+ *           printf("----- forward: -----------\n"); 
+ *           printEachForward(boundary, stringToExamine);
+ *           printf("----- backward: ----------\n");
+ *           printEachBackward(boundary, stringToExamine);
+ *           //print first element
+ *           printf("----- first: -------------\n");
+ *           printFirst(boundary, stringToExamine);
+ *           //print last element
+ *           printf("----- last: --------------\n");
+ *           printLast(boundary, stringToExamine);
+ *           //print word at charpos 10
+ *           printf("----- at pos 10: ---------\n");
+ *           printAt(boundary, 10 , stringToExamine);
+ * 
+ *           ubrk_close(boundary);
+ *       }
+ * \endcode
  * 
*/ diff --git a/icu4c/source/i18n/unicode/ucal.h b/icu4c/source/i18n/unicode/ucal.h index 1c0fef6c4f3..fec3946d98f 100644 --- a/icu4c/source/i18n/unicode/ucal.h +++ b/icu4c/source/i18n/unicode/ucal.h @@ -8,7 +8,10 @@ #include "unicode/utypes.h" /** - * @name Calendar C API + * \file + * \brief Description of Calendar C API + * + *

Calendar C API

* * UCalendar C API is used for converting between a UDate object * and a set of integer fields such as UCAL_YEAR, UCAL_MONTH, @@ -31,12 +34,14 @@ * calendar to be opened and the timezoneId. *
*
+ * \code
  * UCalendar *caldef;
  * UChar *tzId;
  * UErrorCode status;
  * tzId=(UChar*)malloc(sizeof(UChar) * (strlen("PST") +1) );
  * u_uastrcpy(tzId, "PST");
  * caldef=ucal_open(tzID, u_strlen(tzID), NULL, UCAL_TRADITIONAL, &status);
+ * \endcode
  * 
*
* @@ -67,11 +72,13 @@ * *
*
+ * \code
  * UCAL_MONTH + UCAL_DAY_OF_MONTH
  * UCAL_MONTH + UCAL_WEEK_OF_MONTH + UCAL_DAY_OF_WEEK
  * UCAL_MONTH + UCAL_DAY_OF_WEEK_IN_MONTH + UCAL_DAY_OF_WEEK
  * UCAL_DAY_OF_YEAR
  * UCAL_DAY_OF_WEEK + UCAL_WEEK_OF_YEAR
+ * \endcode
  * 
*
* @@ -79,8 +86,10 @@ * *
*
+ * \code
  * UCAL_HOUR_OF_DAY
  * UCAL_AM_PM + UCAL_HOUR
+ * \endcode
  * 
*
* diff --git a/icu4c/source/i18n/unicode/ucol.h b/icu4c/source/i18n/unicode/ucol.h index f485f6373ff..2452d4331b4 100644 --- a/icu4c/source/i18n/unicode/ucol.h +++ b/icu4c/source/i18n/unicode/ucol.h @@ -10,7 +10,10 @@ #include "unicode/utypes.h" #include "unicode/unorm.h" /** - * @name Collator C API + * \file + * \brief Description of Collator C API + * + *

Collator C API

* * The C API for Collator performs locale-sensitive * String comparison. You use this class to build @@ -29,6 +32,7 @@ * the UCollator for the default locale. *
*
+ * \code
  * // Compare two strings in the default locale
  * UErrorCode success = U_ZERO_ERROR;
  * UCollator* myCollator = ucol_open(NULL, &success);
@@ -40,6 +44,7 @@
  * }else{
  *     printf("abc is greater than or equal to ABC\n");
  * }
+ * \endcode
  * 
*
* @@ -57,6 +62,7 @@ * US English. *
*
+ * \code
  * //Get the Collator for US English and set its strength to UCOL_PRIMARY
  * UErrorCode success = U_ZERO_ERROR;
  * UCollator* usCollator = ucol_open("en_US", &success);
@@ -67,6 +73,7 @@
  * if( u_strcoll(myCollator, source, u_strlen(source), target, u_strlen(target)) == UCOL_EQUAL) {
  *     printf("'abc' and 'ABC' strings are equivalent with strength UCOL_PRIMARY\n");
  * }
+ * \endcode
  * 
*
*

diff --git a/icu4c/source/i18n/unicode/udat.h b/icu4c/source/i18n/unicode/udat.h index 54960a3c24c..507535f4c94 100644 --- a/icu4c/source/i18n/unicode/udat.h +++ b/icu4c/source/i18n/unicode/udat.h @@ -11,7 +11,10 @@ #include "unicode/ucal.h" #include "unicode/unum.h" /** - * @name Date Format C API + * \file + * \brief Description of DateFormat C API + * + *

Date Format C API

* * Date Format C API consists of functions that convert dates and * times from their internal representations to textual form and back again in a @@ -28,52 +31,60 @@ * To format a date for the current Locale with default time and date style, * use one of the static factory methods: *
- * .    UErrorCode status;
- * .    UFieldPosition pos;
- * .    UChar *myString;
- * .    t_int32 myStrlen=0;
- * .    UDateFormat* dfmt = udat_open(UCAL_DEFAULT, UCAL_DEFAULT, NULL, "PST", &status);
- * .    myStrlen = udat_format(dfmt, myDate, NULL, myStrlen, &pos, &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);
- * .    }
+ * \code
+ *     UErrorCode status;
+ *     UFieldPosition pos;
+ *     UChar *myString;
+ *     t_int32 myStrlen=0;
+ *     UDateFormat* dfmt = udat_open(UCAL_DEFAULT, UCAL_DEFAULT, NULL, "PST", &status);
+ *     myStrlen = udat_format(dfmt, myDate, NULL, myStrlen, &pos, &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);
+ *     }
+ * \endcode
  * 
* If you are formatting multiple numbers, it is more efficient to get the * format and use it multiple times so that the system doesn't have to fetch the * information about the local language and country conventions multiple times. *
- * .    t_int32 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);
- * .    for (i = 0; i < 3; ++i) {
- * .		myStrlen = udat_format(df, myDate, NULL, myStrlen, &pos, &status);
- * .		if(status==U_BUFFER_OVERFLOW_ERROR){
- * .			status=U_ZERO_ERROR;
- * .			myString=(UChar*)malloc(sizeof(UChar) * (myStrlen+1) );
- * .			udat_format(df, myDate, myString, myStrlen+1, &pos, &status);
- * .		}
- * .		printf("%s \n", austrdup(myString) ); //austrdup( a function used to convert UChar* to char*)
- * .		free(myString);
- * .    }
+ * \code
+ *     t_int32 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);
+ *     for (i = 0; i < 3; ++i) {
+ * 		myStrlen = udat_format(df, myDate, NULL, myStrlen, &pos, &status);
+ * 		if(status==U_BUFFER_OVERFLOW_ERROR){
+ * 			status=U_ZERO_ERROR;
+ * 			myString=(UChar*)malloc(sizeof(UChar) * (myStrlen+1) );
+ * 			udat_format(df, myDate, myString, myStrlen+1, &pos, &status);
+ * 		}
+ * 		printf("%s \n", austrdup(myString) ); //austrdup( a function used to convert UChar* to char*)
+ * 		free(myString);
+ *     }
+ * \endcode
  * 
* To format a date for a different Locale, specify it in the call to * udat_open() *
- * .       UDateFormat* df = udat_open(UDAT_SHORT, UDAT_SHORT, "fr_FR", "GMT", &status);
+ * \code
+ *        UDateFormat* df = udat_open(UDAT_SHORT, UDAT_SHORT, "fr_FR", "GMT", &status);
+ * \endcode
  * 
* You can use a DateFormat API udat_parse() to parse. *
- * .       UErrorCode status = U_ZERO_ERROR;
- * .       t_int32 parsepos=0;     
- * .       UDate myDate = udat_parse(df, myString, u_strlen(myString), &parsepos, &status);
+ * \code
+ *        UErrorCode status = U_ZERO_ERROR;
+ *        t_int32 parsepos=0;     
+ *        UDate myDate = udat_parse(df, myString, u_strlen(myString), &parsepos, &status);
+ * \endcode
  * 
- * . You can pass in different options for the arguments for date and time style - * . to control the length of the result; from SHORT to MEDIUM to LONG to FULL. - * . The exact result depends on the locale, but generally: - * . see UDateFormatStyle for more details + * You can pass in different options for the arguments for date and time style + * to control the length of the result; from SHORT to MEDIUM to LONG to FULL. + * The exact result depends on the locale, but generally: + * see UDateFormatStyle for more details *