]> git.lyx.org Git - lyx.git/commitdiff
Inline qstring_helpers methods.
authorAbdelrazak Younes <younes@lyx.org>
Mon, 26 Nov 2007 10:26:03 +0000 (10:26 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 26 Nov 2007 10:26:03 +0000 (10:26 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21792 a592a061-630c-0410-9148-cb99ea01b6c8

development/scons/scons_manifest.py
src/support/Makefile.am
src/support/qstring_helpers.cpp [deleted file]
src/support/qstring_helpers.h

index d9124afddb723913832965ad2fd0b33032f799a7..e991285562d202532af86293d8c9654e5298624b 100644 (file)
@@ -363,7 +363,6 @@ src_support_files = Split('''
     lyxtime.cpp
     mkdir.cpp
     os.cpp
-    qstring_helpers.cpp
     rename.cpp
     socktools.cpp
     tempname.cpp
index 2e9a663725607827ecb1e8ac2a2732e88ff97bd5..85f1959df02acc30777d0409384a362843d0f871 100644 (file)
@@ -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 (file)
index 27b740e..0000000
+++ /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 <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
index b47f5fe5fe0c39c3bd3d78ec3f9859d174662b3c..87b77ccd107b5c73d27fadd8c6037695d08aeb3d 100644 (file)
@@ -15,6 +15,7 @@
 #include "support/docstring.h"
 
 #include <QString>
+#include <QVector>
 
 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<uint> 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