From e1fbed9aa1b4321b71334d9e45977f8c32b9c09c Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Wed, 4 Jun 2003 22:39:17 +0000 Subject: [PATCH] ICU-2969 don't use arraycopy in public header X-SVN-Rev: 12299 --- icu4c/source/layout/LayoutEngine.cpp | 80 +++++++++++++++++++++++++++- icu4c/source/layout/LayoutEngine.h | 76 ++------------------------ 2 files changed, 83 insertions(+), 73 deletions(-) diff --git a/icu4c/source/layout/LayoutEngine.cpp b/icu4c/source/layout/LayoutEngine.cpp index 3b74ee6387e..5861125b442 100644 --- a/icu4c/source/layout/LayoutEngine.cpp +++ b/icu4c/source/layout/LayoutEngine.cpp @@ -114,6 +114,25 @@ void LayoutEngine::getCharIndices(le_int32 charIndices[], le_int32 indexBase, LE } } +void LayoutEngine::getCharIndices(le_int32 charIndices[], LEErrorCode &success) const +{ + if LE_FAILURE(success) { + return; + } + + if (charIndices == NULL) { + success = LE_ILLEGAL_ARGUMENT_ERROR; + return; + } + + if (fCharIndices == NULL) { + success = LE_NO_LAYOUT_ERROR; + return; + } + + LE_ARRAY_COPY(charIndices, fCharIndices, fGlyphCount); +} + // Copy the glyphs into caller's (32-bit) glyph array, OR in extraBits void LayoutEngine::getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const { @@ -136,7 +155,66 @@ void LayoutEngine::getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCod for (i = 0; i < fGlyphCount; i += 1) { glyphs[i] = fGlyphs[i] | extraBits; } -}; +} + +void LayoutEngine::getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const +{ + if (LE_FAILURE(success)) { + return; + } + + if (glyphs == NULL) { + success = LE_ILLEGAL_ARGUMENT_ERROR; + return; + } + + if (fGlyphs == NULL) { + success = LE_NO_LAYOUT_ERROR; + } + + LE_ARRAY_COPY(glyphs, fGlyphs, fGlyphCount); +} + + +void LayoutEngine::getGlyphPositions(float positions[], LEErrorCode &success) const +{ + if LE_FAILURE(success) { + return; + } + + if (positions == NULL) { + success = LE_ILLEGAL_ARGUMENT_ERROR; + return; + } + + if (fPositions == NULL) { + success = LE_NO_LAYOUT_ERROR; + return; + } + + LE_ARRAY_COPY(positions, fPositions, fGlyphCount * 2 + 2); +} + +void LayoutEngine::getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const +{ + if (LE_FAILURE(success)) { + return; + } + + if (glyphIndex > fGlyphCount) { + success = LE_INDEX_OUT_OF_BOUNDS_ERROR; + return; + } + + if (fPositions == NULL) { + success = LE_NO_LAYOUT_ERROR; + return; + } + + x = fPositions[glyphIndex * 2]; + y = fPositions[glyphIndex * 2 + 1]; +} + le_int32 LayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphID *&glyphs, le_int32 *&charIndices, LEErrorCode &success) diff --git a/icu4c/source/layout/LayoutEngine.h b/icu4c/source/layout/LayoutEngine.h index 8e78575e896..a462bea0ddf 100644 --- a/icu4c/source/layout/LayoutEngine.h +++ b/icu4c/source/layout/LayoutEngine.h @@ -351,23 +351,7 @@ public: * * @draft ICU 2.2 */ - void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const - { - if (LE_FAILURE(success)) { - return; - } - - if (glyphs == NULL) { - success = LE_ILLEGAL_ARGUMENT_ERROR; - return; - } - - if (fGlyphs == NULL) { - success = LE_NO_LAYOUT_ERROR; - } - - LE_ARRAY_COPY(glyphs, fGlyphs, fGlyphCount); - }; + void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const; /** * This method copies the glyph array into a caller supplied array, @@ -393,24 +377,7 @@ public: * * @draft ICU 2.2 */ - void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const - { - if LE_FAILURE(success) { - return; - } - - if (charIndices == NULL) { - success = LE_ILLEGAL_ARGUMENT_ERROR; - return; - } - - if (fCharIndices == NULL) { - success = LE_NO_LAYOUT_ERROR; - return; - } - - LE_ARRAY_COPY(charIndices, fCharIndices, fGlyphCount); - }; + void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const; /** * This method copies the character index array into a caller supplied array. @@ -436,24 +403,7 @@ public: * * @draft ICU 2.2 */ - void getGlyphPositions(float positions[], LEErrorCode &success) const - { - if LE_FAILURE(success) { - return; - } - - if (positions == NULL) { - success = LE_ILLEGAL_ARGUMENT_ERROR; - return; - } - - if (fPositions == NULL) { - success = LE_NO_LAYOUT_ERROR; - return; - } - - LE_ARRAY_COPY(positions, fPositions, fGlyphCount * 2 + 2); - }; + void getGlyphPositions(float positions[], LEErrorCode &success) const; /** * This method returns the X and Y position of the glyph at @@ -469,25 +419,7 @@ public: * * @draft ICU 2.2 */ - void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const - { - if (LE_FAILURE(success)) { - return; - } - - if (glyphIndex > fGlyphCount) { - success = LE_INDEX_OUT_OF_BOUNDS_ERROR; - return; - } - - if (fPositions == NULL) { - success = LE_NO_LAYOUT_ERROR; - return; - } - - x = fPositions[glyphIndex * 2]; - y = fPositions[glyphIndex * 2 + 1]; - }; + void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const; /** * This method frees the glyph, character index and position arrays