src/hbcore/i18n/hbparameterlengthlimiter.cpp
changeset 34 ed14f46c0e55
parent 6 c3690ec91ef8
equal deleted inserted replaced
31:7516d6d86cf5 34:ed14f46c0e55
    31 
    31 
    32 /*!
    32 /*!
    33     @stable
    33     @stable
    34     @hbcore
    34     @hbcore
    35     \class HbParameterLengthLimiter
    35     \class HbParameterLengthLimiter
    36     \brief HbParameterLengthLimiter is a class that offers support to insert different types of arguments into a QString.
    36     \brief The HbParameterLengthLimiter class provides support for localizing text strings, and for limiting the length of runtime values inserted into the strings.
    37 
    37 
    38     Supports upto 9 argument inserts per QString.
    38     The HbParameterLengthLimiter class provides the same support for string 
    39 
    39     localization based on unique text IDs as the global hbTrId() function, and 
    40     Supports different kinds of indicators that are used for marking where arguments are inserted
    40     the same support for inserting values based on the given arguments as 
    41         - %x for inserting QStrings, where x is number from 1 to 9 indicating the order in which argumentss are positioned.
    41     QString::arg(). In addition, %HbParameterLengthLimiter supports limiting the 
    42         - %[y]x for inserting QStrings, x indicates argument inserting order and y is a number indicating the maximum length
    42     length of values that are inserted into the translations using arguments. 
    43                 for the argument e.g. %[10]2 would mean that the inserted QStrings maximum length is 10 characters and that the
    43     You can use up to nine arguments to insert values, as supported by QString.
    44                 limited argument is the second argument to be inserted.
    44     
    45         - %Lx   for inserting numbers, x is used to indicate argument inserting order.
    45     In most cases, it is simpler to use hbTrId() for localization (see hbTrId() 
    46 
    46     documentation and examples). However, the number of characters in a text 
    47     Example of how to use HbParameterLengthLimiter:
    47     string can vary widely from language to language. Sometimes when space is 
    48     \snippet{unittest_HbParameterLengthLimiter/unittest_HbParameterLengthLimiter.cpp,1}
    48     limited, you may want to limit the number of characters that are inserted. 
    49 
    49     In this case, use the HbParameterLengthLimiter class instead of %hbTrId().
    50 */
    50     
    51 
    51     Even if the inserted value does not require limiting at the time of coding, 
    52 /*!
    52     there is one advantage in using HbParameterLengthLimiter right away: if you 
    53     Constructs a HbParameterLengthLimiter with \a HbParameterLengthLimiter.
    53     later need to limit the value length for some languages, no code changes are 
    54     
    54     required. You only need to modify the <tt>.ts</tt> translation files for 
    55     \attention Cross-Platform API
    55     those languages. However, if you already know that all translations will fit 
    56     
    56     without any limitations (for example, if you are using scrolling text with 
    57     \param a HbParameterLengthLimiter that will have arguments inserted
    57     HbMarqueeItem), use hbTrId().
       
    58     
       
    59     The text strings in .ts localization files can have placeholders, where you 
       
    60     insert values at runtime. HbParameterLengthLimiter supports the same 
       
    61     placeholder formats as hbTrId() (\c \%x, \c \%Lx and \c \%Ln), and the 
       
    62     following additional placeholder:
       
    63     
       
    64     <ul>
       
    65     
       
    66     <li><tt>%[y]x</tt> for inserting strings, where \c x is a number (1-9) that 
       
    67     indicates the order of placeholders in the source text string. This 
       
    68     corresponds to your argument inserting order when you use 
       
    69     HbParameterLengthLimiter. The order of placeholders may vary in different 
       
    70     translations, and the numbering ensures that values are inserted into the 
       
    71     correct placeholders. <tt>[y]</tt> is a number that indicates the maximum 
       
    72     length (in characters) for the inserted value.</li>
       
    73     
       
    74     </ul>
       
    75     
       
    76     For example, the text string \c "Downloading file %[10]1 from URL %2" has 
       
    77     two placeholders to insert two strings, a file name and a URL. The [] 
       
    78     notation in the first placeholder \c %[10]1 limits the length of the file 
       
    79     name to 10 characters.
       
    80     
       
    81     HbParameterLengthLimiter provides all the same %arg() variants as QString, 
       
    82     which means you can use it in place of QString::arg() when needed. The 
       
    83     following examples describe the most common use cases that you would use 
       
    84     %HbParameterLengthLimiter for. The other functions available can be used for 
       
    85     more complex cases, such as processing the localized text strings.
       
    86     
       
    87     \section _usecases_hbparameterlengthlimiter Using the HbParameterLengthLimiter class
       
    88     
       
    89     \subsection _uc_001_hbparameterlengthlimiter Limiting the length of values inserted using an argument
       
    90       
       
    91       This example shows how you get the translation based on a given text ID, 
       
    92       replace the two placeholders with values using runtime arguments, and 
       
    93       limit the length of both of the inserted values.
       
    94       
       
    95       \code
       
    96       // "Download file %1 from URL %2?"
       
    97       // fileName = "test_application_data_file.txt"
       
    98       // urlName = "www.something.org"
       
    99       HbParameterLengthLimiter myTranslation("txt_browser_download_data");
       
   100       label->setPlainText(myTranslation.arg(fileName, urlName));
       
   101       \endcode
       
   102       
       
   103       The translation is defined in the <tt>.ts</tt> file in the following 
       
   104       format:
       
   105       
       
   106       \code
       
   107       <message id="txt_browser_download_data">
       
   108         <source>"Download file %1 from URL %2?</source>
       
   109         <translation variants="no">Download file %[10]1 from URL %[12]2?</translation>
       
   110       </message>
       
   111       \endcode
       
   112       
       
   113       This limits the length of the inserted values to 10 and 12 characters, 
       
   114       producing a text string such as \c "Download file test_appli... from URL 
       
   115       www.somethin...?".
       
   116     
       
   117       \subsection _uc_002_hbparameterlengthlimiter Inserting values using runtime arguments
       
   118       
       
   119       This example shows how you simply get a translation and replace the 
       
   120       placeholder with a runtime value. You can achieve the same result by using 
       
   121       hbTrId().
       
   122       
       
   123       \code
       
   124       // "Enter %L1-digit passcode"
       
   125       // int number = 4
       
   126       label->setPlainText(HbParameterLengthLimiter("txt_give_numeric_passcode").arg(number));
       
   127       \endcode
       
   128       
       
   129       This example also uses the 'L' notation in the placeholder in the text 
       
   130       string, which formats the number in the active locale's display format.
       
   131       
       
   132       \sa hbTrId(), QString::arg(), HbDirectoryNameLocalizer, HbTranslator
       
   133 
       
   134 
       
   135 */
       
   136 
       
   137 /*!
       
   138     Copy constructor.
       
   139         
       
   140     \param a The HbParameterLengthLimiter object to copy.
    58 */
   141 */
    59 HbParameterLengthLimiter::HbParameterLengthLimiter( const HbParameterLengthLimiter& a )
   142 HbParameterLengthLimiter::HbParameterLengthLimiter( const HbParameterLengthLimiter& a )
    60 {
   143 {
    61     p = new HbParameterLengthLimiterPrivate();
   144     p = new HbParameterLengthLimiterPrivate();
    62     p->str = a.p->str;
   145     p->str = a.p->str;
    63 }
   146 }
    64 
   147 
    65 /*!
   148 /*!
    66     Constructs a HbParameterLengthLimiter with \a QString.
   149     Constructor for processing a string that has already been localized.
    67     
   150     
    68     \attention Cross-Platform API
   151     \param a A localized string containing the placeholders for inserting values.
    69     
       
    70     \param a QString that will have arguments inserted
       
    71 */
   152 */
    72 HbParameterLengthLimiter::HbParameterLengthLimiter( QString a )
   153 HbParameterLengthLimiter::HbParameterLengthLimiter( QString a )
    73 {
   154 {
    74     p = new HbParameterLengthLimiterPrivate();
   155     p = new HbParameterLengthLimiterPrivate();
    75     p->str = a;
   156     p->str = a;
    76 }
   157 }
    77 
   158 
    78 /*!
   159 /*!
    79     Constructs a HbParameterLengthLimiter with \a char*.
   160 
    80     
   161     Constructs an HbParameterLengthLimiter using a text ID. The functionality is 
    81     \attention Cross-Platform API
   162     similar to what hbTrId() provides, except for the additional support for 
    82     
   163     limiting the length of the inserted values.
    83     \param a char string that will have arguments inserted
   164     
       
   165     \param a The text ID that identifies the localized string in the 
       
   166     <tt>.ts</tt> file.
       
   167     
    84 */
   168 */
    85 HbParameterLengthLimiter::HbParameterLengthLimiter( const char* a )
   169 HbParameterLengthLimiter::HbParameterLengthLimiter( const char* a )
    86 {
   170 {
    87     p = new HbParameterLengthLimiterPrivate();
   171     p = new HbParameterLengthLimiterPrivate();
    88     p->str = hbTrId(a);
   172     p->str = hbTrId(a);
    89 }
   173 }
    90 
   174 
    91 /*!
   175 /*!
    92     Constructs a HbParameterLengthLimiter with \a char* and \a int.
   176 
    93     
   177     Constructs an HbParameterLengthLimiter using a text ID, and a numeric 
    94     \attention Cross-Platform API
   178     parameter for handling singular and plural forms correctly. The 
    95     
   179     functionality is the same as provided by the hbTrId() function, except for 
    96     \param a char string that will have arguments inserted
   180     the additional support for limiting the length of the inserted values.
    97     \param n used to identify which plural form to use
   181     
       
   182     \param a The text ID that identifies the localized string in the 
       
   183     <tt>.ts</tt> file.    
       
   184     \param n A numeric parameter that indicates quantity, used to determine 
       
   185     which singular or plural translation to use from the <tt>.ts</tt> file.
       
   186     
    98 */
   187 */
    99 HbParameterLengthLimiter::HbParameterLengthLimiter( const char* a, int n )
   188 HbParameterLengthLimiter::HbParameterLengthLimiter( const char* a, int n )
   100 {
   189 {
   101     p = new HbParameterLengthLimiterPrivate();
   190     p = new HbParameterLengthLimiterPrivate();
   102     p->str = hbTrId(a, n);
   191     p->str = hbTrId(a, n);
   103 }
   192 }
   104 
   193 
   105 /*!
   194 /*!
   106     Conp->structs a HbParameterLengthLimiter without a predefined QString.
   195     Constructs an HbParameterLengthLimiter with a blank string.
   107     
       
   108     \attention Cross-Platform API  
       
   109 */
   196 */
   110 HbParameterLengthLimiter::HbParameterLengthLimiter()
   197 HbParameterLengthLimiter::HbParameterLengthLimiter()
   111 {
   198 {
   112     p = new HbParameterLengthLimiterPrivate();
   199     p = new HbParameterLengthLimiterPrivate();
   113     p->str = "";
   200     p->str = "";
   114 }
   201 }
   115 
   202 
   116 /*!
   203 /*!
   117     Destructor
   204     Destructor.
   118 */
   205 */
   119 HbParameterLengthLimiter::~HbParameterLengthLimiter()
   206 HbParameterLengthLimiter::~HbParameterLengthLimiter()
   120 {
   207 {
   121     delete p;
   208     delete p;
   122 }
   209 }
   123 
   210 
   124 /*!
   211 /*!
   125     Inserts an \a argument to a HbParameterLengthLimiter QString.
   212     
   126     
   213     Replaces the placeholders in the translation with runtime values using the 
   127     \attention Cross-Platform API
   214     given parameters and arguments.
   128     
   215     
   129     \param a number that will be inserted to the QString
   216     This function corresponds to QString::arg(qlonglong, int, int, const QChar &) const.
   130     \param fieldwidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   217     
   131     \param base defines the number base
   218     \param a The number that is to be inserted to the output string.
   132     \param fillChar defines the fill character
   219     \param fieldwidth The minimum amount of space that \a a is padded to and 
       
   220     filled with the character \a fillChar.    
       
   221     \param base The number base.
       
   222     \param fillChar The fill character.
   133 */
   223 */
   134 HbParameterLengthLimiter& HbParameterLengthLimiter::arg(qlonglong a,
   224 HbParameterLengthLimiter& HbParameterLengthLimiter::arg(qlonglong a,
   135                                       int fieldwidth,
   225                                       int fieldwidth,
   136                                       int base,
   226                                       int base,
   137                                       const QChar &fillChar)
   227                                       const QChar &fillChar)
   140     p->str = p->str.arg(a,fieldwidth,base,tmpChar);
   230     p->str = p->str.arg(a,fieldwidth,base,tmpChar);
   141     return *this;
   231     return *this;
   142 }
   232 }
   143 
   233 
   144 /*!
   234 /*!
   145     Inserts an \a argument to a HbParameterLengthLimiter QString.
   235     
   146     
   236     Replaces the placeholders in the translation with runtime values using the 
   147     \attention Cross-Platform API
   237     given parameters and arguments.
   148     
   238     
   149     \param a number that will be inserted to the QString
   239     This function corresponds to QString::arg(qulonglong, int, int, const QChar &) const.
   150     \param fieldwidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   240     
   151     \param base defines the number base
   241     \param a The number that is to be inserted to the output string.    
   152     \param fillChar defines the fill character
   242     \param fieldwidth The minimum amount of space that \a a is padded to and 
       
   243     filled with the character \a fillChar.    
       
   244     \param base The number base.
       
   245     \param fillChar The fill character.
   153 */
   246 */
   154 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( qulonglong a,
   247 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( qulonglong a,
   155                                        int fieldwidth,
   248                                        int fieldwidth,
   156                                        int base,
   249                                        int base,
   157                                        const QChar &fillChar)
   250                                        const QChar &fillChar)
   161 
   254 
   162     return *this;
   255     return *this;
   163  }
   256  }
   164 
   257 
   165 /*!
   258 /*!
   166     Inserts an \a argument to a HbParameterLengthLimiter QString.
   259     
   167     
   260     Replaces the placeholders in the translation with runtime values using the 
   168     \attention Cross-Platform API
   261     given parameters and arguments.
   169     
   262     
   170     \param a number that will be inserted to the QString
   263     This function corresponds to QString::arg(long, int, int, const QChar &) const.
   171     \param fieldwidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   264     
   172     \param base defines the number base
   265     \param a The number that is to be inserted to the output string.    
   173     \param fillChar defines the fill character
   266     \param fieldwidth The minimum amount of space that \a a is padded to and 
       
   267     filled with the character \a fillChar.    
       
   268     \param base The number base.
       
   269     \param fillChar The fill character.
   174 */
   270 */
   175 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( long a,
   271 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( long a,
   176                                        int fieldwidth,
   272                                        int fieldwidth,
   177                                        int base,
   273                                        int base,
   178                                        const QChar &fillChar)
   274                                        const QChar &fillChar)
   182 
   278 
   183     return *this;
   279     return *this;
   184  }
   280  }
   185 
   281 
   186 /*!
   282 /*!
   187     Inserts an \a argument to a HbParameterLengthLimiter QString.
   283     
   188     
   284     Replaces the placeholders in the translation with runtime values using the 
   189     \attention Cross-Platform API
   285     given parameters and arguments.
   190     
   286     
   191     \param a number that will be inserted to the QString
   287     This function corresponds to QString::arg(ulong, int, int, const QChar &) const.
   192     \param fieldwidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   288     
   193     \param base defines the number base
   289     \param a The number that is to be inserted to the output string.    
   194     \param fillChar defines the fill character
   290     \param fieldwidth The minimum amount of space that \a a is padded to and 
       
   291     filled with the character \a fillChar.    
       
   292     \param base The number base.
       
   293     \param fillChar The fill character.
   195 */
   294 */
   196 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( ulong a,
   295 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( ulong a,
   197                                        int fieldwidth,
   296                                        int fieldwidth,
   198                                        int base,
   297                                        int base,
   199                                        const QChar &fillChar)
   298                                        const QChar &fillChar)
   202     p->str = p->str.arg(a,fieldwidth,base,tmpChar);
   301     p->str = p->str.arg(a,fieldwidth,base,tmpChar);
   203     return *this;
   302     return *this;
   204  }
   303  }
   205 
   304 
   206 /*!
   305 /*!
   207     Inserts an \a argument to a HbParameterLengthLimiter QString.
   306     
   208     
   307     Replaces the placeholders in the translation with runtime values using the 
   209     \attention Cross-Platform API
   308     given parameters and arguments.
   210     
   309     
   211     \param a number that will be inserted to the QString
   310     This function corresponds to QString::arg(int, int, int, const QChar &) const.
   212     \param fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   311     
   213     \param base defines the number base
   312     \param a The number that is to be inserted to the output string.    
   214     \param fillChar defines the fill character
   313     \param fieldWidth The minimum amount of space that \a a is padded to and 
       
   314     filled with the character \a fillChar.    
       
   315     \param base The number base.
       
   316     \param fillChar The fill character.
   215 */
   317 */
   216 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( int a,
   318 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( int a,
   217                                        int fieldWidth,
   319                                        int fieldWidth,
   218                                        int base,
   320                                        int base,
   219                                        const QChar &fillChar)
   321                                        const QChar &fillChar)
   223 
   325 
   224     return *this;
   326     return *this;
   225  }
   327  }
   226 
   328 
   227 /*!
   329 /*!
   228     Inserts an \a argument to a HbParameterLengthLimiter QString.
   330     
   229     
   331     Replaces the placeholders in the translation with runtime values using the 
   230     \attention Cross-Platform API
   332     given parameters and arguments.
   231     
   333     
   232     \param a number that will be inserted to the QString
   334     This function corresponds to QString::arg(uint, int, int, const QChar &) const.
   233     \param fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   335     
   234     \param base defines the number base
   336     \param a The number that is to be inserted to the output string.    
   235     \param fillChar defines the fill character
   337     \param fieldWidth The minimum amount of space that \a a is padded to and 
       
   338     filled with the character \a fillChar.    
       
   339     \param base The number base.
       
   340     \param fillChar The fill character.
   236 */
   341 */
   237 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( uint a,
   342 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( uint a,
   238                                        int fieldWidth,
   343                                        int fieldWidth,
   239                                        int base,
   344                                        int base,
   240                                        const QChar &fillChar)
   345                                        const QChar &fillChar)
   243     p->str = p->str.arg(a,fieldWidth,base,tmpChar);
   348     p->str = p->str.arg(a,fieldWidth,base,tmpChar);
   244     return *this;
   349     return *this;
   245  }
   350  }
   246 
   351 
   247 /*!
   352 /*!
   248     Inserts an \a argument to a HbParameterLengthLimiter QString.
   353     
   249     
   354     Replaces the placeholders in the translation with runtime values using the 
   250     \attention Cross-Platform API
   355     given parameters and arguments.
   251     
   356     
   252     \param a number that will be inserted to the QString
   357     This function corresponds to QString::arg(short, int, int, const QChar &) const.
   253     \param fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   358     
   254     \param base defines the number base
   359     \param a The number that is to be inserted to the output string.    
   255     \param fillChar defines the fill character
   360     \param fieldWidth The minimum amount of space that \a a is padded to and 
       
   361     filled with the character \a fillChar.    
       
   362     \param base The number base.
       
   363     \param fillChar The fill character.
   256 */
   364 */
   257 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( short a,
   365 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( short a,
   258                                        int fieldWidth,
   366                                        int fieldWidth,
   259                                        int base,
   367                                        int base,
   260                                        const QChar &fillChar)
   368                                        const QChar &fillChar)
   263     p->str = p->str.arg(a,fieldWidth,base,tmpChar);
   371     p->str = p->str.arg(a,fieldWidth,base,tmpChar);
   264     return *this;
   372     return *this;
   265 }
   373 }
   266 
   374 
   267 /*!
   375 /*!
   268     Inserts an \a argument to a HbParameterLengthLimiter QString.
   376     
   269     
   377     Replaces the placeholders in the translation with runtime values using the 
   270     \attention Cross-Platform API
   378     given parameters and arguments.
   271     
   379     
   272     \param a number that will be inserted to the QString
   380     This function corresponds to QString::arg(ushort, int, int, const QChar &) const.
   273     \param fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   381     
   274     \param base defines the number base
   382     \param a The number that is to be inserted to the output string.    
   275     \param fillChar defines the fill character
   383     \param fieldWidth The minimum amount of space that \a a is padded to and 
       
   384     filled with the character \a fillChar.    
       
   385     \param base The number base.
       
   386     \param fillChar The fill character.
   276 */
   387 */
   277 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( ushort a,
   388 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( ushort a,
   278                                        int fieldWidth,
   389                                        int fieldWidth,
   279                                        int base,
   390                                        int base,
   280                                        const QChar &fillChar)
   391                                        const QChar &fillChar)
   283     p->str = p->str.arg(a,fieldWidth,base,tmpChar);
   394     p->str = p->str.arg(a,fieldWidth,base,tmpChar);
   284     return *this;
   395     return *this;
   285 }
   396 }
   286 
   397 
   287 /*!
   398 /*!
   288     Inserts an \a argument to a HbParameterLengthLimiter QString.
   399     
   289     
   400     Replaces the placeholders in the translation with runtime values using the 
   290     \attention Cross-Platform API
   401     given parameters and arguments.
   291     
   402     
   292     \param a argument a is formatted according to the specified format and precision
   403     This function corresponds to QString::arg(double, int, char, int, const QChar &) const.
   293     \param fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   404     
   294     \param fmt defines the format to be used
   405     \param a Value formatted according to the specified format and precision.    
   295     \param prec defines the precision to be used
   406     \param fieldWidth The minimum amount of space that \a a is padded to and 
   296     \param fillChar defines the fill character
   407     filled with the character \a fillChar.    
       
   408     \param fmt The format to be used.
       
   409     \param prec The precision to be used.
       
   410     \param fillChar The fill character.
   297 */
   411 */
   298 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( double a,
   412 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( double a,
   299                                        int fieldWidth,
   413                                        int fieldWidth,
   300                                        char fmt,
   414                                        char fmt,
   301                                        int prec,
   415                                        int prec,
   305     p->str = p->str.arg(a, fieldWidth, fmt, prec, tmpChar);
   419     p->str = p->str.arg(a, fieldWidth, fmt, prec, tmpChar);
   306     return *this;
   420     return *this;
   307 }
   421 }
   308 
   422 
   309 /*!
   423 /*!
   310     Inserts an \a argument to a HbParameterLengthLimiter QString.
   424     
   311     
   425     Replaces the placeholders in the translation with runtime values using the 
   312     \attention Cross-Platform API
   426     given parameters and arguments.
   313     
   427     
   314     \param a character that will be inserted to the QString
   428     This function corresponds to QString::arg(char, int, const QChar &) const.
   315     \param fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   429     
   316     \param fillChar defines the fill character
   430     \param a The character that is to be inserted to the output string.    
       
   431     \param fieldWidth The minimum amount of space that \a a is padded to and 
       
   432     filled with the character \a fillChar.    
       
   433     \param fillChar The fill character.
   317 */
   434 */
   318 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( char a,
   435 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( char a,
   319                                        int fieldWidth,
   436                                        int fieldWidth,
   320                                        const QChar &fillChar)
   437                                        const QChar &fillChar)
   321 {
   438 {
   323     p->str = p->str.arg(a, fieldWidth, tmpChar);
   440     p->str = p->str.arg(a, fieldWidth, tmpChar);
   324     return *this;
   441     return *this;
   325 }
   442 }
   326 
   443 
   327 /*!
   444 /*!
   328     Inserts an \a argument to a HbParameterLengthLimiter QString.
   445     
   329     
   446     Replaces the placeholders in the translation with runtime values using the 
   330     \attention Cross-Platform API
   447     given parameters and arguments.
   331     
   448     
   332     \param a character that will be inserted to the QString
   449     This function corresponds to QString::arg(QChar, int, const QChar &) const.
   333     \param fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   450     
   334     \param fillChar defines the fill character
   451     \param a The character that is to be inserted to the output string.    
       
   452     \param fieldWidth The minimum amount of space that \a a is padded to and 
       
   453     filled with the character \a fillChar.    
       
   454     \param fillChar The fill character.
   335 */
   455 */
   336 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( QChar a,
   456 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( QChar a,
   337                                        int fieldWidth,
   457                                        int fieldWidth,
   338                                        const QChar &fillChar)
   458                                        const QChar &fillChar)
   339 {
   459 {
   341     p->str = p->str.arg(a, fieldWidth, tmpChar);
   461     p->str = p->str.arg(a, fieldWidth, tmpChar);
   342     return *this;
   462     return *this;
   343 }
   463 }
   344 
   464 
   345 /*!
   465 /*!
   346     Inserts an \a argument to a HbParameterLengthLimiter QString.
   466     
   347     
   467     Replaces the placeholders in the translation with runtime values using the 
   348     \attention Cross-Platform API
   468     given parameters and arguments. Limits the length of the inserted value, if 
   349     
   469     this is specified in the placeholder using the [] notation.
   350     \param a string that will be inserted to the QString
   470     
   351     \param fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar
   471     This function corresponds to QString::arg(const QString &, int, const QChar &) const.
   352     \param fillChar defines the fill character
   472     
       
   473     \param a The string that is to be inserted to the output string.    
       
   474     \param fieldWidth The minimum amount of space that \a a is padded to and 
       
   475     filled with the character \a fillChar.    
       
   476     \param fillChar The fill character.
   353 */
   477 */
   354 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( const QString &a,
   478 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( const QString &a,
   355                                        int fieldWidth,
   479                                        int fieldWidth,
   356                                        const QChar &fillChar)
   480                                        const QChar &fillChar)
   357 {
   481 {
   481     }
   605     }
   482     return *this;
   606     return *this;
   483 }
   607 }
   484 
   608 
   485 /*!
   609 /*!
   486     Inserts an arguments a1 and a2 to a HbParameterLengthLimiter QString.
   610 
   487     
   611     Replaces the placeholders in the translation with the given strings using 
   488     \attention Cross-Platform API
   612     the arguments (\a a1 and \a a2). Limits the length of the inserted value, if 
   489     
   613     this is specified in the placeholder using the [] notation.
   490     \param a1 string that will be inserted to the QString
   614     
   491     \param a2 string that will be inserted to the QString
   615     This function corresponds to QString::arg(const QString &, const QString &) const.
       
   616     
   492 */
   617 */
   493 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( const QString &a1,
   618 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( const QString &a1,
   494                                        const QString &a2 )
   619                                        const QString &a2 )
   495 {
   620 {
   496     this->arg(a1).arg(a2);
   621     this->arg(a1).arg(a2);
   497     return *this;
   622     return *this;
   498 }
   623 }
   499 
   624 
   500 /*!
   625 /*!
   501     Inserts an arguments a1, a2 and a3 to a HbParameterLengthLimiter QString.
   626 
   502     
   627     Replaces the placeholders in the translation with the given strings using 
   503     \attention Cross-Platform API
   628     the arguments (\a a1, \a a2, and so on). Limits the length of the inserted 
   504     
   629     value, if this is specified in the placeholder using the [] notation.
   505     \param a1 string that will be inserted to the QString
   630     
   506     \param a2 string that will be inserted to the QString
   631     This function corresponds to QString::arg(const QString &, const QString &, const QString &) const.
   507     \param a3 string that will be inserted to the QString
   632     
   508 */
   633 */
   509 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( const QString &a1,
   634 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( const QString &a1,
   510                                        const QString &a2,
   635                                        const QString &a2,
   511                                        const QString &a3)
   636                                        const QString &a3)
   512 {
   637 {
   513     this->arg(a1, a2).arg(a3);
   638     this->arg(a1, a2).arg(a3);
   514     return *this;
   639     return *this;
   515 }
   640 }
   516 
   641 
   517 /*!
   642 /*!
   518     Inserts an arguments a1, a2, a3 and a4 to a HbParameterLengthLimiter QString.
   643 
   519     
   644     Replaces the placeholders in the translation with the given strings using 
   520     \attention Cross-Platform API
   645     the arguments (\a a1, \a a2, and so on). Limits the length of the inserted 
   521     
   646     value, if this is specified in the placeholder using the [] notation.
   522     \param a1 string that will be inserted to the QString
   647     
   523     \param a2 string that will be inserted to the QString
   648     This function corresponds to QString::arg(const QString &, const QString &, const QString &, const QString &) const.
   524     \param a3 string that will be inserted to the QString
   649     
   525     \param a4 string that will be inserted to the QString
       
   526 */
   650 */
   527 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( const QString &a1,
   651 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( const QString &a1,
   528                                        const QString &a2,
   652                                        const QString &a2,
   529                                        const QString &a3,
   653                                        const QString &a3,
   530                                        const QString &a4 )
   654                                        const QString &a4 )
   532     this->arg(a1, a2, a3).arg(a4);
   656     this->arg(a1, a2, a3).arg(a4);
   533     return *this;
   657     return *this;
   534 }
   658 }
   535 
   659 
   536 /*!
   660 /*!
   537     Inserts an arguments a1, a2, a3, a4 and a5 to a HbParameterLengthLimiter QString.
   661 
   538     
   662     Replaces the placeholders in the translation with the given strings using 
   539     \attention Cross-Platform API
   663     the arguments (\a a1, \a a2, and so on). Limits the length of the inserted 
   540     
   664     value, if this is specified in the placeholder using the [] notation.
   541     \param a1 string that will be inserted to the QString
   665     
   542     \param a2 string that will be inserted to the QString
   666     This function corresponds to QString::arg(const QString &, const QString &, const QString &, const QString &, const QString &) const.
   543     \param a3 string that will be inserted to the QString
   667     
   544     \param a4 string that will be inserted to the QString
       
   545     \param a5 string that will be inserted to the QString
       
   546 */
   668 */
   547 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( const QString &a1,
   669 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( const QString &a1,
   548                                        const QString &a2,
   670                                        const QString &a2,
   549                                        const QString &a3,
   671                                        const QString &a3,
   550                                        const QString &a4,
   672                                        const QString &a4,
   553     this->arg(a1, a2, a3, a4 ).arg(a5);
   675     this->arg(a1, a2, a3, a4 ).arg(a5);
   554     return *this;
   676     return *this;
   555 }
   677 }
   556 
   678 
   557 /*!
   679 /*!
   558     Inserts an arguments a1, a2, a3, a4, a5 and a6 to a HbParameterLengthLimiter QString.
   680     
   559     
   681     Replaces the placeholders in the translation with the given strings using 
   560     \attention Cross-Platform API
   682     the arguments (\a a1, \a a2, and so on). Limits the length of the inserted 
   561     
   683     value, if this is specified in the placeholder using the [] notation.
   562     \param a1 string that will be inserted to the QString
   684     
   563     \param a2 string that will be inserted to the QString
   685     This function corresponds to QString::arg(const QString &, const QString &, const QString &, const QString &, const QString &, const QString &) const.
   564     \param a3 string that will be inserted to the QString
   686     
   565     \param a4 string that will be inserted to the QString
       
   566     \param a5 string that will be inserted to the QString
       
   567     \param a6 string that will be inserted to the QString
       
   568 */
   687 */
   569 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( const QString &a1,
   688 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( const QString &a1,
   570                                        const QString &a2,
   689                                        const QString &a2,
   571                                        const QString &a3,
   690                                        const QString &a3,
   572                                        const QString &a4,
   691                                        const QString &a4,
   576     this->arg(a1, a2, a3, a4, a5).arg(a6);
   695     this->arg(a1, a2, a3, a4, a5).arg(a6);
   577     return *this;
   696     return *this;
   578 }
   697 }
   579 
   698 
   580 /*!
   699 /*!
   581     Inserts an arguments a1, a2, a3, a4, a5, a6 and a7 to a HbParameterLengthLimiter QString.
   700     
   582     
   701     Replaces the placeholders in the translation with the given strings using 
   583     \attention Cross-Platform API
   702     the arguments (\a a1, \a a2, and so on). Limits the length of the inserted 
   584     
   703     value, if this is specified in the placeholder using the [] notation.
   585     \param a1 string that will be inserted to the QString
   704     
   586     \param a2 string that will be inserted to the QString
   705     This function corresponds to QString::arg(const QString &, const QString &, const QString &, const QString &, const QString &, const QString &, const QString &) const.
   587     \param a3 string that will be inserted to the QString
   706     
   588     \param a4 string that will be inserted to the QString
       
   589     \param a5 string that will be inserted to the QString
       
   590     \param a6 string that will be inserted to the QString
       
   591     \param a7 string that will be inserted to the QString
       
   592 */
   707 */
   593 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( const QString &a1,
   708 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( const QString &a1,
   594                                        const QString &a2,
   709                                        const QString &a2,
   595                                        const QString &a3,
   710                                        const QString &a3,
   596                                        const QString &a4,
   711                                        const QString &a4,
   601     this->arg(a1, a2, a3, a4, a5, a6).arg(a7);
   716     this->arg(a1, a2, a3, a4, a5, a6).arg(a7);
   602     return *this;
   717     return *this;
   603 }
   718 }
   604 
   719 
   605 /*!
   720 /*!
   606     Inserts an arguments a1, a2, a3, a4, a5, a6, a7 and a8 to a HbParameterLengthLimiter QString.
   721     
   607     
   722     Replaces the placeholders in the translation with the given strings using 
   608     \attention Cross-Platform API
   723     the arguments (\a a1, \a a2, and so on). Limits the length of the inserted 
   609     
   724     value, if this is specified in the placeholder using the [] notation.
   610     \param a1 string that will be inserted to the QString
   725     
   611     \param a2 string that will be inserted to the QString
   726     This function corresponds to QString::arg(const QString &, const QString &, const QString &, const QString &, const QString &, const QString &, const QString &, const QString &) const.
   612     \param a3 string that will be inserted to the QString
   727     
   613     \param a4 string that will be inserted to the QString
       
   614     \param a5 string that will be inserted to the QString
       
   615     \param a6 string that will be inserted to the QString
       
   616     \param a7 string that will be inserted to the QString
       
   617     \param a8 string that will be inserted to the QString
       
   618 */
   728 */
   619 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( const QString &a1,
   729 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( const QString &a1,
   620                                        const QString &a2,
   730                                        const QString &a2,
   621                                        const QString &a3,
   731                                        const QString &a3,
   622                                        const QString &a4,
   732                                        const QString &a4,
   628     this->arg(a1, a2, a3, a4, a5, a6, a7).arg(a8);
   738     this->arg(a1, a2, a3, a4, a5, a6, a7).arg(a8);
   629     return *this;
   739     return *this;
   630 }
   740 }
   631 
   741 
   632 /*!
   742 /*!
   633     Inserts an arguments a1, a2, a3, a4, a5, a6, a7, a8 and a9 to a HbParameterLengthLimiter QString.
   743     
   634     
   744     Replaces the placeholders in the translation with the given strings using 
   635     \attention Cross-Platform API
   745     the arguments (\a a1, \a a2, and so on). Limits the length of the inserted 
   636     
   746     value, if this is specified in the placeholder using the [] notation.
   637     \param a1 string that will be inserted to the QString
   747     
   638     \param a2 string that will be inserted to the QString
   748     This function corresponds to QString::arg(const QString &, const QString &, const QString &, const QString &, const QString &, const QString &, const QString &, const QString &, const QString &) const.
   639     \param a3 string that will be inserted to the QString
   749     
   640     \param a4 string that will be inserted to the QString
       
   641     \param a5 string that will be inserted to the QString
       
   642     \param a6 string that will be inserted to the QString
       
   643     \param a7 string that will be inserted to the QString
       
   644     \param a8 string that will be inserted to the QString
       
   645     \param a9 string that will be inserted to the QString
       
   646 */
   750 */
   647 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( const QString &a1,
   751 HbParameterLengthLimiter& HbParameterLengthLimiter::arg( const QString &a1,
   648                                        const QString &a2, 
   752                                        const QString &a2, 
   649                                        const QString &a3,
   753                                        const QString &a3,
   650                                        const QString &a4, 
   754                                        const QString &a4, 
   657     this->arg(a1, a2, a3, a4, a5, a6, a7, a8).arg(a9);
   761     this->arg(a1, a2, a3, a4, a5, a6, a7, a8).arg(a9);
   658     return *this;
   762     return *this;
   659 }
   763 }
   660 
   764 
   661 /*!
   765 /*!
   662     Changes the QString that is to be used for inserting arguments to QString.
   766 
   663     
   767     Sets the localized string of the HbParameterLengthLimiter object to the 
   664     \attention Cross-Platform API
   768     value of the \a a string.
   665     
   769     
   666     \param a QString that will be used for inserting arguments
       
   667 */
   770 */
   668 HbParameterLengthLimiter& HbParameterLengthLimiter::operator=( const QString &a )
   771 HbParameterLengthLimiter& HbParameterLengthLimiter::operator=( const QString &a )
   669 {
   772 {
   670     p->str = a;
   773     p->str = a;
   671     return *this;
   774     return *this;
   672 }
   775 }
   673 
   776 
   674 /*!
   777 /*!
   675     Changes the QString that is to be used for inserting arguments to HbParameterLengthLimiter.
   778 
   676     
   779     Sets the localized string of the target HbParameterLengthLimiter object to 
   677     \attention Cross-Platform API
   780     the string contained in the \a a object.
   678     
   781     
   679     \param a HbParameterLengthLimiter holding the QString that will be used for inserting arguments
       
   680 */
   782 */
   681 HbParameterLengthLimiter& HbParameterLengthLimiter::operator=( const HbParameterLengthLimiter &a )
   783 HbParameterLengthLimiter& HbParameterLengthLimiter::operator=( const HbParameterLengthLimiter &a )
   682 {
   784 {
   683     p->str = a.p->str;
   785     p->str = a.p->str;
   684     return *this;
   786     return *this;
   685 }
   787 }
   686 
   788 
   687 /*!
   789 /*!
   688     Returns the current QString.
   790 
   689     
   791     Implicit conversion function that allows you to pass an 
   690     \attention Cross-Platform API    
   792     HbParameterLengthLimiter object in a context where a QString object is 
       
   793     expected. For example, you can use an HbParameterLengthLimiter object when 
       
   794     setting the localized text in a widget, rather than first getting the string 
       
   795     out of HbParameterLengthLimiter and then passing it to the widget.
       
   796 
   691 */
   797 */
   692 HbParameterLengthLimiter::operator QString() const
   798 HbParameterLengthLimiter::operator QString() const
   693 {
   799 {
   694     return p->str;
   800     return p->str;
   695 }
   801 }