Ticket #4340: property_tree_xml_i18n_fix.patch
File property_tree_xml_i18n_fix.patch, 3.9 KB (added by , 12 years ago) |
---|
-
boost/property_tree/detail/rapidxml.hpp
309 309 } 310 310 return true; 311 311 } 312 313 template<class Ch> 314 inline size_t get_index(const Ch c) 315 { 316 // If not ASCII char, its sematic is same as plain 'z' 317 if (c > 255) 318 { 319 return 'z'; 320 } 321 return c; 322 } 312 323 } 313 324 //! \endcond 314 325 … … 1399 1410 { 1400 1411 static unsigned char test(Ch ch) 1401 1412 { 1402 return internal::lookup_tables<0>::lookup_whitespace[ static_cast<unsigned char>(ch)];1413 return internal::lookup_tables<0>::lookup_whitespace[internal::get_index(ch)]; 1403 1414 } 1404 1415 }; 1405 1416 … … 1408 1419 { 1409 1420 static unsigned char test(Ch ch) 1410 1421 { 1411 return internal::lookup_tables<0>::lookup_node_name[ static_cast<unsigned char>(ch)];1422 return internal::lookup_tables<0>::lookup_node_name[internal::get_index(ch)]; 1412 1423 } 1413 1424 }; 1414 1425 … … 1417 1428 { 1418 1429 static unsigned char test(Ch ch) 1419 1430 { 1420 return internal::lookup_tables<0>::lookup_attribute_name[ static_cast<unsigned char>(ch)];1431 return internal::lookup_tables<0>::lookup_attribute_name[internal::get_index(ch)]; 1421 1432 } 1422 1433 }; 1423 1434 … … 1426 1437 { 1427 1438 static unsigned char test(Ch ch) 1428 1439 { 1429 return internal::lookup_tables<0>::lookup_text[ static_cast<unsigned char>(ch)];1440 return internal::lookup_tables<0>::lookup_text[internal::get_index(ch)]; 1430 1441 } 1431 1442 }; 1432 1443 … … 1435 1446 { 1436 1447 static unsigned char test(Ch ch) 1437 1448 { 1438 return internal::lookup_tables<0>::lookup_text_pure_no_ws[ static_cast<unsigned char>(ch)];1449 return internal::lookup_tables<0>::lookup_text_pure_no_ws[internal::get_index(ch)]; 1439 1450 } 1440 1451 }; 1441 1452 … … 1444 1455 { 1445 1456 static unsigned char test(Ch ch) 1446 1457 { 1447 return internal::lookup_tables<0>::lookup_text_pure_with_ws[ static_cast<unsigned char>(ch)];1458 return internal::lookup_tables<0>::lookup_text_pure_with_ws[internal::get_index(ch)]; 1448 1459 } 1449 1460 }; 1450 1461 … … 1455 1466 static unsigned char test(Ch ch) 1456 1467 { 1457 1468 if (Quote == Ch('\'')) 1458 return internal::lookup_tables<0>::lookup_attribute_data_1[ static_cast<unsigned char>(ch)];1469 return internal::lookup_tables<0>::lookup_attribute_data_1[internal::get_index(ch)]; 1459 1470 if (Quote == Ch('\"')) 1460 return internal::lookup_tables<0>::lookup_attribute_data_2[ static_cast<unsigned char>(ch)];1471 return internal::lookup_tables<0>::lookup_attribute_data_2[internal::get_index(ch)]; 1461 1472 return 0; // Should never be executed, to avoid warnings on Comeau 1462 1473 } 1463 1474 }; … … 1469 1480 static unsigned char test(Ch ch) 1470 1481 { 1471 1482 if (Quote == Ch('\'')) 1472 return internal::lookup_tables<0>::lookup_attribute_data_1_pure[ static_cast<unsigned char>(ch)];1483 return internal::lookup_tables<0>::lookup_attribute_data_1_pure[internal::get_index(ch)]; 1473 1484 if (Quote == Ch('\"')) 1474 return internal::lookup_tables<0>::lookup_attribute_data_2_pure[ static_cast<unsigned char>(ch)];1485 return internal::lookup_tables<0>::lookup_attribute_data_2_pure[internal::get_index(ch)]; 1475 1486 return 0; // Should never be executed, to avoid warnings on Comeau 1476 1487 } 1477 1488 };