src/corelib/tools/qregexp.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
  1081     QRegExpEngine(const QRegExpEngineKey &key);
  1081     QRegExpEngine(const QRegExpEngineKey &key);
  1082     ~QRegExpEngine();
  1082     ~QRegExpEngine();
  1083 
  1083 
  1084     bool isValid() const { return valid; }
  1084     bool isValid() const { return valid; }
  1085     const QString &errorString() const { return yyError; }
  1085     const QString &errorString() const { return yyError; }
  1086     int numCaptures() const { return officialncap; }
  1086     int captureCount() const { return officialncap; }
  1087 
  1087 
  1088     int createState(QChar ch);
  1088     int createState(QChar ch);
  1089     int createState(const QRegExpCharClass &cc);
  1089     int createState(const QRegExpCharClass &cc);
  1090 #ifndef QT_NO_REGEXP_BACKREF
  1090 #ifndef QT_NO_REGEXP_BACKREF
  1091     int createState(int bref);
  1091     int createState(int bref);
  1376 #ifndef QT_NO_REGEXP_OPTIM
  1376 #ifndef QT_NO_REGEXP_OPTIM
  1377     int newSlideTabSize = qMax(eng->minl + 1, 16);
  1377     int newSlideTabSize = qMax(eng->minl + 1, 16);
  1378 #else
  1378 #else
  1379     int newSlideTabSize = 0;
  1379     int newSlideTabSize = 0;
  1380 #endif
  1380 #endif
  1381     int numCaptures = eng->numCaptures();
  1381     int numCaptures = eng->captureCount();
  1382     int newCapturedSize = 2 + 2 * numCaptures;
  1382     int newCapturedSize = 2 + 2 * numCaptures;
  1383     bigArray = q_check_ptr((int *)realloc(bigArray, ((3 + 4 * ncap) * ns + 4 * ncap + newSlideTabSize + newCapturedSize)*sizeof(int)));
  1383     bigArray = q_check_ptr((int *)realloc(bigArray, ((3 + 4 * ncap) * ns + 4 * ncap + newSlideTabSize + newCapturedSize)*sizeof(int)));
  1384 
  1384 
  1385     // set all internal variables only _after_ bigArray is realloc'ed
  1385     // set all internal variables only _after_ bigArray is realloc'ed
  1386     // to prevent a broken regexp in oom case
  1386     // to prevent a broken regexp in oom case
  4166     return priv->matchState.captured[1];
  4166     return priv->matchState.captured[1];
  4167 }
  4167 }
  4168 
  4168 
  4169 #ifndef QT_NO_REGEXP_CAPTURE
  4169 #ifndef QT_NO_REGEXP_CAPTURE
  4170 /*!
  4170 /*!
       
  4171   \obsolete
       
  4172   Returns the number of captures contained in the regular expression.
       
  4173 
       
  4174   \sa captureCount()
       
  4175  */
       
  4176 int QRegExp::numCaptures() const
       
  4177 {
       
  4178     return captureCount();
       
  4179 }
       
  4180 
       
  4181 /*!
       
  4182   \since 4.6
  4171   Returns the number of captures contained in the regular expression.
  4183   Returns the number of captures contained in the regular expression.
  4172  */
  4184  */
  4173 int QRegExp::numCaptures() const
  4185 int QRegExp::captureCount() const
  4174 {
  4186 {
  4175     prepareEngine(priv);
  4187     prepareEngine(priv);
  4176     return priv->eng->numCaptures();
  4188     return priv->eng->captureCount();
  4177 }
  4189 }
  4178 
  4190 
  4179 /*!
  4191 /*!
  4180     Returns a list of the captured text strings.
  4192     Returns a list of the captured text strings.
  4181 
  4193