⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c_locale.h

📁 使用QT为linux 下的mplayer写的一个新的gui
💻 H
📖 第 1 页 / 共 2 页
字号:
/*
 * Copyright (c) 1999
 * Silicon Graphics Computer Systems, Inc.
 *
 * Copyright (c) 1999
 * Boris Fomitchev
 *
 * This material is provided "as is", with absolutely no warranty expressed
 * or implied. Any use is at your own risk.
 *
 * Permission to use or copy this software for any purpose is hereby granted
 * without fee, provided the above notices are retained on all copies.
 * Permission to modify the code and to distribute modified code is granted,
 * provided the above notices are retained, and a notice that the code was
 * modified is included with the above copyright notice.
 *
 */

/*
 * It is impossible to write the C++ locale library in terms of locales
 * as defined in the C standard.  Instead, we write the C++ locale and I/O
 * library in terms of a low level C-like interface.  This file defines
 * that interface.
 *
 * The low-level locale interface can't be written portably; there
 * must be a version of it for each platform that the C++ library
 * is ported to.  On many systems this interface may be a thin wrapper
 * for existing functionality.
 */

#ifndef _STLP_C_LOCALE_IMPL_H
#define _STLP_C_LOCALE_IMPL_H

#include "stlport_prefix.h"
#include <stl/c_locale.h>

#ifdef _STLP_REAL_LOCALE_IMPLEMENTED
#  if defined (_STLP_USE_GLIBC) && !defined (__CYGWIN__)
#    include <nl_types.h>
#  endif
#endif

/*
 * A number: the maximum length of a simple locale name.
 * (i.e. a name like like en_US, as opposed to a name like
 * en_US/de_AT/de_AT/es_MX/en_US/en_US) */
#define _Locale_MAX_SIMPLE_NAME 256

/*
 * Maximum length of a composite locale.
 */
#define _Locale_MAX_COMPOSITE_NAME 6*(_Locale_MAX_SIMPLE_NAME+3)

#ifdef __cplusplus
extern "C" {
#endif

/*
 * Typedefs:
 */
#if (defined (__GNUC__) && !defined (__MINGW32__)) || defined (_KCC) || defined (__ICC)
typedef unsigned short int _Locale_mask_t;
#else
typedef unsigned int _Locale_mask_t;
#endif

/* Function called during STLport library load phase. Might contain any
 * code necessary to the platform localization layer.
 */
void _Locale_init();

/* Function called during STLport library unload. Might contain any
 * code necessary to the platform localization layer.
 */
void _Locale_final();

/* Create a category of the locale with the given name.
 *
 * The char* argument is a simple (not a composite) locale name, which may
 * neither be an empty string nor a null pointer.
 *
 * These functions return NULL to indicate failure.
 *
 * Note These functions return a void* instead of the appropriate
 * _Locale_* struct because they are used with __acquire_category which
 * requires that all functions have the same signature.
 */
void * _Locale_ctype_create(const char *, struct _Locale_name_hint*);
void * _Locale_numeric_create(const char *, struct _Locale_name_hint*);
void * _Locale_time_create(const char *, struct _Locale_name_hint*);
void * _Locale_collate_create(const char *, struct _Locale_name_hint*);
void * _Locale_monetary_create(const char *, struct _Locale_name_hint*);
void * _Locale_messages_create(const char *, struct _Locale_name_hint*);


/* Release a category of a locale
 *
 * These functions are used to release a category acquired with the
 * according _Locale_*_create() functions.
 *
 * Note: For the same reasons as for the *_create functions, these
 * take void* instead of the correct types so that they can be used
 * with __release_category.
 */
void _Locale_ctype_destroy(void *);
void _Locale_numeric_destroy(void *);
void _Locale_time_destroy(void *);
void _Locale_collate_destroy(void *);
void _Locale_monetary_destroy(void *);
void _Locale_messages_destroy(void *);


/*
 * Returns the name of the user's default locale in each
 * category, as a null-terminated string.  A NULL value
 * means the default "C" locale.
 */
const char * _Locale_ctype_default(char * __buf);
const char * _Locale_numeric_default(char * __buf);
const char * _Locale_time_default(char * __buf);
const char * _Locale_collate_default(char * __buf);
const char * _Locale_monetary_default(char * __buf);
const char * _Locale_messages_default(char * __buf);


/* Retrieve the name of the given category
 *
 * __buf points to a buffer that can hold at least _Locale_MAX_SIMPLE_NAME
 * characters.  These functions store the name, as a null-terminated
 * string, in __buf.
 * TODO: can this fail? How is that signalled then?
 */
char const* _Locale_ctype_name(const void *, char* __buf);
char const* _Locale_numeric_name(const void *, char* __buf);
char const* _Locale_time_name(const void *, char* __buf);
char const* _Locale_collate_name(const void *, char*  __buf);
char const* _Locale_monetary_name(const void *, char* __buf);
char const* _Locale_messages_name(const void *, char* __buf);


/*
 * cname is a (possibly composite) locale name---i.e. a name that can
 * be passed to setlocale. __buf points to an array large enough to
 * store at least _Locale_MAX_SIMPLE_NAME characters, and each of these
 * functions extracts the name of a single category, stores it in buf
 * as a null-terminated string, and returns buf.
 */
char const* _Locale_extract_ctype_name(const char *cname, char *__buf, struct _Locale_name_hint* __hint);
char const* _Locale_extract_numeric_name(const char *cname, char *__buf, struct _Locale_name_hint* __hint);
char const* _Locale_extract_time_name(const char *cname, char *__buf, struct _Locale_name_hint* __hint);
char const* _Locale_extract_collate_name(const char *cname, char *__buf, struct _Locale_name_hint* __hint);
char const* _Locale_extract_monetary_name(const char *cname, char *__buf, struct _Locale_name_hint* __hint);
char const* _Locale_extract_messages_name(const char *cname, char *__buf, struct _Locale_name_hint* __hint);

/*
 * The inputs to this function are six null-terminated strings: the
 * names of a locale's six categories.  Locale names for non-standard
 * categories are taken from __DefaultName.
 * __buf is a pointer to an array large enough to store at least
 * _Locale_MAX_COMPOSITE_NAME characters.
 * This function constructs a (possibly composite) name describing the
 * locale as a whole, stores that name in buf as a null-terminated
 * string, and returns buf.
 */
char const* _Locale_compose_name(char *__buf,
                                 const char *__Ctype, const char *__Numeric,
                                 const char *__Time, const char *__Collate,
                                 const char *__Monetary, const char *__Messages,
                                 const char *__DefaultName);

/* Funstions to improve locale creation process. For some locale API (Win32)
 * you need to find a locale identification from the name which can be a
 * rather expensive operation especially if you do so for all facets of a
 * locale. Those functions can be used to extract from a API dependent facet
 * struct the information necessary to skip this lookup process for other
 * facets creation. If not supported those function should return NULL.
 */
struct _Locale_name_hint* _Locale_get_ctype_hint(struct _Locale_ctype*);
struct _Locale_name_hint* _Locale_get_numeric_hint(struct _Locale_numeric*);
struct _Locale_name_hint* _Locale_get_time_hint(struct _Locale_time*);
struct _Locale_name_hint* _Locale_get_collate_hint(struct _Locale_collate*);
struct _Locale_name_hint* _Locale_get_monetary_hint(struct _Locale_monetary*);
struct _Locale_name_hint* _Locale_get_messages_hint(struct _Locale_messages*);

/*
 * FUNCTIONS THAT USE CTYPE
 */

/*
 * Narrow character functions:
 */

/*
 * Returns a pointer to the beginning of the ctype table.  The table is
 * at least 257 bytes long; if p is the pointer returned by this
 * function, then p[c] is valid if c is EOF or if p is any value of
 * type unsigned char.
 */
const _Locale_mask_t * _Locale_ctype_table(struct _Locale_ctype *);

/*
 * c is either EOF, or an unsigned char value.
 */
int _Locale_toupper(struct _Locale_ctype *, int);
int _Locale_tolower(struct _Locale_ctype *, int);


# ifndef _STLP_NO_WCHAR_T
/*
 * Wide character functions:
 */
_Locale_mask_t _Locale_wchar_ctype(struct _Locale_ctype *, wint_t,
  _Locale_mask_t);
wint_t _Locale_wchar_tolower(struct _Locale_ctype *, wint_t);
wint_t _Locale_wchar_toupper(struct _Locale_ctype *, wint_t);
# endif

# if !defined ( _STLP_NO_MBSTATE_T )

/*
 * Multibyte functions:
 */

int _Locale_mb_cur_max (struct _Locale_ctype *);
/*
 * Returns the number of bytes of the longest allowed multibyte
 * character in the current encoding.
 */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -