ICU-647 Modified documentation for compliance with Doxygen
X-SVN-Rev: 3170
This commit is contained in:
parent
6a7ae623de
commit
8c3169b6df
@ -60,22 +60,23 @@
|
||||
* </ul>
|
||||
*
|
||||
* Example:
|
||||
* <pre>
|
||||
*   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
|
||||
*   }
|
||||
*   }
|
||||
* </pre></p>
|
||||
* void function1(ForwardCharacterIterator &it) {
|
||||
* UChar c;
|
||||
* while((c=it.nextPostInc())!=ForwardCharacterIterator::DONE) {
|
||||
* // use c
|
||||
* }
|
||||
* }
|
||||
* \endcode
|
||||
* </p>
|
||||
*/
|
||||
class U_COMMON_API ForwardCharacterIterator {
|
||||
public:
|
||||
@ -182,123 +183,140 @@ protected:
|
||||
* <p>Examples for some of the new functions:</p>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* <p>Examples, especially for the old API:</p>
|
||||
*
|
||||
* Function processing characters, in this example simple output
|
||||
* <pre>
|
||||
*   void processChar( UChar c )
|
||||
*   {
|
||||
*   cout << " " << c;
|
||||
*   }
|
||||
* \code
|
||||
* void processChar( UChar c )
|
||||
* {
|
||||
* cout << " " << c;
|
||||
* }
|
||||
* \endcode
|
||||
* </pre>
|
||||
* Traverse the text from start to finish
|
||||
* <pre>
|
||||
*   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
|
||||
* </pre>
|
||||
* Traverse the text backwards, from end to start
|
||||
* <pre>
|
||||
*   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
|
||||
* </pre>
|
||||
* Traverse both forward and backward from a given position in the text.
|
||||
* Calls to notBoundary() in this example represents some additional stopping criteria.
|
||||
* <pre>
|
||||
*   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
|
||||
* </pre>
|
||||
* Creating a StringCharacterIterator and calling the test functions
|
||||
* <pre>
|
||||
*   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
|
||||
* </pre>
|
||||
*/
|
||||
class U_COMMON_API CharacterIterator : public ForwardCharacterIterator {
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -28,11 +28,15 @@ class ComposedCharIter;
|
||||
* (A-acute). In Unicode, this can be encoded as a single character (the
|
||||
* "composed" form):
|
||||
* <pre>
|
||||
* \code
|
||||
* 00C1 LATIN CAPITAL LETTER A WITH ACUTE</pre>
|
||||
* \endcode
|
||||
* or as two separate characters (the "decomposed" form):
|
||||
* <pre>
|
||||
* \code
|
||||
* 0041 LATIN CAPITAL LETTER A
|
||||
* 0301 COMBINING ACUTE ACCENT</pre>
|
||||
* \endcode
|
||||
* <p>
|
||||
* 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;
|
||||
* <p>
|
||||
* Similarly, the string "ffi" can be encoded as three separate letters:
|
||||
* <pre>
|
||||
* \code
|
||||
* 0066 LATIN SMALL LETTER F
|
||||
* 0066 LATIN SMALL LETTER F
|
||||
* 0069 LATIN SMALL LETTER I</pre>
|
||||
* \endcode
|
||||
* or as the single character
|
||||
* <pre>
|
||||
* \code
|
||||
* FB03 LATIN SMALL LIGATURE FFI</pre>
|
||||
* \endcode
|
||||
* <p>
|
||||
* 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
|
||||
|
@ -70,10 +70,12 @@ struct UHashtable;
|
||||
* <P>
|
||||
* The resource bundle file is a text (ASCII or Unicode) file with the format:
|
||||
* <pre>
|
||||
* . locale {
|
||||
* . tag1 {...}
|
||||
* . tag2 {...}
|
||||
* . }
|
||||
* \code
|
||||
* locale {
|
||||
* tag1 {...}
|
||||
* tag2 {...}
|
||||
* }
|
||||
* \endcode
|
||||
* </pre>
|
||||
* 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;
|
||||
* <P>
|
||||
* Solitary strings have the format:
|
||||
* <pre>
|
||||
* . Tag { Data }
|
||||
* \code
|
||||
* Tag { Data }
|
||||
* \endcode
|
||||
* </pre>
|
||||
* 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).
|
||||
* <P>
|
||||
* Comma-delimited lists have the format:
|
||||
* <pre>
|
||||
* . Tag { Data, Data, Data }
|
||||
* \code
|
||||
* Tag { Data, Data, Data }
|
||||
* \endcode
|
||||
* </pre>
|
||||
* Parsing is lenient; a final string, after the last element, is allowed.
|
||||
* <P>
|
||||
* Tagged lists have the format:
|
||||
* <pre>
|
||||
* . Tag { Subtag { Data } Subtag {Data} }
|
||||
* \code
|
||||
* Tag { Subtag { Data } Subtag {Data} }
|
||||
* \endcode
|
||||
* </pre>
|
||||
* Data is retrieved by specifying the subtag.
|
||||
* <P>
|
||||
* Two-dimensional arrays have the format:
|
||||
* <pre>
|
||||
* . TwoD {
|
||||
* . { r1c1, r1c2, ..., r1cm },
|
||||
* . { r2c1, r2c2, ..., r2cm },
|
||||
* . ...
|
||||
* . { rnc1, rnc2, ..., rncm }
|
||||
* . }
|
||||
* \code
|
||||
* TwoD {
|
||||
* { r1c1, r1c2, ..., r1cm },
|
||||
* { r2c1, r2c2, ..., r2cm },
|
||||
* ...
|
||||
* { rnc1, rnc2, ..., rncm }
|
||||
* }
|
||||
* \endcode
|
||||
* </pre>
|
||||
* 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:
|
||||
* <pre>
|
||||
* . Odd { {} {} {} } // 3 x 0 array
|
||||
* \code
|
||||
* Odd { {} {} {} } // 3 x 0 array
|
||||
* \endcode
|
||||
* </pre>
|
||||
* But it is impossible to have zero rows. The smallest array is thus a 1 x 0 array,
|
||||
* which looks like this:
|
||||
* <pre>
|
||||
* . Smallest { {} } // 1 x 0 array
|
||||
* \code
|
||||
* Smallest { {} } // 1 x 0 array
|
||||
* \endcode
|
||||
* </pre>
|
||||
* The array must be strictly rectangular; that is, each row must have the same number
|
||||
* of elements.
|
||||
* <P>
|
||||
* This is an example for using a possible custom resource:
|
||||
* <pre>
|
||||
* . 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
|
||||
* </pre>
|
||||
* @draft
|
||||
*/
|
||||
|
@ -21,6 +21,14 @@
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief Description of Standard Compression for Unicode C API
|
||||
*
|
||||
* <h2> Standard Compression for Unicode </h2>
|
||||
*/
|
||||
|
||||
/* Number of windows */
|
||||
#define USCSU_NUM_WINDOWS 8
|
||||
#define USCSU_NUM_STATIC_WINDOWS 8
|
||||
|
@ -31,11 +31,12 @@
|
||||
* The following #define trick allows us to do it all in one file
|
||||
* and still be able to compile it.
|
||||
*/
|
||||
#define DOCXX_TAG
|
||||
#define BIDI_SAMPLE_CODE
|
||||
/*#define DOCXX_TAG*/
|
||||
/*#define BIDI_SAMPLE_CODE*/
|
||||
|
||||
/**
|
||||
* @name BIDI algorithm for ICU
|
||||
*\file
|
||||
* \brief Description of BIDI algorithm for ICU C API
|
||||
*
|
||||
* <h2>BIDI algorithm for ICU</h2>
|
||||
*
|
||||
@ -52,18 +53,247 @@
|
||||
* the function call. Otherwise, the function returns immediately.
|
||||
* After the function call, the value indicates success or failure.<p>
|
||||
*
|
||||
* The <quote>limit</quote> 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.<p>
|
||||
*
|
||||
* Some of the API functions provide access to <quote>runs</quote>.
|
||||
* Such a <quote>run</quote> 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.<p>
|
||||
*
|
||||
* @author Markus W. Scherer
|
||||
* @version 1.0
|
||||
*
|
||||
*
|
||||
* <h4> Sample code for the ICU BIDI API </h4>
|
||||
*
|
||||
* <h5>Rendering a paragraph with the ICU BiDi API</h5>
|
||||
*
|
||||
* This is (hypothetical) sample code that illustrates
|
||||
* how the ICU BiDi API could be used to render a paragraph of text.
|
||||
* Rendering code depends highly on the graphics system,
|
||||
* therefore this sample code must make a lot of assumptions,
|
||||
* which may or may not match any existing graphics system's properties.
|
||||
*
|
||||
* <p>The basic assumptions are:</p>
|
||||
* <ul>
|
||||
* <li>Rendering is done from left to right on a horizontal line.</li>
|
||||
* <li>A run of single-style, unidirectional text can be rendered at once.</li>
|
||||
* <li>Such a run of text is passed to the graphics system with
|
||||
* characters (code units) in logical order.</li>
|
||||
* <li>The line-breaking algorithm is very complicated
|
||||
* and Locale-dependent -
|
||||
* and therefore its implementation omitted from this sample code.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <pre>
|
||||
* \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<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);
|
||||
*}
|
||||
*\endcode
|
||||
* </pre>
|
||||
*/
|
||||
DOCXX_TAG
|
||||
|
||||
/*DOCXX_TAG*/
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
@ -552,20 +782,22 @@ ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode);
|
||||
*
|
||||
* Example:
|
||||
* <pre>
|
||||
* 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<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);
|
||||
* }
|
||||
* }
|
||||
*\endcode
|
||||
* </pre>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* <h2>Rendering a paragraph with the ICU BiDi API</h2>
|
||||
*
|
||||
* This is (hypothetical) sample code that illustrates
|
||||
* how the ICU BiDi API could be used to render a paragraph of text.
|
||||
* Rendering code depends highly on the graphics system,
|
||||
* therefore this sample code must make a lot of assumptions,
|
||||
* which may or may not match any existing graphics system's properties.
|
||||
*
|
||||
* <p>The basic assumptions are:</p>
|
||||
* <ul>
|
||||
* <li>Rendering is done from left to right on a horizontal line.</li>
|
||||
* <li>A run of single-style, unidirectional text can be rendered at once.</li>
|
||||
* <li>Such a run of text is passed to the graphics system with
|
||||
* characters (code units) in logical order.</li>
|
||||
* <li>The line-breaking algorithm is very complicated
|
||||
* and Locale-dependent -
|
||||
* and therefore its implementation omitted from this sample code.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <pre>
|
||||
* #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);
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
BIDI_SAMPLE_CODE
|
||||
/*@{*/
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
@ -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
|
||||
*
|
||||
* <h2> Unicode C API </h2>
|
||||
* The Unicode C API allows you to query the properties associated with individual
|
||||
* Unicode character values.
|
||||
* <p>
|
||||
* The Unicode character information, provided implicitly by the
|
||||
|
@ -16,7 +16,10 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name Character Conversion C API
|
||||
* \file
|
||||
* \brief Description of character convrersion C API
|
||||
*
|
||||
* <h2>Character Conversion C API </h2>
|
||||
*
|
||||
* Character Conversion C API documentation is still under construction.
|
||||
* Please check for updates soon.
|
||||
|
@ -13,7 +13,10 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name Character Conversion C API
|
||||
* \file
|
||||
* \brief Description of callback C API for ICU's codeset conversion library
|
||||
*
|
||||
* <h2> Callback API for ICU's codeset conversion libray </h2>
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -6,7 +6,13 @@
|
||||
*
|
||||
*
|
||||
* ucnv_err.h:
|
||||
* defines error behaviour functions called by T_UConverter_{from,to}Unicode
|
||||
*/
|
||||
/**
|
||||
* \file
|
||||
* \brief Description of UConverter error behavior C API
|
||||
*
|
||||
* <h2> Error Behaviour Fnctions </h2>
|
||||
* Defines error behaviour functions called by T_UConverter_{from,to}Unicode
|
||||
*
|
||||
* These Functions, although public, should NEVER be called directly, they should be used as parameters to
|
||||
* the T_UConverter_setMissing{Char,Unicode}Action API, to set the behaviour of a converter
|
||||
@ -14,7 +20,7 @@
|
||||
*
|
||||
* usage example:
|
||||
*
|
||||
* ...
|
||||
* \code
|
||||
* UErrorCode err = U_ZERO_ERROR;
|
||||
* UConverter* myConverter = T_UConverter_create("ibm-949", &err);
|
||||
*
|
||||
@ -23,7 +29,7 @@
|
||||
* T_UConverter_setMissingUnicodeAction(myConverter, (MissingUnicodeAction)UCNV_FROM_U_CALLBACK_STOP, &err);
|
||||
* T_UConverter_setMissingCharAction(myConverter, (MissingCharAction)UCNV_TO_U_CALLBACK_SUBSTITUTE, &err);
|
||||
* }
|
||||
* ...
|
||||
* \endcode
|
||||
*
|
||||
* The code above tells "myConverter" to stop when it encounters a ILLEGAL/TRUNCATED/INVALID sequences when it is used to
|
||||
* convert from Unicode -> Codepage.
|
||||
|
@ -22,7 +22,10 @@
|
||||
U_CDECL_BEGIN
|
||||
|
||||
/**
|
||||
* Information about data memory.
|
||||
* \file
|
||||
* \brief Descripton of data memory in C API
|
||||
*
|
||||
* <h2>Information about data memory. </h2>
|
||||
* This structure may grow in the future, indicated by the
|
||||
* <code>size</code> field.
|
||||
*
|
||||
|
@ -24,7 +24,10 @@
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief Description of Locale C API
|
||||
*
|
||||
* <h2> ULoc C API for Locale </h2>
|
||||
* A <code>Locale</code> represents a specific geographical, political,
|
||||
* or cultural region. An operation that requires a <code>Locale</code> to perform
|
||||
* its task is called <em>locale-sensitive</em> and uses the <code>Locale</code>
|
||||
@ -38,11 +41,13 @@
|
||||
* Each of the component is separated by '_' in the locale string.
|
||||
* <blockquote>
|
||||
* <pre>
|
||||
* . newLanguage
|
||||
* .
|
||||
* . newLanguage + newCountry
|
||||
* .
|
||||
* . newLanguage + newCountry + newVariant
|
||||
* \code
|
||||
* newLanguage
|
||||
*
|
||||
* newLanguage + newCountry
|
||||
*
|
||||
* newLanguage + newCountry + newVariant
|
||||
* \endcode
|
||||
* </pre>
|
||||
* </blockquote>
|
||||
* The first option is a valid <STRONG>ISO
|
||||
@ -89,7 +94,9 @@
|
||||
* for the United States:
|
||||
* <blockquote>
|
||||
* <pre>
|
||||
* . ULOC_US
|
||||
* \code
|
||||
* ULOC_US
|
||||
* \endcode
|
||||
* </pre>
|
||||
* </blockquote>
|
||||
*
|
||||
@ -113,29 +120,33 @@
|
||||
* </P>
|
||||
* <blockquote>
|
||||
* <pre>
|
||||
* . 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
|
||||
* </pre>
|
||||
* </blockquote>
|
||||
* Each of these methods has two variants; one with an explicit locale
|
||||
* and one without; the latter using the default locale.
|
||||
* <blockquote>
|
||||
* <pre>
|
||||
* .
|
||||
* . 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
|
||||
* </pre>
|
||||
* </blockquote>
|
||||
* A <code>Locale</code> is the mechanism for identifying the kind of services
|
||||
@ -153,15 +164,17 @@
|
||||
* three class methods:
|
||||
* <blockquote>
|
||||
* <pre>
|
||||
* . 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
|
||||
* </pre>
|
||||
* </blockquote>
|
||||
*/
|
||||
|
@ -23,6 +23,18 @@
|
||||
#ifndef __UMACHINE_H__
|
||||
#define __UMACHINE_H__
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief Description of basic types and constants for UTF C API
|
||||
*
|
||||
* <h2> Basic types and constants for UTF </h2>
|
||||
* This file defines basic types and constants for utf.h to be
|
||||
* platform-independent. umachine.h and utf.h are included into
|
||||
* utypes.h to provide all the general definitions for ICU.
|
||||
* All of these definitions used to be in utypes.h before
|
||||
* the UTF-handling macros made this unmaintainable.
|
||||
*
|
||||
*/
|
||||
/*===========================================================================*/
|
||||
/* Include platform-dependent definitions */
|
||||
/* which are contained in the platform-specific file platform.h */
|
||||
|
@ -17,7 +17,12 @@
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
/* This file contains miscellaneous definitions for the C APIs. */
|
||||
/**
|
||||
* \file
|
||||
* \brief Description of misc definitions for C API
|
||||
*
|
||||
* This file contains miscellaneous definitions for the C APIs.
|
||||
*/
|
||||
|
||||
/** A struct representing a range of text containing a specific field
|
||||
* @stable
|
||||
|
@ -13,7 +13,10 @@
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
/**
|
||||
* @name Unicode normalization API
|
||||
* \file
|
||||
* \brief Description of Unicode Normalization C API
|
||||
*
|
||||
* <h2> Unicode normalization API </h2>
|
||||
*
|
||||
* <tt>u_normalize</tt> transforms Unicode text into an equivalent composed or
|
||||
* decomposed form, allowing for easier sorting and searching of text.
|
||||
@ -26,11 +29,16 @@
|
||||
* (A-acute). In Unicode, this can be encoded as a single character (the
|
||||
* "composed" form):
|
||||
* <pre>
|
||||
* 00C1 LATIN CAPITAL LETTER A WITH ACUTE</pre>
|
||||
* \code
|
||||
* 00C1 LATIN CAPITAL LETTER A WITH ACUTE
|
||||
* \endcode
|
||||
* </pre>
|
||||
* or as two separate characters (the "decomposed" form):
|
||||
* <pre>
|
||||
* \code
|
||||
* 0041 LATIN CAPITAL LETTER A
|
||||
* 0301 COMBINING ACUTE ACCENT</pre>
|
||||
* \endcode
|
||||
* <p>
|
||||
* 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 @@
|
||||
* <p>
|
||||
* Similarly, the string "ffi" can be encoded as three separate letters:
|
||||
* <pre>
|
||||
* \code
|
||||
* 0066 LATIN SMALL LETTER F
|
||||
* 0066 LATIN SMALL LETTER F
|
||||
* 0069 LATIN SMALL LETTER I</pre>
|
||||
* 0069 LATIN SMALL LETTER I
|
||||
* \endcode
|
||||
* </pre>
|
||||
* or as the single character
|
||||
* <pre>
|
||||
* \code
|
||||
* FB03 LATIN SMALL LIGATURE FFI</pre>
|
||||
* \endcode
|
||||
* <p>
|
||||
* 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
|
||||
|
@ -26,7 +26,10 @@
|
||||
#include "unicode/uloc.h"
|
||||
|
||||
/**
|
||||
* @name ResourceBundle C API
|
||||
* \file
|
||||
* \brief Description of ResourceBundle C API
|
||||
*
|
||||
* <h2>ResourceBundle C API</h2>
|
||||
*
|
||||
* C API representing a collection of resource information pertaining to a given
|
||||
* locale. A resource bundle provides a way of accessing locale- specific information in
|
||||
@ -35,10 +38,12 @@
|
||||
* <P>
|
||||
* The resource bundle file is a text (ASCII or Unicode) file with the format:
|
||||
* <pre>
|
||||
* . locale {
|
||||
* . tag1 {...}
|
||||
* . tag2 {...}
|
||||
* . }
|
||||
* \code
|
||||
* locale {
|
||||
* tag1 {...}
|
||||
* tag2 {...}
|
||||
* }
|
||||
* \endcode
|
||||
* </pre>
|
||||
* The tags are used to retrieve the data later. You may not have multiple instances of
|
||||
* the same tag.
|
||||
@ -56,31 +61,39 @@
|
||||
* <P>
|
||||
* Solitary strings have the format:
|
||||
* <pre>
|
||||
* . Tag { Data }
|
||||
* \code
|
||||
* Tag { Data }
|
||||
* \endcode
|
||||
* </pre>
|
||||
* 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).
|
||||
* <P>
|
||||
* Comma-delimited lists have the format:
|
||||
* <pre>
|
||||
* . Tag { Data, Data, Data }
|
||||
* \code
|
||||
* Tag { Data, Data, Data }
|
||||
* \endcode
|
||||
* </pre>
|
||||
* Parsing is lenient; a final string, after the last element, is allowed.
|
||||
* <P>
|
||||
* Tagged lists have the format:
|
||||
* <pre>
|
||||
* . Tag { Subtag { Data } Subtag {Data} }
|
||||
* \code
|
||||
* Tag { Subtag { Data } Subtag {Data} }
|
||||
* \endcode
|
||||
* </pre>
|
||||
* Data is retrieved by specifying the subtag.
|
||||
* <P>
|
||||
* Two-dimensional arrays have the format:
|
||||
* <pre>
|
||||
* . TwoD {
|
||||
* . { r1c1, r1c2, ..., r1cm },
|
||||
* . { r2c1, r2c2, ..., r2cm },
|
||||
* . ...
|
||||
* . { rnc1, rnc2, ..., rncm }
|
||||
* . }
|
||||
* \code
|
||||
* TwoD {
|
||||
* { r1c1, r1c2, ..., r1cm },
|
||||
* { r2c1, r2c2, ..., r2cm },
|
||||
* ...
|
||||
* { rnc1, rnc2, ..., rncm }
|
||||
* }
|
||||
* \endcode
|
||||
* </pre>
|
||||
* 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:
|
||||
* <pre>
|
||||
* . Odd { {} {} {} } // 3 x 0 array
|
||||
* \code
|
||||
* Odd { {} {} {} } // 3 x 0 array
|
||||
* \endcode
|
||||
* </pre>
|
||||
* But it is impossible to have zero rows. The smallest array is thus a 1 x 0 array,
|
||||
* which looks like this:
|
||||
* <pre>
|
||||
* . Smallest { {} } // 1 x 0 array
|
||||
* \code
|
||||
* Smallest { {} } // 1 x 0 array
|
||||
* \endcode
|
||||
* </pre>
|
||||
* 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:<P>
|
||||
* 1) opening a bundle for a particular locale:
|
||||
* <pre>
|
||||
* \code
|
||||
* UErrorCode status = U_ZERO_ERROR;
|
||||
* UResourceBundle* resB = ures_open("/datadir/resources/GUI", "de_AT_EURO", &status);
|
||||
* \endcode
|
||||
* </pre>
|
||||
* 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:
|
||||
* <pre>
|
||||
* . 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
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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
|
||||
|
@ -12,6 +12,11 @@
|
||||
*
|
||||
* 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
|
||||
|
@ -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
|
||||
|
@ -12,6 +12,11 @@
|
||||
*
|
||||
* 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
|
||||
|
Loading…
Reference in New Issue
Block a user