| 1615 | }; |
| 1616 | |
| 1617 | CaseFolder *ScintillaWin::CaseFolderForEncoding() |
| 1618 | { |
| 1619 | UINT cpDest = CodePageOfDocument(); |
| 1620 | if ( cpDest == SC_CP_UTF8 ) { |
| 1621 | return new CaseFolderUTF8(); |
| 1622 | } else { |
| 1623 | if ( pdoc->dbcsCodePage == 0 ) { |
| 1624 | CaseFolderTable *pcf = new CaseFolderTable(); |
| 1625 | pcf->StandardASCII(); |
| 1626 | // Only for single byte encodings |
| 1627 | UINT cpDoc = CodePageOfDocument(); |
| 1628 | for ( int i = 0x80; i < 0x100; i++ ) { |
| 1629 | char sCharacter[2] = "A"; |
| 1630 | sCharacter[0] = static_cast<char> ( i ); |
| 1631 | wchar_t wCharacter[20]; |
| 1632 | unsigned int lengthUTF16 = ::MultiByteToWideChar ( cpDoc, 0, sCharacter, 1, |
| 1633 | wCharacter, sizeof ( wCharacter ) / sizeof ( wCharacter[0] ) ); |
| 1634 | if ( lengthUTF16 == 1 ) { |
| 1635 | wchar_t wLower[20]; |
| 1636 | int charsConverted = ::LCMapStringW ( LOCALE_SYSTEM_DEFAULT, |
| 1637 | LCMAP_LINGUISTIC_CASING | LCMAP_LOWERCASE, |
| 1638 | wCharacter, lengthUTF16, wLower, sizeof ( wLower ) / sizeof ( wLower[0] ) ); |
| 1639 | char sCharacterLowered[20]; |
| 1640 | unsigned int lengthConverted = ::WideCharToMultiByte ( cpDoc, 0, |
| 1641 | wLower, charsConverted, |
| 1642 | sCharacterLowered, sizeof ( sCharacterLowered ), NULL, 0 ); |
| 1643 | if ( ( lengthConverted == 1 ) && ( sCharacter[0] != sCharacterLowered[0] ) ) { |
| 1644 | pcf->SetTranslation ( sCharacter[0], sCharacterLowered[0] ); |
| 1645 | } |
| 1646 | } |
| 1647 | } |
| 1648 | return pcf; |
| 1649 | } else { |
| 1650 | return new CaseFolderDBCS ( cpDest ); |
| 1651 | } |
| 1652 | } |
| 1653 | } |
| 1654 | |
| 1655 | std::string ScintillaWin::CaseMapString ( const std::string &s, int caseMapping ) |
| 1656 | { |
nothing calls this directly
no test coverage detected