lyxtime.cpp
mkdir.cpp
os.cpp
- qstring_helpers.cpp
rename.cpp
socktools.cpp
tempname.cpp
Path.h \
Package.cpp \
Package.h \
- qstring_helpers.cpp \
qstring_helpers.h \
rename.cpp \
socktools.cpp \
check_lstrings
check_convert_LDADD = ../debug.o convert.o docstring.o lstrings.o unicode.o \
- qstring_helpers.o $(BOOST_LIBS) $(QT4_CORE_LIB)
+ $(BOOST_LIBS) $(QT4_CORE_LIB)
check_convert_LDFLAGS = $(QT4_CORE_LDFLAGS)
check_convert_SOURCES = \
tests/check_convert.cpp \
tests/boost.cpp
check_lstrings_LDADD = ../debug.o lstrings.o convert.o docstring.o unicode.o \
- qstring_helpers.o $(QT4_CORE_LIB)
+ $(QT4_CORE_LIB)
check_lstrings_LDFLAGS = $(QT4_CORE_LDFLAGS)
check_lstrings_SOURCES = \
tests/check_lstrings.cpp \
+++ /dev/null
-/**
- * \file qstring_helpers.cpp
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Dekel Tsur
- * \author Jürgen Spitzmüller
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "qstring_helpers.h"
-#include "unicode.h"
-
-#include <QVector>
-
-
-namespace lyx {
-
-using std::string;
-
-docstring const qstring_to_ucs4(QString const & qstr)
-{
- QVector<uint> const ucs4 = qstr.toUcs4();
- return docstring(ucs4.begin(), ucs4.end());
-}
-
-
-string const fromqstr(QString const & str)
-{
- return str.isEmpty() ? string() : string(str.toUtf8());
-}
-
-} // namespace lyx
#include "support/docstring.h"
#include <QString>
+#include <QVector>
namespace lyx {
* This is the preferred method of converting anything that possibly
* contains non-ASCII stuff to docstring.
*/
-docstring const qstring_to_ucs4(QString const & qstr);
-
+inline docstring const qstring_to_ucs4(QString const & qstr)
+{
+ if (qstr.isEmpty())
+ return docstring();
+ QVector<uint> const ucs4 = qstr.toUcs4();
+ return docstring((char_type const *)(ucs4.constData()), ucs4.size());
+}
/**
* fromqstr - convert a QString into a UTF8 encoded std::string
* This should not be used except for output to lyxerr, since all possibly
* non-ASCII stuff should be stored in a docstring.
*/
-std::string const fromqstr(QString const & str);
+inline std::string const fromqstr(QString const & str)
+{
+ return str.isEmpty() ? std::string() : std::string(str.toUtf8());
+}
} // namespace lyx