Changeset 13041 for OpenSceneGraph/trunk/src/osgText/String.cpp
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/src/osgText/String.cpp (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgText/String.cpp
r11477 r13041 18 18 _index(0), 19 19 _nullCharacter(0) {} 20 20 21 21 bool valid() const { return _index<_string.length(); } 22 22 23 23 look_ahead_iterator& operator ++ () 24 24 { 25 if (_index<_string.length()) ++_index; 25 if (_index<_string.length()) ++_index; 26 26 return *this; 27 27 } 28 28 29 29 look_ahead_iterator operator ++ (int) 30 30 { 31 look_ahead_iterator tmp(*this); 32 if (_index<_string.length()) ++_index; 31 look_ahead_iterator tmp(*this); 32 if (_index<_string.length()) ++_index; 33 33 return tmp; 34 34 } … … 39 39 return *this; 40 40 } 41 41 42 42 unsigned char operator * () const 43 43 { … … 52 52 else return _nullCharacter; 53 53 } 54 54 55 55 56 56 const std::string& _string; 57 57 unsigned int _index; 58 58 unsigned char _nullCharacter; 59 59 60 60 protected: 61 61 … … 125 125 unsigned int getNextCharacter(look_ahead_iterator& charString,String::Encoding encoding) 126 126 { 127 // For more info on unicode encodings see: 127 // For more info on unicode encodings see: 128 128 // http://www-106.ibm.com/developerworks/unicode/library/u-encode.html 129 129 switch(encoding) … … 169 169 int char2 = *charString++; 170 170 int char3 = *charString++; 171 int highSurrogate = (char0<<8) | char1; 171 int highSurrogate = (char0<<8) | char1; 172 172 int lowSurrogate = (char2<<8) | char3; 173 173 if ((char2>=0xDC)&&(char2<=0xDF)) //only for the valid range of low surrogate … … 191 191 int char3 = *charString++; 192 192 int char2 = *charString++; 193 int highSurrogate = (char0<<8) | char1; 193 int highSurrogate = (char0<<8) | char1; 194 194 int lowSurrogate = (char2<<8) | char3; 195 195 if ((char2>=0xDC)&&(char2<=0xDF)) //only for the valid range of low surrogate … … 206 206 (((int)charString[2])<<8) | charString[3]); 207 207 charString+=4; 208 if (character<0x110000) 209 { 210 // Character is constrained to the range set by the unicode standard 208 if (character<0x110000) 209 { 210 // Character is constrained to the range set by the unicode standard 211 211 return character; 212 212 } … … 218 218 (((int)charString[1])<<8) | charString[0]); 219 219 charString+=4; 220 if (character<0x110000) 221 { 222 // Character is constrained to the range set by the unicode standard 220 if (character<0x110000) 221 { 222 // Character is constrained to the range set by the unicode standard 223 223 return character; 224 224 } … … 250 250 { 251 251 if (&str==this) return *this; 252 252 253 253 clear(); 254 254 std::copy(str.begin(),str.end(),std::back_inserter(*this)); 255 255 256 256 return *this; 257 257 } … … 282 282 look_ahead_iterator itr(text); 283 283 284 if ((encoding == ENCODING_SIGNATURE) || 285 (encoding == ENCODING_UTF16) || 284 if ((encoding == ENCODING_SIGNATURE) || 285 (encoding == ENCODING_UTF16) || 286 286 (encoding == ENCODING_UTF32)) 287 287 { 288 288 encoding = findEncoding(itr,encoding); 289 289 } 290 290 291 291 while(itr.valid()) 292 292 {
