Christian Ehrlicher schrieb:
Ralf Habacker schrieb:
Hi,
I tried today to reactivate compiling umbrello and got compile errors. Does anyone have an idea how to solve this isse ?

It's only fixable by changing the template things to not use QChar. See comment in kdesdk/CMakeLists.txt about that.

Appended is a patch which help to fixes the QChar problem by using 'char const*'.

Unfortunally there are still places in the source which fails with a compile error

C:\downloads\kdesvn\trunk\KDE\kdesdk\umbrello\umbrello\codeimport\kdevcppparser\lexer.cpp(97) : error C2665: 'QString::QString' : none of the 10 overloads could convert all the arg
ument types
e:\daten\kde\emerge-msvc-root\include\qtcore\qstring.h(96): could be 'QString::QString(const QChar *,int)' e:\daten\kde\emerge-msvc-root\include\qtcore\qstring.h(98): or 'QString::QString(int,QChar)' e:\daten\kde\emerge-msvc-root\include\qtcore\qstring.h(581): or 'QString::QString(QString::Data *,int)'
       while trying to match the argument list '(const char *, int)'
E:\daten\kde\emerge-msvc-root\include\boost/spirit/phoenix/composite.hpp(281) : see reference to function template instantiation 'QString constructQString_impl::operator ()
<IteratorT,IteratorT>(const _Arg1 &,const _Arg2 &)' being compiled

caused by the operator() in the following code.

/** Stuff to construct a QString from iterators */
struct constructQString_impl {
 template <typename _Arg1, typename _Arg2>
 struct result {
   typedef QString type;
 };

 template <typename _Arg1, typename _Arg2>
 QString operator()( _Arg1 const& first, _Arg2 const& last) {
   return QString( &*first, &*last - &*first);
 }
};

Seems that introducing boost into umbrello may help a little in coding wigth the drawback the interface to Qt will be have problems :-(

Does anyone have an idea how to fix this problem ?

Ralf

Index: umbrello/codeimport/kdevcppparser/lexer.h
===================================================================
--- umbrello/codeimport/kdevcppparser/lexer.h   (revision 820894)
+++ umbrello/codeimport/kdevcppparser/lexer.h   (working copy)
@@ -51,12 +51,6 @@
 using boost::spirit::scanner;
 using boost::spirit::ext::skip_rule_parser;
 
-typedef boost::spirit::position_iterator<QChar const*> CharIterator;
-typedef rule<scanner<CharIterator> > SkipRule;
-typedef skip_rule_parser<SkipRule, CharIterator> CharParser;
-typedef scanner<CharIterator> CharScanner;
-typedef CharParser::skip_scanner_policies_t CharPolicies;
-
 struct LexerData;
 
 class Lexer {
@@ -131,9 +125,15 @@
     void set_filename( PositionFilename const& p_filename)
     {m_filename = p_filename;}
     void set_source( QString const& source) {
+#ifdef Q_CC_MSVC
+      m_ptr = CharIterator( source.toAscii().constData(),
+                           source.toAscii().constData() + source.length()
+                           );
+#else
       m_ptr = CharIterator( source.data(),
                            source.data() + source.length(),
                            Position( m_filename));
+#endif
     }
     /* getters */
     Position get_currentPosition() const {return m_ptr.get_position();}
Index: umbrello/codeimport/kdevcppparser/position.h
===================================================================
--- umbrello/codeimport/kdevcppparser/position.h        (revision 820894)
+++ umbrello/codeimport/kdevcppparser/position.h        (working copy)
@@ -35,14 +35,22 @@
 }
 
 #else
+#ifdef Q_CC_MSVC
+typedef boost::spirit::file_position_base<std::string> Position;
+typedef std::string PositionFilename;
+
+ inline PositionFilename QString2PositionFilename( QString const& p) {
+  return (char const*)p.toAscii();
+}
+#else
 # include <QChar>
-
 typedef boost::spirit::file_position_base<std::basic_string<QChar> > Position;
 typedef std::basic_string<QChar> PositionFilename;
 
 inline PositionFilename QString2PositionFilename( QString const& p) {
   return p.data();
 }
+#endif
 
 #endif
 
Index: umbrello/codeimport/kdevcppparser/preprocesslexer.h
===================================================================
--- umbrello/codeimport/kdevcppparser/preprocesslexer.h (revision 820894)
+++ umbrello/codeimport/kdevcppparser/preprocesslexer.h (working copy)
@@ -50,7 +50,11 @@
 using boost::spirit::scanner;
 using boost::spirit::ext::skip_rule_parser;
 
+#ifdef Q_CC_MSVC
+typedef boost::spirit::position_iterator<char const*> CharIterator;
+#else
 typedef boost::spirit::position_iterator<QChar const*> CharIterator;
+#endif
 typedef rule<scanner<CharIterator> > SkipRule;
 typedef skip_rule_parser<SkipRule, CharIterator> CharParser;
 typedef scanner<CharIterator> CharScanner;
@@ -181,19 +185,36 @@
 
   operator int () const {return m_type;}
 
-  bool isNull() const {return m_type == Token_eof || m_text.isEmpty();}
-
+  bool isNull() const {
+    return m_type == Token_eof || 
+#ifdef Q_CC_MSVC 
+    m_text.empty();
+#else
+    m_text.isEmpty();
+#endif
+  }
   int type() const {return m_type;}
 
   Position const& getStartPosition() const {return m_start;}
   Position const& getEndPosition() const {return m_end;}
   unsigned int length() const {return m_text.length();}
 
-  QString const& text() const {return m_text;}
+  QString const text() const {
+#ifdef Q_CC_MSVC
+     return QString(m_text.c_str());
+#else
+     return m_text;
+#endif
+   }
+     
 private:
   int m_type;
   Position m_start, m_end;
+#ifdef Q_CC_MSVC
+    std::string m_text;
+#else
   QString m_text;
+#endif
 };
 
 class PreprocessLexer
@@ -284,12 +305,20 @@
     void set_source( const QString& source,
                     PositionFilename const& p_filename) {
       m_source = source;
+#ifdef Q_CC_MSVC
+      m_ptr = CharIterator( m_source.toAscii().constData(),
+                           m_source.toAscii().constData() + m_source.length()
+                           );
+#else
       m_ptr = CharIterator( m_source.data(),
                            m_source.data() + m_source.length(),
                            Position( p_filename));
+#endif
     }
+#ifndef Q_CC_MSVC
     QString substrFrom( CharIterator start) const
     {return QString( &*start, &*m_ptr - &*start);}
+#endif
     /* getters */
     Position get_currentPosition() const {return m_ptr.get_position();}
     CharIterator get_ptr() const {return m_ptr;}
_______________________________________________
Kde-windows mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-windows

Reply via email to