From 8c3169b6dfbd7ef38bcc9bd491135bd034f73fa3 Mon Sep 17 00:00:00 2001
From: Ram Viswanadha
- * void function1(ForwardCharacterIterator &it) {
- * UChar32 c;
- * while(it.hasNext()) {
- * c=it.next32PostInc();
- * // use c
- * }
- * }
+ * \code
+ * void function1(ForwardCharacterIterator &it) {
+ * UChar32 c;
+ * while(it.hasNext()) {
+ * c=it.next32PostInc();
+ * // use c
+ * }
+ * }
*
- * void function1(ForwardCharacterIterator &it) {
- * UChar c;
- * while((c=it.nextPostInc())!=ForwardCharacterIterator::DONE) {
- * // use c
- * }
- * }
- *
Examples for some of the new functions:
* * Forward iteration with hasNext(): - * void forward1(CharacterIterator &it) { - * UChar32 c; - * for(it.setToStart(); it.hasNext();) { - * c=it.next32PostInc(); - * // use c - * } - * } - * + * \code + * void forward1(CharacterIterator &it) { + * UChar32 c; + * for(it.setToStart(); it.hasNext();) { + * c=it.next32PostInc(); + * // use c + * } + * } + * \endcode * Forward iteration more similar to loops with the old forward iteration, * showing a way to convert simple for() loops: - * void forward2(CharacterIterator &it) { - * UChar c; - * for(c=it.firstPostInc(); c!=CharacterIterator::DONE; c=it.nextPostInc()) { - * // use c - * } - * } - * + * \code + * void forward2(CharacterIterator &it) { + * UChar c; + * for(c=it.firstPostInc(); c!=CharacterIterator::DONE; c=it.nextPostInc()) { + * // use c + * } + * } + * \endcode * Backward iteration with setToEnd() and hasPrevious(): - * void backward1(CharacterIterator &it) { - * UChar32 c; - * for(it.setToEnd(); it.hasPrevious();) { - * c=it.previous32(); - * // use c - * } - * } - * + * \code + * void backward1(CharacterIterator &it) { + * UChar32 c; + * for(it.setToEnd(); it.hasPrevious();) { + * c=it.previous32(); + * // use c + * } + * } + * \endcode * Backward iteration with a more traditional for() loop: - * void backward2(CharacterIterator &it) { - * UChar c; - * for(c=it.last(); c!=CharacterIterator::DONE; c=it.previous()) { - * // use c - * } - * } + * \code + * void backward2(CharacterIterator &it) { + * UChar c; + * for(c=it.last(); c!=CharacterIterator::DONE; c=it.previous()) { + * // use c + * } + * } + * \endcode * * Example for random access: - * void random(CharacterIterator &it) { - * // set to the third code point from the beginning - * it.move32(3, CharacterIterator::kStart); - * // get a code point from here without moving the position - * UChar32 c=it.current32(); - * // get the position - * int32_t pos=it.getIndex(); - * // get the previous code unit - * UChar u=it.previous(); - * // move back one more code unit - * it.move(-1, CharacterIterator::kCurrent); - * // set the position back to where it was - * // and read the same code point c and move beyond it - * it.setIndex(pos); - * if(c!=it.next32PostInc()) { - * exit(1); // CharacterIterator inconsistent - * } - * } + * \code + * void random(CharacterIterator &it) { + * // set to the third code point from the beginning + * it.move32(3, CharacterIterator::kStart); + * // get a code point from here without moving the position + * UChar32 c=it.current32(); + * // get the position + * int32_t pos=it.getIndex(); + * // get the previous code unit + * UChar u=it.previous(); + * // move back one more code unit + * it.move(-1, CharacterIterator::kCurrent); + * // set the position back to where it was + * // and read the same code point c and move beyond it + * it.setIndex(pos); + * if(c!=it.next32PostInc()) { + * exit(1); // CharacterIterator inconsistent + * } + * } + * \endcode * *Examples, especially for the old API:
* * Function processing characters, in this example simple output *- * void processChar( UChar c ) - * { - * cout << " " << c; - * } + * \code + * void processChar( UChar c ) + * { + * cout << " " << c; + * } + * \endcode ** Traverse the text from start to finish *
- * void traverseForward(CharacterIterator& iter) - * { - * for(UChar c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) { - * processChar(c); - * } - * } + * \code + * void traverseForward(CharacterIterator& iter) + * { + * for(UChar c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) { + * processChar(c); + * } + * } + * \endcode ** Traverse the text backwards, from end to start *
- * void traverseBackward(CharacterIterator& iter) - * { - * for(UChar c = iter.last(); c != CharacterIterator.DONE; c = iter.previous()) { - * processChar(c); - * } - * } + * \code + * void traverseBackward(CharacterIterator& iter) + * { + * for(UChar c = iter.last(); c != CharacterIterator.DONE; c = iter.previous()) { + * processChar(c); + * } + * } + * \endcode ** Traverse both forward and backward from a given position in the text. * Calls to notBoundary() in this example represents some additional stopping criteria. *
- * void traverseOut(CharacterIterator& iter, UTextOffset pos) - * { - * UChar c; - * for (c = iter.setIndex(pos); - * c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c)); - * c = iter.next()) {} - * UTextOffset end = iter.getIndex(); - * for (c = iter.setIndex(pos); - * c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c)); - * c = iter.previous()) {} - * UTextOffset start = iter.getIndex() + 1; - * - * cout << "start: " << start << " end: " << end << endl; - * for (c = iter.setIndex(start); iter.getIndex() < end; c = iter.next() ) { - * processChar(c); - * } - * } + * \code + * void traverseOut(CharacterIterator& iter, UTextOffset pos) + * { + * UChar c; + * for (c = iter.setIndex(pos); + * c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c)); + * c = iter.next()) {} + * UTextOffset end = iter.getIndex(); + * for (c = iter.setIndex(pos); + * c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c)); + * c = iter.previous()) {} + * UTextOffset start = iter.getIndex() + 1; + * + * cout << "start: " << start << " end: " << end << endl; + * for (c = iter.setIndex(start); iter.getIndex() < end; c = iter.next() ) { + * processChar(c); + * } + * } + * \endcode ** Creating a StringCharacterIterator and calling the test functions *
- * void CharacterIterator_Example( void ) - * { - * cout << endl << "===== CharacterIterator_Example: =====" << endl; - * UnicodeString text("Ein kleiner Satz."); - * StringCharacterIterator iterator(text); - * cout << "----- traverseForward: -----------" << endl; - * traverseForward( iterator ); - * cout << endl << endl << "----- traverseBackward: ----------" << endl; - * traverseBackward( iterator ); - * cout << endl << endl << "----- traverseOut: ---------------" << endl; - * traverseOut( iterator, 7 ); - * cout << endl << endl << "-----" << endl; - * } + * \code + * void CharacterIterator_Example( void ) + * { + * cout << endl << "===== CharacterIterator_Example: =====" << endl; + * UnicodeString text("Ein kleiner Satz."); + * StringCharacterIterator iterator(text); + * cout << "----- traverseForward: -----------" << endl; + * traverseForward( iterator ); + * cout << endl << endl << "----- traverseBackward: ----------" << endl; + * traverseBackward( iterator ); + * cout << endl << endl << "----- traverseOut: ---------------" << endl; + * traverseOut( iterator, 7 ); + * cout << endl << endl << "-----" << endl; + * } + * \endcode **/ class U_COMMON_API CharacterIterator : public ForwardCharacterIterator { diff --git a/icu4c/source/common/unicode/convert.h b/icu4c/source/common/unicode/convert.h index a3a8500d33d..fd16de086f2 100644 --- a/icu4c/source/common/unicode/convert.h +++ b/icu4c/source/common/unicode/convert.h @@ -15,6 +15,15 @@ #include "unicode/unistr.h" #include "unicode/ucnv.h" +/** + * UnicodeConverter is a C++ wrapper class for UConverter. + * You need one UnicodeConverter object in place of one UConverter object. + * For details on the API and implementation of the + * codepage converter iterface see ucnv.h. + * + * @see UConverter + * @stable + */ class U_COMMON_API UnicodeConverter { diff --git a/icu4c/source/common/unicode/normlzr.h b/icu4c/source/common/unicode/normlzr.h index a3b783304ff..32d43d2a12f 100644 --- a/icu4c/source/common/unicode/normlzr.h +++ b/icu4c/source/common/unicode/normlzr.h @@ -28,11 +28,15 @@ class ComposedCharIter; * (A-acute). In Unicode, this can be encoded as a single character (the * "composed" form): *
+ * \code * 00C1 LATIN CAPITAL LETTER A WITH ACUTE+ * \endcode * or as two separate characters (the "decomposed" form): *
+ * \code * 0041 LATIN CAPITAL LETTER A * 0301 COMBINING ACUTE ACCENT+ * \endcode *
* To a user of your program, however, both of these sequences should be * treated as the same "user-level" character "Á". When you are searching or @@ -44,12 +48,16 @@ class ComposedCharIter; *
* Similarly, the string "ffi" can be encoded as three separate letters: *
+ * \code * 0066 LATIN SMALL LETTER F * 0066 LATIN SMALL LETTER F * 0069 LATIN SMALL LETTER I+ * \endcode * or as the single character *
+ * \code * FB03 LATIN SMALL LIGATURE FFI+ * \endcode *
* The ffi ligature is not a distinct semantic character, and strictly speaking * it shouldn't be in Unicode at all, but it was included for compatibility diff --git a/icu4c/source/common/unicode/resbund.h b/icu4c/source/common/unicode/resbund.h index cb325246eb7..0a58139f40a 100644 --- a/icu4c/source/common/unicode/resbund.h +++ b/icu4c/source/common/unicode/resbund.h @@ -70,10 +70,12 @@ struct UHashtable; *
* The resource bundle file is a text (ASCII or Unicode) file with the format: *
- * . locale { - * . tag1 {...} - * . tag2 {...} - * . } + * \code + * locale { + * tag1 {...} + * tag2 {...} + * } + * \endcode ** The tags are used to retrieve the data later. You may not have multiple instances of * the same tag. @@ -91,31 +93,39 @@ struct UHashtable; *
* Solitary strings have the format: *
- * . Tag { Data } + * \code + * Tag { Data } + * \endcode ** This is indistinguishable from a comma-delimited list with only one element, and in * fact may be retrieved as such (as an array, or as element 0 or an array). *
* Comma-delimited lists have the format: *
- * . Tag { Data, Data, Data } + * \code + * Tag { Data, Data, Data } + * \endcode ** Parsing is lenient; a final string, after the last element, is allowed. *
* Tagged lists have the format: *
- * . Tag { Subtag { Data } Subtag {Data} } + * \code + * Tag { Subtag { Data } Subtag {Data} } + * \endcode ** Data is retrieved by specifying the subtag. *
* Two-dimensional arrays have the format: *
- * . TwoD { - * . { r1c1, r1c2, ..., r1cm }, - * . { r2c1, r2c2, ..., r2cm }, - * . ... - * . { rnc1, rnc2, ..., rncm } - * . } + * \code + * TwoD { + * { r1c1, r1c2, ..., r1cm }, + * { r2c1, r2c2, ..., r2cm }, + * ... + * { rnc1, rnc2, ..., rncm } + * } + * \endcode ** where n is the number of rows, and m is the number of columns. Parsing is lenient (as * in other data types). A final comma is always allowed after the last element; either @@ -124,25 +134,31 @@ struct UHashtable; * present, there can only be one comma, no more.) It is possible to have zero columns, * as follows: *
- * . Odd { {} {} {} } // 3 x 0 array + * \code + * Odd { {} {} {} } // 3 x 0 array + * \endcode ** But it is impossible to have zero rows. The smallest array is thus a 1 x 0 array, * which looks like this: *
- * . Smallest { {} } // 1 x 0 array + * \code + * Smallest { {} } // 1 x 0 array + * \endcode ** The array must be strictly rectangular; that is, each row must have the same number * of elements. *
* This is an example for using a possible custom resource: *
- * . Locale currentLocale; - * . UErrorCode success = U_ZERO_ERROR; - * . ResourceBundle myResources("MyResources", currentLocale, success ); - * . - * . UnicodeString button1Title, button2Title; - * . myResources.getString("OkKey", button1Title, success ); - * . myResources.getString("CancelKey", button2Title, success ); + * \code + * Locale currentLocale; + * UErrorCode success = U_ZERO_ERROR; + * ResourceBundle myResources("MyResources", currentLocale, success ); + * + * UnicodeString button1Title, button2Title; + * myResources.getString("OkKey", button1Title, success ); + * myResources.getString("CancelKey", button2Title, success ); + * \endcode ** @draft */ diff --git a/icu4c/source/common/unicode/scsu.h b/icu4c/source/common/unicode/scsu.h index e14b624223e..9f21db15959 100644 --- a/icu4c/source/common/unicode/scsu.h +++ b/icu4c/source/common/unicode/scsu.h @@ -21,6 +21,14 @@ #include "unicode/utypes.h" + +/** + * \file + * \brief Description of Standard Compression for Unicode C API + * + *
*
- * The limit
of a sequence of characters is the position just after their
+ * The "limit" of a sequence of characters is the position just after their
* last character, i.e., one more than that position.
*
- * Some of the API functions provide access to runs
.
- * Such a run
is defined as a sequence of characters
+ * Some of the API functions provide access to "runs".
+ * Such a "run" is defined as a sequence of characters
* that are at the same embedding level
* after performing the BIDI algorithm.
* * @author Markus W. Scherer * @version 1.0 + * + * + *
The basic assumptions are:
+ *+ * \code + *#include "unicode/ubidi.h" + * + *typedef enum { + * styleNormal=0, styleSelected=1, + * styleBold=2, styleItalics=4, + * styleSuper=8, styleSub=16 + *} Style; + * + *typedef struct { UTextOffset limit; Style style; } StyleRun; + * + *int getTextWidth(const UChar *text, UTextOffset start, UTextOffset limit, + * const StyleRun *styleRuns, int styleRunCount); + * + * // set *pLimit and *pStyleRunLimit for a line + * // from text[start] and from styleRuns[styleRunStart] + * // using ubidi_getLogicalRun(para, ...) + *void getLineBreak(const UChar *text, UTextOffset start, UTextOffset *pLimit, + * UBiDi *para, + * const StyleRun *styleRuns, int styleRunStart, int *pStyleRunLimit, + * int *pLineWidth); + * + * // render runs on a line sequentially, always from left to right + * + * // prepare rendering a new line + *void startLine(UBiDiDirection textDirection, int lineWidth); + * + * // render a run of text and advance to the right by the run width + * // the text[start..limit-1] is always in logical order + *void renderRun(const UChar *text, UTextOffset start, UTextOffset limit, + * UBiDiDirection textDirection, Style style); + * + * // We could compute a cross-product + * // from the style runs with the directional runs + * // and then reorder it. + * // Instead, here we iterate over each run type + * // and render the intersections - + * // with shortcuts in simple (and common) cases. + * // renderParagraph() is the main function. + * + * // render a directional run with + * // (possibly) multiple style runs intersecting with it + *void renderDirectionalRun(const UChar *text, + * UTextOffset start, UTextOffset limit, + * UBiDiDirection direction, + * const StyleRun *styleRuns, int styleRunCount) { + * int i; + * + * // iterate over style runs + * if(direction==UBIDI_LTR) { + * int styleLimit; + * + * for(i=0; i*/ -DOCXX_TAG + +/*DOCXX_TAG*/ /*@{*/ /** @@ -552,20 +782,22 @@ ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode); * * Example: *limit) { styleLimit=limit; } + * renderRun(text, start, styleLimit, + * direction, styleRun[i].style); + * if(styleLimit==limit) { break; } + * start=styleLimit; + * } + * } + * } else { + * int styleStart; + * + * for(i=styleRunCount-1; i>=0; --i) { + * if(i>0) { + * styleStart=styleRun[i-1].limit; + * } else { + * styleStart=0; + * } + * if(limit>=styleStart) { + * if(styleStart =length + * + * width=getTextWidth(text, 0, length, styleRuns, styleRunCount); + * if(width<=lineWidth) { + * // everything fits onto one line + * + * // prepare rendering a new line from either left or right + * startLine(paraLevel, width); + * + * renderLine(para, text, 0, length, + * styleRuns, styleRunCount); + * } else { + * UBiDi *line; + * + * // we need to render several lines + * line=ubidi_openSized(length, 0, pErrorCode); + * if(line!=NULL) { + * UTextOffset start=0, limit; + * int styleRunStart=0, styleRunLimit; + * + * for(;;) { + * limit=length; + * styleRunLimit=styleRunCount; + * getLineBreak(text, start, &limit, para, + * styleRuns, styleRunStart, &styleRunLimit, + * &width); + * ubidi_setLine(para, start, limit, line, pErrorCode); + * if(U_SUCCESS(*pErrorCode)) { + * // prepare rendering a new line + * // from either left or right + * startLine(paraLevel, width); + * + * renderLine(line, text, start, limit, + * styleRuns+styleRunStart, + * styleRunLimit-styleRunStart); + * } + * if(limit==length) { break; } + * start=limit; + * styleRunStart=styleRunLimit-1; + * if(start>=styleRuns[styleRunStart].limit) { + * ++styleRunStart; + * } + * } + * + * ubidi_close(line); + * } + * } + * } + * + * ubidi_close(para); + *} + *\endcode + *
- * UTextOffset i, count=ubidi_countRuns(pBiDi), - * logicalStart, visualIndex=0, length; - * for(i=0; i<count; ++i) { - * if(UBIDI_LTR==ubidi_getVisualRun(pBiDi, i, &logicalStart, &length)) { - * do { // LTR - * show_char(text[logicalStart++], visualIndex++); - * } while(--length>0); - * } else { - * logicalStart+=length; // logicalLimit - * do { // RTL - * show_char(text[--logicalStart], visualIndex++); - * } while(--length>0); - * } - * } + * \code + * UTextOffset i, count=ubidi_countRuns(pBiDi), + * logicalStart, visualIndex=0, length; + * for(i=0; i* * Note that in right-to-left runs, code like this places @@ -890,235 +1122,9 @@ ubidi_writeReverse(const UChar *src, int32_t srcLength, UChar *dest, int32_t destSize, uint16_t options, UErrorCode *pErrorCode); +/*#define BIDI_SAMPLE_CODE*/ +/*@}*/ -/** - * @name Sample code for the ICU BIDI API - * - *0); + * } else { + * logicalStart+=length; // logicalLimit + * do { // RTL + * show_char(text[--logicalStart], visualIndex++); + * } while(--length>0); + * } + * } + *\endcode *
The basic assumptions are:
- *- * #include "unicode/ubidi.h" - * - * typedef enum { - * styleNormal=0, styleSelected=1, - * styleBold=2, styleItalics=4, - * styleSuper=8, styleSub=16 - * } Style; - * - * typedef struct { UTextOffset limit; Style style; } StyleRun; - * - * int getTextWidth(const UChar *text, UTextOffset start, UTextOffset limit, - * const StyleRun *styleRuns, int styleRunCount); - * - * // set *pLimit and *pStyleRunLimit for a line - * // from text[start] and from styleRuns[styleRunStart] - * // using ubidi_getLogicalRun(para, ...) - * void getLineBreak(const UChar *text, UTextOffset start, UTextOffset *pLimit, - * UBiDi *para, - * const StyleRun *styleRuns, int styleRunStart, int *pStyleRunLimit, - * int *pLineWidth); - * - * // render runs on a line sequentially, always from left to right - * - * // prepare rendering a new line - * void startLine(UBiDiDirection textDirection, int lineWidth); - * - * // render a run of text and advance to the right by the run width - * // the text[start..limit-1] is always in logical order - * void renderRun(const UChar *text, UTextOffset start, UTextOffset limit, - * UBiDiDirection textDirection, Style style); - * - * // We could compute a cross-product - * // from the style runs with the directional runs - * // and then reorder it. - * // Instead, here we iterate over each run type - * // and render the intersections - - * // with shortcuts in simple (and common) cases. - * // renderParagraph() is the main function. - * - * // render a directional run with - * // (possibly) multiple style runs intersecting with it - * void renderDirectionalRun(const UChar *text, - * UTextOffset start, UTextOffset limit, - * UBiDiDirection direction, - * const StyleRun *styleRuns, int styleRunCount) { - * int i; - * - * // iterate over style runs - * if(direction==UBIDI_LTR) { - * int styleLimit; - * - * for(i=0; i<styleRunCount; ++i) { - * styleLimit=styleRun[i].limit; - * if(start<styleLimit) { - * if(styleLimit>limit) { styleLimit=limit; } - * renderRun(text, start, styleLimit, - * direction, styleRun[i].style); - * if(styleLimit==limit) { break; } - * start=styleLimit; - * } - * } - * } else { - * int styleStart; - * - * for(i=styleRunCount-1; i>=0; --i) { - * if(i>0) { - * styleStart=styleRun[i-1].limit; - * } else { - * styleStart=0; - * } - * if(limit>=styleStart) { - * if(styleStart<start) { styleStart=start; } - * renderRun(text, styleStart, limit, - * direction, styleRun[i].style); - * if(styleStart==start) { break; } - * limit=styleStart; - * } - * } - * } - * } - * - * // the line object represents text[start..limit-1] - * void renderLine(UBiDi *line, const UChar *text, - * UTextOffset start, UTextOffset limit, - * const StyleRun *styleRuns, int styleRunCount) { - * UBiDiDirection direction=ubidi_getDirection(line); - * if(direction!=UBIDI_MIXED) { - * // unidirectional - * if(styleRunCount<=1) { - * renderRun(text, start, limit, direction, styleRuns[0].style); - * } else { - * renderDirectionalRun(text, start, limit, - * direction, styleRuns, styleRunCount); - * } - * } else { - * // mixed-directional - * UTextOffset count, i, length; - * UBiDiLevel level; - * - * count=ubidi_countRuns(para, pErrorCode); - * if(U_SUCCESS(*pErrorCode)) { - * if(styleRunCount<=1) { - * Style style=styleRuns[0].style; - * - * // iterate over directional runs - * for(i=0; i<count; ++i) { - * direction=ubidi_getVisualRun(para, i, &start, &length); - * renderRun(text, start, start+length, direction, style); - * } - * } else { - * UTextOffset j; - * - * // iterate over both directional and style runs - * for(i=0; i<count; ++i) { - * direction=ubidi_getVisualRun(line, i, &start, &length); - * renderDirectionalRun(text, start, start+length, - * direction, styleRuns, styleRunCount); - * } - * } - * } - * } - * } - * - * void renderParagraph(const UChar *text, UTextOffset length, - * UBiDiDirection textDirection, - * const StyleRun *styleRuns, int styleRunCount, - * int lineWidth, - * UErrorCode *pErrorCode) { - * UBiDi *para; - * - * if(pErrorCode==NULL || U_FAILURE(*pErrorCode) || length<=0) { - * return; - * } - * - * para=ubidi_openSized(length, 0, pErrorCode); - * if(para==NULL) { return; } - * - * ubidi_setPara(para, text, length, - * textDirection ? UBIDI_DEFAULT_RTL : UBIDI_DEFAULT_LTR, - * NULL, pErrorCode); - * if(U_SUCCESS(*pErrorCode)) { - * UBiDiLevel paraLevel=1&ubidi_getParaLevel(para); - * StyleRun styleRun={ length, styleNormal }; - * int width; - * - * if(styleRuns==NULL || styleRunCount<=0) { - * styleRunCount=1; - * styleRuns=&styleRun; - * } - * - * // assume styleRuns[styleRunCount-1].limit>=length - * - * width=getTextWidth(text, 0, length, styleRuns, styleRunCount); - * if(width<=lineWidth) { - * // everything fits onto one line - * - * // prepare rendering a new line from either left or right - * startLine(paraLevel, width); - * - * renderLine(para, text, 0, length, - * styleRuns, styleRunCount); - * } else { - * UBiDi *line; - * - * // we need to render several lines - * line=ubidi_openSized(length, 0, pErrorCode); - * if(line!=NULL) { - * UTextOffset start=0, limit; - * int styleRunStart=0, styleRunLimit; - * - * for(;;) { - * limit=length; - * styleRunLimit=styleRunCount; - * getLineBreak(text, start, &limit, para, - * styleRuns, styleRunStart, &styleRunLimit, - * &width); - * ubidi_setLine(para, start, limit, line, pErrorCode); - * if(U_SUCCESS(*pErrorCode)) { - * // prepare rendering a new line - * // from either left or right - * startLine(paraLevel, width); - * - * renderLine(line, text, start, limit, - * styleRuns+styleRunStart, - * styleRunLimit-styleRunStart); - * } - * if(limit==length) { break; } - * start=limit; - * styleRunStart=styleRunLimit-1; - * if(start>=styleRuns[styleRunStart].limit) { - * ++styleRunStart; - * } - * } - * - * ubidi_close(line); - * } - * } - * } - * - * ubidi_close(para); - * } - *- */ -BIDI_SAMPLE_CODE -/*@{*/ /*@}*/ /*@}*/ diff --git a/icu4c/source/common/unicode/uchar.h b/icu4c/source/common/unicode/uchar.h index f0941217bd7..b3725176d41 100644 --- a/icu4c/source/common/unicode/uchar.h +++ b/icu4c/source/common/unicode/uchar.h @@ -30,7 +30,11 @@ #define U_UNICODE_VERSION "3.0.0" /** - * @name The Unicode C API allows you to query the properties associated with individual + * \file + * \brief Description of ICU's Unicode Char C API + * + *
* The Unicode character information, provided implicitly by the diff --git a/icu4c/source/common/unicode/ucnv.h b/icu4c/source/common/unicode/ucnv.h index ba54d8608ec..69094ca380f 100644 --- a/icu4c/source/common/unicode/ucnv.h +++ b/icu4c/source/common/unicode/ucnv.h @@ -16,7 +16,10 @@ */ /** - * @name Character Conversion C API + * \file + * \brief Description of character convrersion C API + * + *
size
field.
*
diff --git a/icu4c/source/common/unicode/uloc.h b/icu4c/source/common/unicode/uloc.h
index 9a1f55d0ea2..bf35381b3e1 100644
--- a/icu4c/source/common/unicode/uloc.h
+++ b/icu4c/source/common/unicode/uloc.h
@@ -24,7 +24,10 @@
#include "unicode/utypes.h"
/**
+ * \file
+ * \brief Description of Locale C API
*
+ * Locale
represents a specific geographical, political,
* or cultural region. An operation that requires a Locale
to perform
* its task is called locale-sensitive and uses the Locale
@@ -38,11 +41,13 @@
* Each of the component is separated by '_' in the locale string.
* ** The first option is a valid ISO @@ -89,7 +94,9 @@ * for the United States: *- * . newLanguage - * . - * . newLanguage + newCountry - * . - * . newLanguage + newCountry + newVariant + * \code + * newLanguage + * + * newLanguage + newCountry + * + * newLanguage + newCountry + newVariant + * \endcode **
** @@ -113,29 +120,33 @@ * *- * . ULOC_US + * \code + * ULOC_US + * \endcode **
** Each of these methods has two variants; one with an explicit locale * and one without; the latter using the default locale. *- * . UErrorCode success = U_ZERO_ERROR; - * . UNumberFormat *nf; - * . const char* myLocale = "fr_FR"; - * . - * . nf = unum_open( UNUM_DEFAULT, NULL, success ); - * . unum_close(nf); - * . nf = unum_open( UNUM_CURRENCY, NULL, success ); - * . unum_close(nf); - * . nf = unum_open( UNUM_PERCENT, NULL, success ); - * . unum_close(nf); + * \code + * UErrorCode success = U_ZERO_ERROR; + * UNumberFormat *nf; + * const char* myLocale = "fr_FR"; + * + * nf = unum_open( UNUM_DEFAULT, NULL, success ); + * unum_close(nf); + * nf = unum_open( UNUM_CURRENCY, NULL, success ); + * unum_close(nf); + * nf = unum_open( UNUM_PERCENT, NULL, success ); + * unum_close(nf); + * \endcode **
** A- * . - * . nf = unum_open( UNUM_DEFAULT, myLocale, success ); - * . unum_close(nf); - * . nf = unum_open( UNUM_CURRENCY, myLocale, success ); - * . unum_close(nf); - * . nf = unum_open( UNUM_PERCENT, myLocale, success ); - * . unum_close(nf); + * \code + * + * nf = unum_open( UNUM_DEFAULT, myLocale, success ); + * unum_close(nf); + * nf = unum_open( UNUM_CURRENCY, myLocale, success ); + * unum_close(nf); + * nf = unum_open( UNUM_PERCENT, myLocale, success ); + * unum_close(nf); + * \endcode **
Locale
is the mechanism for identifying the kind of services
@@ -153,15 +164,17 @@
* three class methods:
* **/ diff --git a/icu4c/source/common/unicode/umachine.h b/icu4c/source/common/unicode/umachine.h index e09c6abc420..40fec38a0d1 100644 --- a/icu4c/source/common/unicode/umachine.h +++ b/icu4c/source/common/unicode/umachine.h @@ -23,6 +23,18 @@ #ifndef __UMACHINE_H__ #define __UMACHINE_H__ +/** + * \file + * \brief Description of basic types and constants for UTF C API + * + *- * . const char* uloc_getAvailable(int32_t index); - * . int32_t uloc_countAvailable(); - * . int32_t - * . uloc_getDisplayName(const char* localeID, - * . const char* inLocaleID, - * . UChar* result, - * . int32_t maxResultSize, - * . UErrorCode* err); - * . + * \code + * const char* uloc_getAvailable(int32_t index); + * int32_t uloc_countAvailable(); + * int32_t + * uloc_getDisplayName(const char* localeID, + * const char* inLocaleID, + * UChar* result, + * int32_t maxResultSize, + * UErrorCode* err); + * + * \endcode **
- * 00C1 LATIN CAPITAL LETTER A WITH ACUTE+ * \code + * 00C1 LATIN CAPITAL LETTER A WITH ACUTE + * \endcode + * * or as two separate characters (the "decomposed" form): *
+ * \code * 0041 LATIN CAPITAL LETTER A * 0301 COMBINING ACUTE ACCENT+ * \endcode *
* To a user of your program, however, both of these sequences should be * treated as the same "user-level" character "Á". When you are searching or @@ -42,12 +50,17 @@ *
* Similarly, the string "ffi" can be encoded as three separate letters: *
+ * \code * 0066 LATIN SMALL LETTER F * 0066 LATIN SMALL LETTER F - * 0069 LATIN SMALL LETTER I+ * 0069 LATIN SMALL LETTER I + * \endcode + * * or as the single character *
+ * \code * FB03 LATIN SMALL LIGATURE FFI+ * \endcode *
* The ffi ligature is not a distinct semantic character, and strictly speaking * it shouldn't be in Unicode at all, but it was included for compatibility diff --git a/icu4c/source/common/unicode/ures.h b/icu4c/source/common/unicode/ures.h index 0710dfad89c..971c1c5ae15 100644 --- a/icu4c/source/common/unicode/ures.h +++ b/icu4c/source/common/unicode/ures.h @@ -26,7 +26,10 @@ #include "unicode/uloc.h" /** - * @name ResourceBundle C API + * \file + * \brief Description of ResourceBundle C API + * + *
* The resource bundle file is a text (ASCII or Unicode) file with the format: *
- * . locale { - * . tag1 {...} - * . tag2 {...} - * . } + * \code + * locale { + * tag1 {...} + * tag2 {...} + * } + * \endcode ** The tags are used to retrieve the data later. You may not have multiple instances of * the same tag. @@ -56,31 +61,39 @@ *
* Solitary strings have the format: *
- * . Tag { Data } + * \code + * Tag { Data } + * \endcode ** This is indistinguishable from a comma-delimited list with only one element, and in * fact may be retrieved as such (as an array, or as element 0 or an array). *
* Comma-delimited lists have the format: *
- * . Tag { Data, Data, Data } + * \code + * Tag { Data, Data, Data } + * \endcode ** Parsing is lenient; a final string, after the last element, is allowed. *
* Tagged lists have the format: *
- * . Tag { Subtag { Data } Subtag {Data} } + * \code + * Tag { Subtag { Data } Subtag {Data} } + * \endcode ** Data is retrieved by specifying the subtag. *
* Two-dimensional arrays have the format: *
- * . TwoD { - * . { r1c1, r1c2, ..., r1cm }, - * . { r2c1, r2c2, ..., r2cm }, - * . ... - * . { rnc1, rnc2, ..., rncm } - * . } + * \code + * TwoD { + * { r1c1, r1c2, ..., r1cm }, + * { r2c1, r2c2, ..., r2cm }, + * ... + * { rnc1, rnc2, ..., rncm } + * } + * \endcode ** where n is the number of rows, and m is the number of columns. Parsing is lenient (as * in other data types). A final comma is always allowed after the last element; either @@ -89,12 +102,16 @@ * present, there can only be one comma, no more.) It is possible to have zero columns, * as follows: *
- * . Odd { {} {} {} } // 3 x 0 array + * \code + * Odd { {} {} {} } // 3 x 0 array + * \endcode ** But it is impossible to have zero rows. The smallest array is thus a 1 x 0 array, * which looks like this: *
- * . Smallest { {} } // 1 x 0 array + * \code + * Smallest { {} } // 1 x 0 array + * \endcode ** The array must be strictly rectangular; that is, each row must have the same number * of elements. @@ -119,8 +136,10 @@ * To use data in resource bundles, following steps are needed:
* 1) opening a bundle for a particular locale: *
+ * \code * UErrorCode status = U_ZERO_ERROR; * UResourceBundle* resB = ures_open("/datadir/resources/GUI", "de_AT_EURO", &status); + * \endcode ** Status allows, besides testing for plain error, to see whether fallback occured. There * are two extra non error values for status after this operation: U_USING_FALLBACK_ERROR, @@ -132,13 +151,15 @@ * * This is an example for using a possible custom resource: *
- * . const char *currentLocale; - * . UErrorCode success = U_ZERO_ERROR; - * . UResourceBundle* myResources=ures_open("MyResources", currentLocale, &success ); - * . - * . UChar *button1Title, *button2Title; - * . button1Title= ures_get(myResources, "OkKey", &success ); - * . button2Title= ures_get(myResources, "CancelKey", &success ); + * \code + * const char *currentLocale; + * UErrorCode success = U_ZERO_ERROR; + * UResourceBundle* myResources=ures_open("MyResources", currentLocale, &success ); + * + * UChar *button1Title, *button2Title; + * button1Title= ures_get(myResources, "OkKey", &success ); + * button2Title= ures_get(myResources, "CancelKey", &success ); + * \endcode **/ diff --git a/icu4c/source/common/unicode/ushape.h b/icu4c/source/common/unicode/ushape.h index c76decf4700..d363e3d58b9 100644 --- a/icu4c/source/common/unicode/ushape.h +++ b/icu4c/source/common/unicode/ushape.h @@ -21,6 +21,12 @@ /* ### TBD: implement letter shaping and remove comment about it missing (jitterbug 471) */ +/** + * \file + * \brief Description of Arabic shaping C API + * + */ + /** * Shape Arabic text on a character basis. * diff --git a/icu4c/source/common/unicode/utf.h b/icu4c/source/common/unicode/utf.h index a3518401147..d4a53df494f 100644 --- a/icu4c/source/common/unicode/utf.h +++ b/icu4c/source/common/unicode/utf.h @@ -12,6 +12,11 @@ * * created on: 1999sep09 * created by: Markus W. Scherer +*/ + +/** +* \file +* \brief Description of UChar and UChar32 data types * * This file defines the UChar and UChar32 data types for Unicode code units * and code points, as well as macros for efficiently getting code points diff --git a/icu4c/source/common/unicode/utf16.h b/icu4c/source/common/unicode/utf16.h index d6bcbe9ea82..08c760277de 100644 --- a/icu4c/source/common/unicode/utf16.h +++ b/icu4c/source/common/unicode/utf16.h @@ -12,7 +12,12 @@ * * created on: 1999sep09 * created by: Markus W. Scherer -* +*/ + +/** +* \file +* \brief Description of UTF-16 macros +* * This file defines macros to deal with UTF-16 code units and code points. * "Safe" macros check for length overruns and illegal sequences, and * also for irregular sequences when the strict option is set. diff --git a/icu4c/source/common/unicode/utf32.h b/icu4c/source/common/unicode/utf32.h index 1e1e339b0e1..87669155cbf 100644 --- a/icu4c/source/common/unicode/utf32.h +++ b/icu4c/source/common/unicode/utf32.h @@ -12,6 +12,10 @@ * * created on: 1999sep20 * created by: Markus W. Scherer +*/ +/** +* \file +* \brief Description of UTF-32 macros * * This file defines macros to deal with UTF-32 code units and code points. * Signatures and semantics are the same as for the similarly named macros diff --git a/icu4c/source/common/unicode/utf8.h b/icu4c/source/common/unicode/utf8.h index 1f6b562aa0d..7850b789ed4 100644 --- a/icu4c/source/common/unicode/utf8.h +++ b/icu4c/source/common/unicode/utf8.h @@ -12,7 +12,12 @@ * * created on: 1999sep13 * created by: Markus W. Scherer -* +*/ + +/** +* \file +* \brief Description of UTF-8 macros +* * This file defines macros to deal with UTF-8 code units and code points. * Signatures and semantics are the same as for the similarly named macros * in utf16.h.