]> git.lyx.org Git - features.git/commitdiff
Fix some conversion problems spotted by MSVC warnings
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sat, 2 Sep 2006 10:18:20 +0000 (10:18 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sat, 2 Sep 2006 10:18:20 +0000 (10:18 +0000)
* 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

src/frontends/controllers/ControlSpellchecker.C
src/insets/insetquotes.C
src/insets/insetquotes.h
src/support/lstrings.h

index 2aa74e0173bfd7fb8ab45c4e272962b1a42cbd3f..44d565c1ed6a47aac48bb24a27d3e003648233a6 100644 (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;
                }
index 3b0f10eaa7988c0c3b3917f5f203297872c4c91a..7d9d4edddcba95ab28fe66ee07f02c73f963c605 100644 (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) {
index f7daaf73245e61c79cf0530a119636b7f524c574..116005f3b51e4b799384e473f40b9a94e17922a7 100644 (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 &);
        ///
index c873d4726810a6fd155a0e17c209b2ee188d4506..204570117f24e53bb21a1d5298176632b79c3ecb 100644 (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 &);