widthfolding.cxx (75272fef) | widthfolding.cxx (4674bdb9) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 35 unchanged lines hidden (view full) --- 44 45/** 46 * Decompose Japanese specific voiced and semi-voiced sound marks. 47 */ 48OUString widthfolding::decompose_ja_voiced_sound_marks (const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, sal_Bool useOffset ) 49{ 50 // Create a string buffer which can hold nCount * 2 + 1 characters. 51 // Its size may become double of nCount. | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 35 unchanged lines hidden (view full) --- 44 45/** 46 * Decompose Japanese specific voiced and semi-voiced sound marks. 47 */ 48OUString widthfolding::decompose_ja_voiced_sound_marks (const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, sal_Bool useOffset ) 49{ 50 // Create a string buffer which can hold nCount * 2 + 1 characters. 51 // Its size may become double of nCount. |
52 rtl_uString * newStr; 53 x_rtl_uString_new_WithLength( &newStr, nCount * 2 ); // defined in x_rtl_ustring.h The reference count is 0 now. | 52 rtl_uString * newStr = x_rtl_uString_new_WithLength( nCount * 2 ); // defined in x_rtl_ustring.h |
54 55 sal_Int32 *p = NULL; 56 sal_Int32 position = 0; 57 if (useOffset) { 58 // Allocate double of nCount length to offset argument. 59 offset.realloc( nCount * 2 ); 60 p = offset.getArray(); 61 position = startPos; --- 27 unchanged lines hidden (view full) --- 89 if (useOffset) 90 *p ++ = position ++; 91 } 92 *dst = (sal_Unicode) 0; 93 94 newStr->length = sal_Int32(dst - newStr->buffer); 95 if (useOffset) 96 offset.realloc(newStr->length); | 53 54 sal_Int32 *p = NULL; 55 sal_Int32 position = 0; 56 if (useOffset) { 57 // Allocate double of nCount length to offset argument. 58 offset.realloc( nCount * 2 ); 59 p = offset.getArray(); 60 position = startPos; --- 27 unchanged lines hidden (view full) --- 88 if (useOffset) 89 *p ++ = position ++; 90 } 91 *dst = (sal_Unicode) 0; 92 93 newStr->length = sal_Int32(dst - newStr->buffer); 94 if (useOffset) 95 offset.realloc(newStr->length); |
97 return OUString( newStr ); // defined in rtl/usrting. The reference count is increased from 0 to 1. | 96 return OUString( newStr, SAL_NO_ACQUIRE ); // take over ownership of <newStr> |
98} 99 100oneToOneMapping& widthfolding::getfull2halfTable(void) 101{ 102 static oneToOneMappingWithFlag table(full2half, sizeof(full2half), FULL2HALF_NORMAL); 103 table.makeIndex(); 104 return table; 105} 106 107/** 108 * Compose Japanese specific voiced and semi-voiced sound marks. 109 */ 110OUString widthfolding::compose_ja_voiced_sound_marks (const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, sal_Bool useOffset, sal_Int32 nFlags ) 111{ 112 // Create a string buffer which can hold nCount + 1 characters. 113 // Its size may become equal to nCount or smaller. | 97} 98 99oneToOneMapping& widthfolding::getfull2halfTable(void) 100{ 101 static oneToOneMappingWithFlag table(full2half, sizeof(full2half), FULL2HALF_NORMAL); 102 table.makeIndex(); 103 return table; 104} 105 106/** 107 * Compose Japanese specific voiced and semi-voiced sound marks. 108 */ 109OUString widthfolding::compose_ja_voiced_sound_marks (const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, sal_Bool useOffset, sal_Int32 nFlags ) 110{ 111 // Create a string buffer which can hold nCount + 1 characters. 112 // Its size may become equal to nCount or smaller. |
114 // The reference count is 0 now. 115 rtl_uString * newStr = x_rtl_uString_new_WithLength( nCount ); // defined in x_rtl_ustring.h | 113 rtl_uString * newStr = x_rtl_uString_new_WithLength( nCount ); // defined in x_rtl_ustring.h |
116 117 // Prepare pointers of unicode character arrays. 118 const sal_Unicode* src = inStr.getStr() + startPos; 119 sal_Unicode* dst = newStr->buffer; 120 121 // This conversion algorithm requires at least one character. 122 if (nCount > 0) { 123 --- 70 unchanged lines hidden (view full) --- 194 } 195 196 *dst = (sal_Unicode) 0; 197 198 newStr->length = sal_Int32(dst - newStr->buffer); 199 } 200 if (useOffset) 201 offset.realloc(newStr->length); | 114 115 // Prepare pointers of unicode character arrays. 116 const sal_Unicode* src = inStr.getStr() + startPos; 117 sal_Unicode* dst = newStr->buffer; 118 119 // This conversion algorithm requires at least one character. 120 if (nCount > 0) { 121 --- 70 unchanged lines hidden (view full) --- 192 } 193 194 *dst = (sal_Unicode) 0; 195 196 newStr->length = sal_Int32(dst - newStr->buffer); 197 } 198 if (useOffset) 199 offset.realloc(newStr->length); |
202 return OUString( newStr ); // defined in rtl/usrting. The reference count is increased from 0 to 1. | 200 return OUString( newStr, SAL_NO_ACQUIRE ); // take over ownership of <newStr> |
203} 204 205oneToOneMapping& widthfolding::gethalf2fullTable(void) 206{ 207 static oneToOneMappingWithFlag table(half2full, sizeof(half2full), HALF2FULL_NORMAL); 208 table.makeIndex(); 209 return table; 210} --- 87 unchanged lines hidden --- | 201} 202 203oneToOneMapping& widthfolding::gethalf2fullTable(void) 204{ 205 static oneToOneMappingWithFlag table(half2full, sizeof(half2full), HALF2FULL_NORMAL); 206 table.makeIndex(); 207 return table; 208} --- 87 unchanged lines hidden --- |