2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
32 const char WHITE_SPACE = 0x20; // ASCII value of the white space.
33 const char LAST_UPPER_CASE = 0x5b; // ASCII value of the one after the last upper case character (Z).
34 const char TO_LOWER_CASE = 32; // Value to add to a upper case character to transform it into a lower case.
37 bool TokenComparison( const std::string& string1, const char* const stringBuffer2, Length length )
39 const Length stringSize = string1.size();
40 if( stringSize != length )
42 // Early return. Strings have different sizes.
46 const char* const stringBuffer1 = string1.c_str();
48 for( std::size_t index = 0; index < stringSize; ++index )
50 char character = *( stringBuffer2 + index );
51 if( *( stringBuffer1 + index ) != ( ( ( character < LAST_UPPER_CASE ) && ( '0' != character ) ) ? character + TO_LOWER_CASE : character ) )
60 void SkipWhiteSpace( const char*& markupStringBuffer,
61 const char* const markupStringEndBuffer )
63 for( ; ( WHITE_SPACE >= *markupStringBuffer ) && ( markupStringBuffer < markupStringEndBuffer ); ++markupStringBuffer );
68 } // namespace Toolkit