* src/support/lstrings.C

(lowercase): assert that input is pure ASCII
	(uppercase): ditto

	* src/support/lstrings.h
	(lowercase): document that only ASCII input is allowed
	(uppercase): ditto

	* src/lyxfind.C
	(stringSelected): Use compare_no_case (more efficient)

	* src/MenuBackend.C: remove unused using directive


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17393 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2007-03-02 16:52:49 +00:00
parent 6bae5045bd
commit 4f4c5d4954
4 changed files with 18 additions and 7 deletions

View File

@ -54,7 +54,6 @@ using support::compare_ascii_no_case;
using support::contains;
using support::makeDisplayPath;
using support::token;
using support::uppercase;
using boost::bind;

View File

@ -35,7 +35,7 @@
namespace lyx {
using support::lowercase;
using support::compare_no_case;
using support::uppercase;
using support::split;
@ -206,7 +206,7 @@ bool stringSelected(BufferView * bv, docstring const & searchstr,
// string search and select next occurance and return
docstring const & str1 = searchstr;
docstring const str2 = bv->cursor().selectionAsString(false);
if ((cs && str1 != str2) || lowercase(str1) != lowercase(str2)) {
if ((cs && str1 != str2) || compare_no_case(str1, str2) != 0) {
find(bv, searchstr, cs, mw, fw);
return false;
}

View File

@ -256,12 +256,14 @@ bool isAscii(docstring const & str)
char lowercase(char c)
{
BOOST_ASSERT(static_cast<unsigned char>(c) < 0x80);
return char(tolower(c));
}
char uppercase(char c)
{
BOOST_ASSERT(static_cast<unsigned char>(c) < 0x80);
return char(toupper(c));
}

View File

@ -72,12 +72,22 @@ int hexToInt(lyx::docstring const & str);
/// is \p str pure ascii?
bool isAscii(docstring const & str);
/// Changes the case of \p c to lowercase.
/// Caution: Depends on the locale
/**
* Changes the case of \p c to lowercase.
* Don't use this for non-ASCII characters, since it depends on the locale.
* This overloaded function is only implemented because the char_type variant
* would be used otherwise, and we assert in this function that \p c is in
* the ASCII range.
*/
char lowercase(char c);
/// Changes the case of \p c to uppercase.
/// Caution: Depends on the locale
/**
* Changes the case of \p c to uppercase.
* Don't use this for non-ASCII characters, since it depends on the locale.
* This overloaded function is only implemented because the char_type variant
* would be used otherwise, and we assert in this function that \p c is in
* the ASCII range.
*/
char uppercase(char c);
/// Changes the case of \p c to lowercase.