Georg Baum <[EMAIL PROTECTED]> writes:

Index: src/support/docstring.C
===================================================================
--- src/support/docstring.C     (Revision 0)
+++ src/support/docstring.C     (Revision 0)
@@ -0,0 +1,76 @@
+/**
+ * \file docstring.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Georg Baum
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "docstring.h"
+#include "unicode.h"
+
+#include <boost/assert.hpp>
+
+
+namespace lyx {
+
+docstring const from_ascii(char const * ascii)
+{
+       docstring s;
+       for (char const * c = ascii; *c; ++c) {
+               BOOST_ASSERT(static_cast<unsigned char>(*c) < 0x80);
+               s.push_back(*c);
+       }
+       return s;
+}

Why a separate from_ascii really? If it is ascii, then it is also
utf-8.


+
+
+docstring const from_ascii(std::string const & ascii)
+{
+       // For now we assert on ascii range. Otherwise we could do
+       // return docstring(ascii.begin(), ascii.end());

Do that check first, then just use the above simple construction.


Quite ok, the resto fo the patch.

-- 
        Lgb

Reply via email to