Logo Search packages:      
Sourcecode: icu version File versions  Download package

void MessageFormat::copyAndFixQuotes ( const UnicodeString appendTo,
int32_t  start,
int32_t  end,
UnicodeString target 
) [static, private]

Checks the range of the source text to quote the special characters, { and ' and copy to target buffer.

Parameters:
source 
start the text offset to start the process of in the source string
end the text offset to end the process of in the source string
appendTo Output parameter to receive result. Result is appended to existing contents.

Definition at line 1704 of file msgfmt.cpp.

References FALSE, and TRUE.

Referenced by toPattern().

{
    UBool gotLB = FALSE;
    
    for (int32_t i = start; i < end; ++i) {
        UChar ch = source[i];
        if (ch == LEFT_CURLY_BRACE) {
            appendTo += SINGLE_QUOTE;
            appendTo += LEFT_CURLY_BRACE;
            appendTo += SINGLE_QUOTE;
            gotLB = TRUE;
        } 
        else if (ch == RIGHT_CURLY_BRACE) {
            if(gotLB) {
                appendTo += RIGHT_CURLY_BRACE;
                gotLB = FALSE;
            }
            else {
                // orig code.
                appendTo += SINGLE_QUOTE;
                appendTo += RIGHT_CURLY_BRACE;
                appendTo += SINGLE_QUOTE;
            }
        } 
        else if (ch == SINGLE_QUOTE) {
            appendTo += SINGLE_QUOTE;
            appendTo += SINGLE_QUOTE;
        } 
        else {
            appendTo += ch;
        }
    }
}


Generated by  Doxygen 1.6.0   Back to index