os/ossrv/genericopenlibs/openenvcore/include/locale.dosc
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/** @file ../include/locale.h
sl@0
     2
@internalComponent
sl@0
     3
*/
sl@0
     4
sl@0
     5
/** @fn  localeconv(void)
sl@0
     6
sl@0
     7
@return   The localeconv function returns a pointer to a static object
sl@0
     8
which may be altered by later calls to setlocale or localeconv.
sl@0
     9
sl@0
    10
The localeconv function returns a pointer to a structure which provides parameters for formatting numbers, especially currency values: 
sl@0
    11
@code
sl@0
    12
struct lconv {
sl@0
    13
        char    *decimal_point;
sl@0
    14
        char    *thousands_sep;
sl@0
    15
        char    *grouping;
sl@0
    16
        char    *int_curr_symbol;
sl@0
    17
        char    *currency_symbol;
sl@0
    18
        char    *mon_decimal_point;
sl@0
    19
        char    *mon_thousands_sep;
sl@0
    20
        char    *mon_grouping;
sl@0
    21
        char    *positive_sign;
sl@0
    22
        char    *negative_sign;
sl@0
    23
        char    int_frac_digits;
sl@0
    24
        char    frac_digits;
sl@0
    25
        char    p_cs_precedes;
sl@0
    26
        char    p_sep_by_space;
sl@0
    27
        char    n_cs_precedes;
sl@0
    28
        char    n_sep_by_space;
sl@0
    29
        char    p_sign_posn;
sl@0
    30
        char    n_sign_posn;
sl@0
    31
        char    int_p_cs_precedes;
sl@0
    32
        char    int_n_cs_precedes;
sl@0
    33
        char    int_p_sep_by_space;
sl@0
    34
        char    int_n_sep_by_space;
sl@0
    35
        char    int_p_sign_posn;
sl@0
    36
        char    int_n_sign_posn;
sl@0
    37
};
sl@0
    38
sl@0
    39
@endcode
sl@0
    40
sl@0
    41
sl@0
    42
The individual fields have the following meanings: 
sl@0
    43
@code
sl@0
    44
decimal_point  The decimal point character, except for currency values, cannot be an empty string.  
sl@0
    45
thousands_sep  The separator between groups of digits before the decimal point, except for currency values.  
sl@0
    46
grouping  The sizes of the groups of digits, except for currency values.  
sl@0
    47
int_curr_symbol  The standardized international currency symbol.  
sl@0
    48
currency_symbol  The local currency symbol.  
sl@0
    49
mon_decimal_point  The decimal point character for currency values.  
sl@0
    50
mon_thousands_sep  The separator for digit groups in currency values.  
sl@0
    51
mon_grouping  Like grouping but for currency values.  
sl@0
    52
positive_sign  The character used to denote nonnegative currency values, usually the empty string.  
sl@0
    53
negative_sign  The character used to denote negative currency values, usually a minus sign.  
sl@0
    54
int_frac_digits  The number of digits after the decimal point in an international-style currency value.  
sl@0
    55
frac_digits  The number of digits after the decimal point in the local style for currency values.  
sl@0
    56
p_cs_precedes  1 if the currency symbol precedes the currency value for nonnegative values, 0 if it follows.  
sl@0
    57
p_sep_by_space  1 if a space is inserted between the currency symbol and the currency value for nonnegative values, 0 otherwise.  
sl@0
    58
n_cs_precedes  Like p_cs_precedes but for negative values.  
sl@0
    59
n_sep_by_space  Like p_sep_by_space but for negative values.  
sl@0
    60
p_sign_posn  The location of the positive_sign with respect to a nonnegative quantity and the currency_symbol, coded as follows: 
sl@0
    61
@endcode
sl@0
    62
sl@0
    63
@code
sl@0
    64
0  Parentheses around the entire string.  
sl@0
    65
1  Before the string.  
sl@0
    66
2  After the string.  
sl@0
    67
3  Just before currency_symbol.  
sl@0
    68
4  Just after currency_symbol.  
sl@0
    69
@endcode
sl@0
    70
sl@0
    71
@code
sl@0
    72
n_sign_posn  
sl@0
    73
  Like p_sign_posn but for negative currency values.  
sl@0
    74
int_p_cs_precedes  
sl@0
    75
  Same as p_cs_precedes, but for internationally formatted monetary quantities.  
sl@0
    76
int_n_cs_precedes  
sl@0
    77
  Same as n_cs_precedes, but for internationally formatted monetary quantities.  
sl@0
    78
int_p_sep_by_space  
sl@0
    79
  Same as p_sep_by_space, but for internationally formatted monetary quantities.  
sl@0
    80
int_n_sep_by_space  
sl@0
    81
  Same as n_sep_by_space, but for internationally formatted monetary quantities.  
sl@0
    82
int_p_sign_posn  
sl@0
    83
  Same as p_sign_posn, but for internationally formatted monetary quantities.  
sl@0
    84
int_n_sign_posn  
sl@0
    85
  Same as n_sign_posn, but for internationally formatted monetary quantities.  
sl@0
    86
@endcode
sl@0
    87
sl@0
    88
sl@0
    89
Unless mentioned above, an empty string as a value for a field indicates a zero length result or a value that is not in the current locale. A CHAR_MAX result similarly denotes an unavailable value. 
sl@0
    90
sl@0
    91
Note: By default smartphone's monetary  settings will be returned from the localeconv instead of "C" structure
sl@0
    92
sl@0
    93
Examples:
sl@0
    94
@code
sl@0
    95
#include<stdio.h>
sl@0
    96
#include<locale.h>
sl@0
    97
int main()
sl@0
    98
{
sl@0
    99
        //Set the locale to German
sl@0
   100
        char* locale = setlocale(LC_ALL,"de_DE.ISO-8859-1");
sl@0
   101
        struct lconv* str = NULL;
sl@0
   102
        //Check whether locale setting is succesful or not
sl@0
   103
        if(NULL != locale)
sl@0
   104
        {
sl@0
   105
              printf("Locale setting is successful
sl@0
   106
");
sl@0
   107
              printf("Locale is set to %s
sl@0
   108
", locale);
sl@0
   109
              //Get numeric formatting information
sl@0
   110
              str = localeconv();
sl@0
   111
              printf("Decimal separator is %s
sl@0
   112
", str->mon_decimal_point);
sl@0
   113
              printf("Thousand separator is %s
sl@0
   114
", str->mon_thousands_sep);
sl@0
   115
        }
sl@0
   116
        else
sl@0
   117
        {
sl@0
   118
              printf("Locale setting failed
sl@0
   119
");
sl@0
   120
        }
sl@0
   121
        return 0;
sl@0
   122
}
sl@0
   123
sl@0
   124
@endcode
sl@0
   125
 Output
sl@0
   126
@code
sl@0
   127
Locale setting is successful
sl@0
   128
Locale is set to de_DE.ISO-8859-1
sl@0
   129
Decimal separator is,
sl@0
   130
Thousand separator is.
sl@0
   131
sl@0
   132
@endcode
sl@0
   133
@see setlocale()
sl@0
   134
@see strfmon()
sl@0
   135
sl@0
   136
sl@0
   137
sl@0
   138
sl@0
   139
sl@0
   140
@publishedAll
sl@0
   141
@externallyDefinedApi
sl@0
   142
*/
sl@0
   143
sl@0
   144
/** @fn  setlocale(int category, const char *locale)
sl@0
   145
@param category
sl@0
   146
@param locale
sl@0
   147
@return   Upon successful completion, setlocale returns the string associated with the specified category for the requested locale. The setlocale function returns NULL and fails to change the locale
sl@0
   148
if the given combination of category and locale makes no sense.
sl@0
   149
sl@0
   150
The setlocale function sets the C library’s notion of natural language formatting style for particular sets of routines. Each such style is called a 'locale' and is invoked using an appropriate name passed as a C string. 
sl@0
   151
The setlocale function recognizes several categories of routines. These are the categories and the sets of routines they select: 
sl@0
   152
sl@0
   153
@code
sl@0
   154
LC_ALL  Set the entire locale generically.  
sl@0
   155
LC_COLLATE  Set a locale for string collation routines. Currently locale setting does not have effect on this category.  
sl@0
   156
LC_CTYPE  This controls recognition of upper and lower case, alphabetic or non-alphabetic characters, and so on. Currently locale setting does not have effect on this category.  
sl@0
   157
LC_MESSAGES  
sl@0
   158
  Set a locale for message catalogs. Currently this category is not supported.  
sl@0
   159
LC_MONETARY  
sl@0
   160
  Set a locale for formatting monetary values; this affects the localeconv function.  
sl@0
   161
LC_NUMERIC  Set a locale for formatting numbers. This controls the formatting of decimal points in input and output of floating point numbers in functions such as printf and scanf, as well as values returned by localeconv.  
sl@0
   162
LC_TIME  Set a locale for formatting dates and times using the strftime function.  
sl@0
   163
@endcode
sl@0
   164
sl@0
   165
sl@0
   166
Only three locales are defined by default, the empty string which denotes the native environment, and the C and POSIX locales, which denote the C language environment. A locale argument of NULL causes setlocale to return the current locale. By default, C programs start in the C locale. The only function in the library that sets the locale is setlocale; the locale is never changed as a side effect of some other routine. 
sl@0
   167
sl@0
   168
sl@0
   169
Examples:
sl@0
   170
@code
sl@0
   171
#include<stdio.h>
sl@0
   172
#include<locale.h>
sl@0
   173
int main()
sl@0
   174
{
sl@0
   175
        //Set the locale to UK English
sl@0
   176
        char* locale = setlocale(LC_ALL,"en_GB.ISO-8859-1");
sl@0
   177
        //Check whether locale setting is succesful or not
sl@0
   178
        if(NULL != locale)
sl@0
   179
        {
sl@0
   180
                printf("Locale setting is successful
sl@0
   181
");
sl@0
   182
                printf("Locale is set to %s
sl@0
   183
", locale);
sl@0
   184
        }
sl@0
   185
        else
sl@0
   186
        {
sl@0
   187
                printf("Locale setting failed
sl@0
   188
");
sl@0
   189
        }
sl@0
   190
        return 0;
sl@0
   191
}
sl@0
   192
sl@0
   193
@endcode
sl@0
   194
 Output
sl@0
   195
@code
sl@0
   196
Locale setting is successful
sl@0
   197
Locale is set to en_GB.ISO-8859-1
sl@0
   198
sl@0
   199
@endcode
sl@0
   200
@see localeconv()
sl@0
   201
@see nl_langinfo()
sl@0
   202
sl@0
   203
sl@0
   204
 
sl@0
   205
sl@0
   206
@publishedAll
sl@0
   207
@externallyDefinedApi
sl@0
   208
*/
sl@0
   209
sl@0
   210
sl@0
   211
/** @struct lconv
sl@0
   212
sl@0
   213
Includes the following members,
sl@0
   214
sl@0
   215
@publishedAll
sl@0
   216
@externallyDefinedApi
sl@0
   217
*/
sl@0
   218
sl@0
   219
/** @var lconv::decimal_point
sl@0
   220
sl@0
   221
The operand is a string containing the symbol that shall be used as the decimal delimiter (radix character) in numeric, non-monetary formatted quantities. This keyword cannot be omitted and cannot be set to the empty string. In contexts where standards limit the decimal_point to a single byte, the result of specifying a multi-byte operand shall be unspecified.
sl@0
   222
sl@0
   223
*/
sl@0
   224
sl@0
   225
/** @var lconv::thousands_sep
sl@0
   226
sl@0
   227
The operand is a string containing the symbol that shall be used as a separator for groups of digits to the left of the decimal delimiter in numeric, non-monetary formatted monetary quantities. In contexts where standards limit the thousands_sep to a single byte, the result of specifying a multi-byte operand shall be unspecified.
sl@0
   228
sl@0
   229
*/
sl@0
   230
sl@0
   231
/** @var lconv::grouping
sl@0
   232
sl@0
   233
Define the size of each group of digits in formatted non-monetary quantities. The operand is a sequence of integers separated by semicolons. Each integer specifies the number of digits in each group, with the initial integer defining the size of the group immediately preceding the decimal delimiter, and the following integers defining the preceding groups. If the last integer is not -1, then the size of the previous group (if any) shall be repeatedly used for the remainder of the digits. If the last integer is -1, then no further grouping shall be performed.
sl@0
   234
sl@0
   235
*/
sl@0
   236
sl@0
   237
/** @var lconv::int_curr_symbol
sl@0
   238
sl@0
   239
The international currency symbol. The operand shall be a four-character string, with the first three characters containing the alphabetic international currency symbol. The international currency symbol should be chosen in accordance with those specified in the ISO 4217 standard. The fourth character shall be the character used to separate the international currency symbol from the monetary quantity.
sl@0
   240
sl@0
   241
*/
sl@0
   242
sl@0
   243
/** @var lconv::currency_symbol
sl@0
   244
sl@0
   245
The string that shall be used as the local currency symbol.
sl@0
   246
sl@0
   247
*/
sl@0
   248
sl@0
   249
/** @var lconv::mon_decimal_point
sl@0
   250
sl@0
   251
The operand is a string containing the symbol that shall be used as the decimal delimiter (radix character) in monetary formatted quantities.
sl@0
   252
sl@0
   253
*/
sl@0
   254
sl@0
   255
/** @var lconv::mon_thousands_sep
sl@0
   256
sl@0
   257
The operand is a string containing the symbol that shall be used as a separator for groups of digits to the left of the decimal delimiter in formatted monetary quantities.
sl@0
   258
sl@0
   259
*/
sl@0
   260
sl@0
   261
/** @var lconv::mon_grouping
sl@0
   262
sl@0
   263
Define the size of each group of digits in formatted monetary quantities. The operand is a sequence of integers separated by semicolons. Each integer specifies the number of digits in each group, with the initial integer defining the size of the group immediately preceding the decimal delimiter, and the following integers defining the preceding groups. If the last integer is not -1, then the size of the previous group (if any) shall be repeatedly used for the remainder of the digits. If the last integer is -1, then no further grouping shall be performed.
sl@0
   264
sl@0
   265
*/
sl@0
   266
sl@0
   267
/** @var lconv::positive_sign
sl@0
   268
sl@0
   269
A string that shall be used to indicate a non-negative-valued formatted monetary quantity.
sl@0
   270
sl@0
   271
*/
sl@0
   272
sl@0
   273
/** @var lconv::negative_sign
sl@0
   274
sl@0
   275
A string that shall be used to indicate a negative-valued formatted monetary quantity.
sl@0
   276
sl@0
   277
*/
sl@0
   278
sl@0
   279
/** @var lconv::int_frac_digits
sl@0
   280
sl@0
   281
An integer representing the number of fractional digits (those to the right of the decimal delimiter) to be written in a formatted monetary quantity using int_curr_symbol.
sl@0
   282
sl@0
   283
*/
sl@0
   284
sl@0
   285
/** @var lconv::frac_digits
sl@0
   286
sl@0
   287
An integer representing the number of fractional digits (those to the right of the decimal delimiter) to be written in a formatted monetary quantity using currency_symbol.
sl@0
   288
sl@0
   289
*/
sl@0
   290
sl@0
   291
/** @var lconv::p_cs_precedes
sl@0
   292
sl@0
   293
An integer set to 1 if the currency_symbol precedes the value for a monetary quantity with a non-negative value, and set to 0 if the symbol succeeds the value.
sl@0
   294
sl@0
   295
*/
sl@0
   296
sl@0
   297
/** @var lconv::p_sep_by_space
sl@0
   298
sl@0
   299
Set to a value indicating the separation of the currency_symbol, the sign string, and the value for a non-negative formatted monetary quantity.
sl@0
   300
sl@0
   301
*/
sl@0
   302
sl@0
   303
/** @var lconv::n_cs_precedes
sl@0
   304
sl@0
   305
An integer set to 1 if the currency_symbol precedes the value for a monetary quantity with a negative value, and set to 0 if the symbol succeeds the value.
sl@0
   306
sl@0
   307
*/
sl@0
   308
sl@0
   309
/** @var lconv::n_sep_by_space
sl@0
   310
sl@0
   311
Set to a value indicating the separation of the currency_symbol, the sign string, and the value for a negative formatted monetary quantity.
sl@0
   312
sl@0
   313
*/
sl@0
   314
sl@0
   315
/** @var lconv::p_sign_posn
sl@0
   316
sl@0
   317
An integer set to a value indicating the positioning of the positive_sign for a monetary quantity with a non-negative value.
sl@0
   318
sl@0
   319
*/
sl@0
   320
sl@0
   321
/** @var lconv::n_sign_posn
sl@0
   322
sl@0
   323
An integer set to a value indicating the positioning of the negative_sign for a negative formatted monetary quantity.
sl@0
   324
sl@0
   325
*/
sl@0
   326
sl@0
   327
/** @var lconv::int_p_cs_precedes
sl@0
   328
sl@0
   329
An integer set to 1 if the int_curr_symbol precedes the value for a monetary quantity with a non-negative value, and set to 0 if the symbol succeeds the value.
sl@0
   330
sl@0
   331
*/
sl@0
   332
sl@0
   333
/** @var lconv::int_n_cs_precedes
sl@0
   334
sl@0
   335
An integer set to 1 if the int_curr_symbol precedes the value for a monetary quantity with a negative value, and set to 0 if the symbol succeeds the value.
sl@0
   336
sl@0
   337
*/
sl@0
   338
sl@0
   339
/** @var lconv::int_p_sep_by_space
sl@0
   340
sl@0
   341
Set to a value indicating the separation of the int_curr_symbol, the sign string, and the value for a non-negative internationally formatted monetary quantity.
sl@0
   342
sl@0
   343
*/
sl@0
   344
sl@0
   345
/** @var lconv::int_n_sep_by_space
sl@0
   346
sl@0
   347
Set to a value indicating the separation of the int_curr_symbol, the sign string, and the value for a negative internationally formatted monetary quantity.
sl@0
   348
sl@0
   349
*/
sl@0
   350
sl@0
   351
/** @var lconv::int_p_sign_posn
sl@0
   352
sl@0
   353
An integer set to a value indicating the positioning of the positive_sign for a positive monetary quantity formatted with the international format.
sl@0
   354
sl@0
   355
*/
sl@0
   356
sl@0
   357
/** @var lconv::int_n_sign_posn
sl@0
   358
sl@0
   359
An integer set to a value indicating the positioning of the negative_sign for a negative monetary quantity formatted with the international format.
sl@0
   360
sl@0
   361
*/
sl@0
   362
sl@0
   363
/** @def LC_ALL
sl@0
   364
sl@0
   365
It shall expand to distinct integer constant expressions, for use as the first argument to the setlocale() function.
sl@0
   366
sl@0
   367
@publishedAll
sl@0
   368
@externallyDefinedApi
sl@0
   369
*/
sl@0
   370
sl@0
   371
/** @def LC_COLLATE
sl@0
   372
sl@0
   373
It shall expand to distinct integer constant expressions, for use as the first argument to the setlocale() function.
sl@0
   374
sl@0
   375
@publishedAll
sl@0
   376
@externallyDefinedApi
sl@0
   377
*/
sl@0
   378
sl@0
   379
/** @def LC_CTYPE
sl@0
   380
sl@0
   381
It shall expand to distinct integer constant expressions, for use as the first argument to the setlocale() function.
sl@0
   382
sl@0
   383
@publishedAll
sl@0
   384
@externallyDefinedApi
sl@0
   385
*/
sl@0
   386
sl@0
   387
/** @def LC_MONETARY
sl@0
   388
sl@0
   389
It shall expand to distinct integer constant expressions, for use as the first argument to the setlocale() function.
sl@0
   390
sl@0
   391
@publishedAll
sl@0
   392
@externallyDefinedApi
sl@0
   393
*/
sl@0
   394
sl@0
   395
/** @def LC_NUMERIC
sl@0
   396
sl@0
   397
It shall expand to distinct integer constant expressions, for use as the first argument to the setlocale() function.
sl@0
   398
sl@0
   399
@publishedAll
sl@0
   400
@externallyDefinedApi
sl@0
   401
*/
sl@0
   402
sl@0
   403
/** @def LC_TIME	
sl@0
   404
sl@0
   405
It shall expand to distinct integer constant expressions, for use as the first argument to the setlocale() function.
sl@0
   406
sl@0
   407
@publishedAll
sl@0
   408
@externallyDefinedApi
sl@0
   409
*/
sl@0
   410
sl@0
   411
/** @def LC_MESSAGES
sl@0
   412
sl@0
   413
It shall expand to distinct integer constant expressions, for use as the first argument to the setlocale() function.
sl@0
   414
sl@0
   415
@publishedAll
sl@0
   416
@externallyDefinedApi
sl@0
   417
*/
sl@0
   418
sl@0
   419
/** @def _LC_LAST
sl@0
   420
sl@0
   421
It shall expand to distinct integer constant expressions, for use as the first argument to the setlocale() function.
sl@0
   422
sl@0
   423
@publishedAll
sl@0
   424
@released
sl@0
   425
*/