~neon/grantlee/trunk

« back to all changes in this revision

Viewing changes to templates/lib/node.cpp

  • Committer: Stephen Kelly
  • Date: 2014-09-24 13:49:50 UTC
  • Revision ID: git-v1:edf560d9402a8f45c6e00f6381dad56c338b3a5a
Work around MSVC bug with QStringLiterals.

Show diffs side-by-side

added added

removed removed

Lines of Context:
188
188
 
189
189
QStringList AbstractNodeFactory::smartSplit( const QString &str ) const
190
190
{
191
 
  const QRegExp r( QStringLiteral( "("                   // match
 
191
#if defined(Q_CC_MSVC)
 
192
// MSVC doesn't like static string concatenations like L"foo" "bar", as
 
193
// results from QStringLiteral, so use QLatinString here instead.
 
194
#define STRING_LITERAL QLatinString
 
195
#else
 
196
#define STRING_LITERAL QStringLiteral
 
197
#endif
 
198
  const QRegExp r( STRING_LITERAL( "("                   // match
192
199
                    "(?:[^\\s\\\'\\\"]*"                // things that are not whitespace or escaped quote chars
193
200
                      "(?:"                             // followed by
194
201
                        "(?:\""                         // Either a quote starting with "
203
210
                  ")"                                   // End match
204
211
                ) );
205
212
 
 
213
#undef STRING_LITERAL
 
214
 
206
215
  QStringList l;
207
216
  int count = 0;
208
217
  int pos = 0;