src/hbcore/i18n/hbparameterlengthlimiter.cpp
changeset 6 c3690ec91ef8
parent 3 11d3954df52a
child 30 80e4d18b72f5
child 34 ed14f46c0e55
equal deleted inserted replaced
5:627c4a0fd0e7 6:c3690ec91ef8
    42         - %[y]x for inserting QStrings, x indicates argument inserting order and y is a number indicating the maximum length
    42         - %[y]x for inserting QStrings, x indicates argument inserting order and y is a number indicating the maximum length
    43                 for the argument e.g. %[10]2 would mean that the inserted QStrings maximum length is 10 characters and that the
    43                 for the argument e.g. %[10]2 would mean that the inserted QStrings maximum length is 10 characters and that the
    44                 limited argument is the second argument to be inserted.
    44                 limited argument is the second argument to be inserted.
    45         - %Lx   for inserting numbers, x is used to indicate argument inserting order.
    45         - %Lx   for inserting numbers, x is used to indicate argument inserting order.
    46 
    46 
    47     Example of how to use HbParameterLengthLimiter
    47     Example of how to use HbParameterLengthLimiter:
    48     \snippet{unittest_HbParameterLengthLimiter/unittest_HbParameterLengthLimiter.cpp,1}
    48     \snippet{unittest_HbParameterLengthLimiter/unittest_HbParameterLengthLimiter.cpp,1}
    49 
    49 
    50 */
    50 */
    51 
    51 
    52 /*!
    52 /*!
   207     Inserts an \a argument to a HbParameterLengthLimiter QString.
   207     Inserts an \a argument to a HbParameterLengthLimiter QString.
   208     
   208     
   209     \attention Cross-Platform API
   209     \attention Cross-Platform API
   210     
   210     
   211     \param a number that will be inserted to the QString
   211     \param a number that will be inserted to the QString
   212     \param fieldwidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   212     \param fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   213     \param base defines the number base
   213     \param base defines the number base
   214     \param fillChar defines the fill character
   214     \param fillChar defines the fill character
   215 */
   215 */
   216 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( int a,
   216 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( int a,
   217                                        int fieldWidth,
   217                                        int fieldWidth,
   228     Inserts an \a argument to a HbParameterLengthLimiter QString.
   228     Inserts an \a argument to a HbParameterLengthLimiter QString.
   229     
   229     
   230     \attention Cross-Platform API
   230     \attention Cross-Platform API
   231     
   231     
   232     \param a number that will be inserted to the QString
   232     \param a number that will be inserted to the QString
   233     \param fieldwidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   233     \param fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   234     \param base defines the number base
   234     \param base defines the number base
   235     \param fillChar defines the fill character
   235     \param fillChar defines the fill character
   236 */
   236 */
   237 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( uint a,
   237 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( uint a,
   238                                        int fieldWidth,
   238                                        int fieldWidth,
   248     Inserts an \a argument to a HbParameterLengthLimiter QString.
   248     Inserts an \a argument to a HbParameterLengthLimiter QString.
   249     
   249     
   250     \attention Cross-Platform API
   250     \attention Cross-Platform API
   251     
   251     
   252     \param a number that will be inserted to the QString
   252     \param a number that will be inserted to the QString
   253     \param fieldwidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   253     \param fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   254     \param base defines the number base
   254     \param base defines the number base
   255     \param fillChar defines the fill character
   255     \param fillChar defines the fill character
   256 */
   256 */
   257 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( short a,
   257 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( short a,
   258                                        int fieldWidth,
   258                                        int fieldWidth,
   268     Inserts an \a argument to a HbParameterLengthLimiter QString.
   268     Inserts an \a argument to a HbParameterLengthLimiter QString.
   269     
   269     
   270     \attention Cross-Platform API
   270     \attention Cross-Platform API
   271     
   271     
   272     \param a number that will be inserted to the QString
   272     \param a number that will be inserted to the QString
   273     \param fieldwidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   273     \param fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   274     \param base defines the number base
   274     \param base defines the number base
   275     \param fillChar defines the fill character
   275     \param fillChar defines the fill character
   276 */
   276 */
   277 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( ushort a,
   277 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( ushort a,
   278                                        int fieldWidth,
   278                                        int fieldWidth,
   288     Inserts an \a argument to a HbParameterLengthLimiter QString.
   288     Inserts an \a argument to a HbParameterLengthLimiter QString.
   289     
   289     
   290     \attention Cross-Platform API
   290     \attention Cross-Platform API
   291     
   291     
   292     \param a argument a is formatted according to the specified format and precision
   292     \param a argument a is formatted according to the specified format and precision
   293     \param fieldwidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   293     \param fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   294     \param fmt defines the format to be used
   294     \param fmt defines the format to be used
   295     \param prec defines the precision to be used
   295     \param prec defines the precision to be used
   296     \param fillChar defines the fill character
   296     \param fillChar defines the fill character
   297 */
   297 */
   298 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( double a,
   298 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( double a,
   310     Inserts an \a argument to a HbParameterLengthLimiter QString.
   310     Inserts an \a argument to a HbParameterLengthLimiter QString.
   311     
   311     
   312     \attention Cross-Platform API
   312     \attention Cross-Platform API
   313     
   313     
   314     \param a character that will be inserted to the QString
   314     \param a character that will be inserted to the QString
   315     \param fieldwidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   315     \param fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   316     \param fillChar defines the fill character
   316     \param fillChar defines the fill character
   317 */
   317 */
   318 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( char a,
   318 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( char a,
   319                                        int fieldWidth,
   319                                        int fieldWidth,
   320                                        const QChar &fillChar)
   320                                        const QChar &fillChar)
   328     Inserts an \a argument to a HbParameterLengthLimiter QString.
   328     Inserts an \a argument to a HbParameterLengthLimiter QString.
   329     
   329     
   330     \attention Cross-Platform API
   330     \attention Cross-Platform API
   331     
   331     
   332     \param a character that will be inserted to the QString
   332     \param a character that will be inserted to the QString
   333     \param fieldwidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   333     \param fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   334     \param fillChar defines the fill character
   334     \param fillChar defines the fill character
   335 */
   335 */
   336 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( QChar a,
   336 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( QChar a,
   337                                        int fieldWidth,
   337                                        int fieldWidth,
   338                                        const QChar &fillChar)
   338                                        const QChar &fillChar)
   346     Inserts an \a argument to a HbParameterLengthLimiter QString.
   346     Inserts an \a argument to a HbParameterLengthLimiter QString.
   347     
   347     
   348     \attention Cross-Platform API
   348     \attention Cross-Platform API
   349     
   349     
   350     \param a string that will be inserted to the QString
   350     \param a string that will be inserted to the QString
   351     \param fieldwidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   351     \param fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   352     \param fillChar defines the fill character
   352     \param fillChar defines the fill character
   353 */
   353 */
   354 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( const QString &a,
   354 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( const QString &a,
   355                                        int fieldWidth,
   355                                        int fieldWidth,
   356                                        const QChar &fillChar)
   356                                        const QChar &fillChar)
   384                     break;
   384                     break;
   385                 }
   385                 }
   386 
   386 
   387                 while( p->str.at(i) != ']' ) {
   387                 while( p->str.at(i) != ']' ) {
   388                     i++;
   388                     i++;
       
   389                     if( i >= p->str.length() ) {
       
   390                         break;
       
   391                     }
   389                 }
   392                 }
   390 
   393 
   391                 i++;
   394                 i++;
   392                 if( i >= p->str.length() ) {
   395                 if( i >= p->str.length() ) {
   393                     break;
   396                     break;