Fix some conversion problems spotted by MSVC warnings

* src/insets/insetquotes.[Ch]
	(InsetQuotes::InsetQuotes): char -> lyx::char_type

	* src/support/lstrings.h
	(contains): new variant for docstrings

	* src/frontends/controllers/ControlSpellchecker.C
	(isLetter): Add missing conversion to utf8
	(nextWord): ditto


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14867 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2006-09-02 10:18:20 +00:00
parent 14c30e2b84
commit 6afe0b915c
4 changed files with 18 additions and 10 deletions

View File

@ -134,7 +134,7 @@ bool isLetter(DocIterator const & dit)
&& dit.pos() != dit.lastpos()
&& (dit.paragraph().isLetter(dit.pos())
// We want to pass the ' and escape chars to ispell
|| contains(lyxrc.isp_esc_chars + '\'',
|| contains(lyx::from_utf8(lyxrc.isp_esc_chars + '\''),
dit.paragraph().getChar(dit.pos())))
&& !isDeletedText(dit.paragraph(), dit.pos());
}
@ -146,7 +146,8 @@ WordLangTuple nextWord(LCursor & cur, ptrdiff_t & progress)
bool inword = false;
bool ignoreword = false;
cur.resetAnchor();
string word, lang_code;
docstring word;
string lang_code;
while (cur.depth()) {
if (isLetter(cur)) {
@ -170,7 +171,7 @@ WordLangTuple nextWord(LCursor & cur, ptrdiff_t & progress)
if (inword)
if (!word.empty() && !ignoreword) {
cur.setSelection();
return WordLangTuple(word, lang_code);
return WordLangTuple(lyx::to_utf8(word), lang_code);
} else
inword = false;
}

View File

@ -92,21 +92,21 @@ InsetQuotes::InsetQuotes(quote_language l, quote_side s, quote_times t)
{}
InsetQuotes::InsetQuotes(char c, BufferParams const & params)
InsetQuotes::InsetQuotes(lyx::char_type c, BufferParams const & params)
: language_(params.quotes_language), times_(params.quotes_times)
{
getPosition(c);
}
InsetQuotes::InsetQuotes(char c, quote_language l, quote_times t)
InsetQuotes::InsetQuotes(lyx::char_type c, quote_language l, quote_times t)
: language_(l), times_(t)
{
getPosition(c);
}
void InsetQuotes::getPosition(char c)
void InsetQuotes::getPosition(lyx::char_type c)
{
// Decide whether left or right
switch (c) {

View File

@ -15,6 +15,8 @@
#include "inset.h"
#include "support/types.h"
class BufferParams;
class Language;
@ -66,9 +68,9 @@ public:
explicit
InsetQuotes(std::string const & str = "eld");
/// Create the right quote inset after character c
InsetQuotes(char c, BufferParams const & params);
InsetQuotes(lyx::char_type c, BufferParams const & params);
/// Direct access to inner/outer quotation marks
InsetQuotes(char c, quote_language l, quote_times t);
InsetQuotes(lyx::char_type c, quote_language l, quote_times t);
///
void metrics(MetricsInfo &, Dimension &) const;
///
@ -117,7 +119,7 @@ private:
*/
InsetQuotes(quote_language l, quote_side s, quote_times t);
/// Decide whether we need left or right quotation marks
void getPosition(char c);
void getPosition(lyx::char_type c);
///
void parseString(std::string const &);
///

View File

@ -19,7 +19,6 @@
#include "support/types.h"
#include <vector>
#include <string>
namespace lyx {
@ -96,6 +95,12 @@ bool contains(std::string const & a, B b)
return a.find(b) != std::string::npos;
}
template <typename B>
bool contains(lyx::docstring const & a, B b)
{
return a.find(b) != lyx::docstring::npos;
}
///
bool containsOnly(std::string const &, std::string const &);