From: Abdelrazak Younes Date: Mon, 26 Nov 2007 10:26:03 +0000 (+0000) Subject: Inline qstring_helpers methods. X-Git-Tag: 1.6.10~7198 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=09ff5016cdd4394929ff0a714a0a00bf4d0d03d0;p=lyx.git Inline qstring_helpers methods. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21792 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/development/scons/scons_manifest.py b/development/scons/scons_manifest.py index d9124afddb..e991285562 100644 --- a/development/scons/scons_manifest.py +++ b/development/scons/scons_manifest.py @@ -363,7 +363,6 @@ src_support_files = Split(''' lyxtime.cpp mkdir.cpp os.cpp - qstring_helpers.cpp rename.cpp socktools.cpp tempname.cpp diff --git a/src/support/Makefile.am b/src/support/Makefile.am index 2e9a663725..85f1959df0 100644 --- a/src/support/Makefile.am +++ b/src/support/Makefile.am @@ -69,7 +69,6 @@ liblyxsupport_la_SOURCES = \ Path.h \ Package.cpp \ Package.h \ - qstring_helpers.cpp \ qstring_helpers.h \ rename.cpp \ socktools.cpp \ @@ -124,7 +123,7 @@ check_PROGRAMS = \ 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 \ @@ -136,7 +135,7 @@ check_filetools_SOURCES = \ 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 \ diff --git a/src/support/qstring_helpers.cpp b/src/support/qstring_helpers.cpp deleted file mode 100644 index 27b740e6ca..0000000000 --- a/src/support/qstring_helpers.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/** - * \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 - -#include "qstring_helpers.h" -#include "unicode.h" - -#include - - -namespace lyx { - -using std::string; - -docstring const qstring_to_ucs4(QString const & qstr) -{ - QVector 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 diff --git a/src/support/qstring_helpers.h b/src/support/qstring_helpers.h index b47f5fe5fe..87b77ccd10 100644 --- a/src/support/qstring_helpers.h +++ b/src/support/qstring_helpers.h @@ -15,6 +15,7 @@ #include "support/docstring.h" #include +#include namespace lyx { @@ -70,8 +71,13 @@ inline QString const toqstr(docstring const & ucs4) * 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 const ucs4 = qstr.toUcs4(); + return docstring((char_type const *)(ucs4.constData()), ucs4.size()); +} /** * fromqstr - convert a QString into a UTF8 encoded std::string @@ -79,7 +85,10 @@ docstring const qstring_to_ucs4(QString const & qstr); * 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