diff options
author | Neil <nyamatongwe@gmail.com> | 2016-10-27 21:21:57 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2016-10-27 21:21:57 +1100 |
commit | c2b21668af643baedd2e90ad91f118e1442d7ac2 (patch) | |
tree | 11f35d4207634949e7ca8269c3160a28e1891ed7 /src | |
parent | 9efd6f07a96d93e2c30d81a912814741acaa34ce (diff) | |
download | scintilla-mirror-c2b21668af643baedd2e90ad91f118e1442d7ac2.tar.gz |
Tidy CaseMapString by moving some mechanics into CaseConvert. Use StringEncode
and StringDecode more and make more likely to be optimized.
Diffstat (limited to 'src')
-rw-r--r-- | src/CaseConvert.cxx | 8 | ||||
-rw-r--r-- | src/CaseConvert.h | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/CaseConvert.cxx b/src/CaseConvert.cxx index 63a27222b..e84fbdab4 100644 --- a/src/CaseConvert.cxx +++ b/src/CaseConvert.cxx @@ -630,6 +630,14 @@ size_t CaseConvertString(char *converted, size_t sizeConverted, const char *mixe return pCaseConv->CaseConvertString(converted, sizeConverted, mixed, lenMixed); } +std::string CaseConvertString(const std::string &s, enum CaseConversion conversion) { + std::string retMapped(s.length() * maxExpansionCaseConversion, 0); + size_t lenMapped = CaseConvertString(&retMapped[0], retMapped.length(), s.c_str(), s.length(), + conversion); + retMapped.resize(lenMapped); + return retMapped; +} + #ifdef SCI_NAMESPACE } #endif diff --git a/src/CaseConvert.h b/src/CaseConvert.h index 60de22799..7a0100300 100644 --- a/src/CaseConvert.h +++ b/src/CaseConvert.h @@ -40,6 +40,9 @@ const int maxExpansionCaseConversion=3; // If there is not enough space then 0 is returned. size_t CaseConvertString(char *converted, size_t sizeConverted, const char *mixed, size_t lenMixed, enum CaseConversion conversion); +// Converts a mixed case string using a particular conversion. +std::string CaseConvertString(const std::string &s, enum CaseConversion conversion); + #ifdef SCI_NAMESPACE } #endif |