]> git.lyx.org Git - lyx.git/blobdiff - src/support/docstring.cpp
Account for old versions of Pygments
[lyx.git] / src / support / docstring.cpp
index 9883425ab23156c0ee9182717626c3d93daeab81..95c86b3665f2877052e543556e25d382fcaffcba 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <QFile>
 
+//Needed in Ubuntu
 #include <typeinfo>
 #if ! defined(USE_WCHAR_T) && defined(__GNUC__)
 #include <locale>
@@ -39,7 +40,7 @@ docstring const from_ascii(char const * ascii)
                char_type *d = &s[0];
                while (--n >= 0) {
                        d[n] = ascii[n];
-                       LASSERT(static_cast<unsigned char>(ascii[n]) < 0x80, /**/);
+                       LATTEST(static_cast<unsigned char>(ascii[n]) < 0x80);
                }
        }
        return s;
@@ -50,7 +51,7 @@ docstring const from_ascii(string const & ascii)
 {
        int const len = ascii.length();
        for (int i = 0; i < len; ++i)
-               LASSERT(static_cast<unsigned char>(ascii[i]) < 0x80, /**/);
+               LATTEST(static_cast<unsigned char>(ascii[i]) < 0x80);
        return docstring(ascii.begin(), ascii.end());
 }
 
@@ -61,21 +62,13 @@ string const to_ascii(docstring const & ucs4)
        string ascii;
        ascii.resize(len);
        for (int i = 0; i < len; ++i) {
-               LASSERT(ucs4[i] < 0x80, /**/);
+               LATTEST(ucs4[i] < 0x80);
                ascii[i] = static_cast<char>(ucs4[i]);
        }
        return ascii;
 }
 
 
-IconvProcessor & utf8ToUcs4()
-{
-       static IconvProcessor iconv(ucs4_codeset, "UTF-8");
-       return iconv;
-}
-
-
-
 void utf8_to_ucs4(string const & utf8, docstring & ucs4)
 {
        size_t n = utf8.size();
@@ -182,7 +175,7 @@ bool operator==(lyx::docstring const & l, char const * r)
        lyx::docstring::const_iterator it = l.begin();
        lyx::docstring::const_iterator end = l.end();
        for (; it != end; ++it, ++r) {
-               LASSERT(static_cast<unsigned char>(*r) < 0x80, /**/);
+               LASSERT(static_cast<unsigned char>(*r) < 0x80, return false);
                if (!*r)
                        return false;
                if (*it != static_cast<lyx::docstring::value_type>(*r))
@@ -196,7 +189,7 @@ lyx::docstring operator+(lyx::docstring const & l, char const * r)
 {
        lyx::docstring s(l);
        for (char const * c = r; *c; ++c) {
-               LASSERT(static_cast<unsigned char>(*c) < 0x80, /**/);
+               LASSERT(static_cast<unsigned char>(*c) < 0x80, return l);
                s.push_back(*c);
        }
        return s;
@@ -207,7 +200,7 @@ lyx::docstring operator+(char const * l, lyx::docstring const & r)
 {
        lyx::docstring s;
        for (char const * c = l; *c; ++c) {
-               LASSERT(static_cast<unsigned char>(*c) < 0x80, /**/);
+               LASSERT(static_cast<unsigned char>(*c) < 0x80, return r);
                s.push_back(*c);
        }
        s += r;
@@ -217,7 +210,7 @@ lyx::docstring operator+(char const * l, lyx::docstring const & r)
 
 lyx::docstring operator+(lyx::docstring const & l, char r)
 {
-       LASSERT(static_cast<unsigned char>(r) < 0x80, /**/);
+       LASSERT(static_cast<unsigned char>(r) < 0x80, return l);
        docstring s = l;
        s += docstring::value_type(r);
        return s;
@@ -226,7 +219,7 @@ lyx::docstring operator+(lyx::docstring const & l, char r)
 
 lyx::docstring operator+(char l, lyx::docstring const & r)
 {
-       LASSERT(static_cast<unsigned char>(l) < 0x80, /**/);
+       LASSERT(static_cast<unsigned char>(l) < 0x80, return r);
        return lyx::docstring::value_type(l) + r;
 }
 
@@ -234,7 +227,7 @@ lyx::docstring operator+(char l, lyx::docstring const & r)
 lyx::docstring & operator+=(lyx::docstring & l, char const * r)
 {
        for (char const * c = r; *c; ++c) {
-               LASSERT(static_cast<unsigned char>(*c) < 0x80, /**/);
+               LASSERT(static_cast<unsigned char>(*c) < 0x80, return l);
                l.push_back(*c);
        }
        return l;
@@ -243,7 +236,7 @@ lyx::docstring & operator+=(lyx::docstring & l, char const * r)
 
 lyx::docstring & operator+=(lyx::docstring & l, char r)
 {
-       LASSERT(static_cast<unsigned char>(r) < 0x80, /**/);
+       LASSERT(static_cast<unsigned char>(r) < 0x80, return l);
        l.push_back(r);
        return l;
 }
@@ -521,7 +514,7 @@ protected:
                return do_put_helper(oit, b, fill, v);
        }
 
-#ifdef _GLIBCXX_USE_LONG_LONG
+#ifdef LYX_USE_LONG_LONG
        iter_type
        do_put(iter_type oit, ios_base & b, char_type fill, long long v) const
        {
@@ -682,7 +675,7 @@ protected:
                return do_get_integer(iit, eit, b, err, v);
        }
 
-#ifdef _GLIBCXX_USE_LONG_LONG
+#ifdef LYX_USE_LONG_LONG
        iter_type
        do_get(iter_type iit, iter_type eit, ios_base & b,
                ios_base::iostate & err, long long & v) const
@@ -770,7 +763,6 @@ private:
                // [+-]? [0-9]* .? [0-9]* ([eE] [+-]? [0-9]+)?
                string s;
                s.reserve(64);
-               char c;
                numpunct_facet p;
                char const dot = p.decimal_point();
                char const sep = p.thousands_sep();