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

📄 unicodeobject.h

📁 python s60 1.4.5版本的源代码
💻 H
📖 第 1 页 / 共 3 页
字号:

/* --- Latin-1 Codecs -----------------------------------------------------

   Note: Latin-1 corresponds to the first 256 Unicode ordinals.

*/

extern DL_IMPORT(PyObject*) PyUnicode_DecodeLatin1(
    const char *string, 	/* Latin-1 encoded string */
    int length,	 		/* size of string */
    const char *errors		/* error handling */
    );

extern DL_IMPORT(PyObject*) PyUnicode_AsLatin1String(
    PyObject *unicode	 	/* Unicode object */
    );

extern DL_IMPORT(PyObject*) PyUnicode_EncodeLatin1(
    const Py_UNICODE *data, 	/* Unicode char buffer */
    int length,	 		/* Number of Py_UNICODE chars to encode */
    const char *errors		/* error handling */
    );

/* --- ASCII Codecs -------------------------------------------------------

   Only 7-bit ASCII data is excepted. All other codes generate errors.

*/

extern DL_IMPORT(PyObject*) PyUnicode_DecodeASCII(
    const char *string, 	/* ASCII encoded string */
    int length,	 		/* size of string */
    const char *errors		/* error handling */
    );

extern DL_IMPORT(PyObject*) PyUnicode_AsASCIIString(
    PyObject *unicode	 	/* Unicode object */
    );

extern DL_IMPORT(PyObject*) PyUnicode_EncodeASCII(
    const Py_UNICODE *data, 	/* Unicode char buffer */
    int length,	 		/* Number of Py_UNICODE chars to encode */
    const char *errors		/* error handling */
    );

/* --- Character Map Codecs -----------------------------------------------

   This codec uses mappings to encode and decode characters.

   Decoding mappings must map single string characters to single
   Unicode characters, integers (which are then interpreted as Unicode
   ordinals) or None (meaning "undefined mapping" and causing an
   error).

   Encoding mappings must map single Unicode characters to single
   string characters, integers (which are then interpreted as Latin-1
   ordinals) or None (meaning "undefined mapping" and causing an
   error).

   If a character lookup fails with a LookupError, the character is
   copied as-is meaning that its ordinal value will be interpreted as
   Unicode or Latin-1 ordinal resp. Because of this mappings only need
   to contain those mappings which map characters to different code
   points.

*/

extern DL_IMPORT(PyObject*) PyUnicode_DecodeCharmap(
    const char *string, 	/* Encoded string */
    int length,	 		/* size of string */
    PyObject *mapping,		/* character mapping
				   (char ordinal -> unicode ordinal) */
    const char *errors		/* error handling */
    );

extern DL_IMPORT(PyObject*) PyUnicode_AsCharmapString(
    PyObject *unicode,	 	/* Unicode object */
    PyObject *mapping		/* character mapping
				   (unicode ordinal -> char ordinal) */
    );

extern DL_IMPORT(PyObject*) PyUnicode_EncodeCharmap(
    const Py_UNICODE *data, 	/* Unicode char buffer */
    int length,	 		/* Number of Py_UNICODE chars to encode */
    PyObject *mapping,		/* character mapping
				   (unicode ordinal -> char ordinal) */
    const char *errors		/* error handling */
    );

/* Translate a Py_UNICODE buffer of the given length by applying a
   character mapping table to it and return the resulting Unicode
   object.

   The mapping table must map Unicode ordinal integers to Unicode
   ordinal integers or None (causing deletion of the character).

   Mapping tables may be dictionaries or sequences. Unmapped character
   ordinals (ones which cause a LookupError) are left untouched and
   are copied as-is.

*/

extern DL_IMPORT(PyObject *) PyUnicode_TranslateCharmap(
    const Py_UNICODE *data, 	/* Unicode char buffer */
    int length,	 		/* Number of Py_UNICODE chars to encode */
    PyObject *table,		/* Translate table */
    const char *errors		/* error handling */
    );

#ifdef MS_WIN32

/* --- MBCS codecs for Windows -------------------------------------------- */

extern DL_IMPORT(PyObject*) PyUnicode_DecodeMBCS(
    const char *string,         /* MBCS encoded string */
    int length,                 /* size of string */
    const char *errors          /* error handling */
    );

extern DL_IMPORT(PyObject*) PyUnicode_AsMBCSString(
    PyObject *unicode           /* Unicode object */
    );

extern DL_IMPORT(PyObject*) PyUnicode_EncodeMBCS(
    const Py_UNICODE *data,     /* Unicode char buffer */
    int length,                 /* Number of Py_UNICODE chars to encode */
    const char *errors          /* error handling */
    );

#endif /* MS_WIN32 */

/* --- Decimal Encoder ---------------------------------------------------- */

/* Takes a Unicode string holding a decimal value and writes it into
   an output buffer using standard ASCII digit codes.

   The output buffer has to provide at least length+1 bytes of storage
   area. The output string is 0-terminated.

   The encoder converts whitespace to ' ', decimal characters to their
   corresponding ASCII digit and all other Latin-1 characters except
   \0 as-is. Characters outside this range (Unicode ordinals 1-256)
   are treated as errors. This includes embedded NULL bytes.

   Error handling is defined by the errors argument:

      NULL or "strict": raise a ValueError
      "ignore": ignore the wrong characters (these are not copied to the
		output buffer)
      "replace": replaces illegal characters with '?'

   Returns 0 on success, -1 on failure.

*/

extern DL_IMPORT(int) PyUnicode_EncodeDecimal(
    Py_UNICODE *s,		/* Unicode buffer */
    int length,			/* Number of Py_UNICODE chars to encode */
    char *output,		/* Output buffer; must have size >= length */
    const char *errors		/* error handling */
    );

/* --- Methods & Slots ----------------------------------------------------

   These are capable of handling Unicode objects and strings on input
   (we refer to them as strings in the descriptions) and return
   Unicode objects or integers as apporpriate. */

/* Concat two strings giving a new Unicode string. */

extern DL_IMPORT(PyObject*) PyUnicode_Concat(
    PyObject *left,	 	/* Left string */
    PyObject *right	 	/* Right string */
    );

/* Split a string giving a list of Unicode strings.

   If sep is NULL, splitting will be done at all whitespace
   substrings. Otherwise, splits occur at the given separator.

   At most maxsplit splits will be done. If negative, no limit is set.

   Separators are not included in the resulting list.

*/

extern DL_IMPORT(PyObject*) PyUnicode_Split(
    PyObject *s,		/* String to split */
    PyObject *sep,		/* String separator */
    int maxsplit		/* Maxsplit count */
    );

/* Dito, but split at line breaks.

   CRLF is considered to be one line break. Line breaks are not
   included in the resulting list. */

extern DL_IMPORT(PyObject*) PyUnicode_Splitlines(
    PyObject *s,		/* String to split */
    int keepends		/* If true, line end markers are included */
    );

/* Translate a string by applying a character mapping table to it and
   return the resulting Unicode object.

   The mapping table must map Unicode ordinal integers to Unicode
   ordinal integers or None (causing deletion of the character).

   Mapping tables may be dictionaries or sequences. Unmapped character
   ordinals (ones which cause a LookupError) are left untouched and
   are copied as-is.

*/

extern DL_IMPORT(PyObject *) PyUnicode_Translate(
    PyObject *str,		/* String */
    PyObject *table,		/* Translate table */
    const char *errors		/* error handling */
    );

/* Join a sequence of strings using the given separator and return
   the resulting Unicode string. */

extern DL_IMPORT(PyObject*) PyUnicode_Join(
    PyObject *separator, 	/* Separator string */
    PyObject *seq	 	/* Sequence object */
    );

/* Return 1 if substr matches str[start:end] at the given tail end, 0
   otherwise. */

extern DL_IMPORT(int) PyUnicode_Tailmatch(
    PyObject *str,		/* String */
    PyObject *substr,		/* Prefix or Suffix string */
    int start,			/* Start index */
    int end,			/* Stop index */
    int direction		/* Tail end: -1 prefix, +1 suffix */
    );

/* Return the first position of substr in str[start:end] using the
   given search direction or -1 if not found. */

extern DL_IMPORT(int) PyUnicode_Find(
    PyObject *str,		/* String */
    PyObject *substr,		/* Substring to find */
    int start,			/* Start index */
    int end,			/* Stop index */
    int direction		/* Find direction: +1 forward, -1 backward */
    );

/* Count the number of occurrences of substr in str[start:end]. */

extern DL_IMPORT(int) PyUnicode_Count(
    PyObject *str,		/* String */
    PyObject *substr,		/* Substring to count */
    int start,			/* Start index */
    int end			/* Stop index */
    );

/* Replace at most maxcount occurrences of substr in str with replstr
   and return the resulting Unicode object. */

extern DL_IMPORT(PyObject *) PyUnicode_Replace(
    PyObject *str,		/* String */
    PyObject *substr,		/* Substring to find */
    PyObject *replstr,		/* Substring to replace */
    int maxcount		/* Max. number of replacements to apply;
				   -1 = all */
    );

/* Compare two strings and return -1, 0, 1 for less than, equal,
   greater than resp. */

extern DL_IMPORT(int) PyUnicode_Compare(
    PyObject *left,		/* Left string */
    PyObject *right		/* Right string */
    );

/* Apply a argument tuple or dictionary to a format string and return
   the resulting Unicode string. */

extern DL_IMPORT(PyObject *) PyUnicode_Format(
    PyObject *format,		/* Format string */
    PyObject *args		/* Argument tuple or dictionary */
    );

/* Checks whether element is contained in container and return 1/0
   accordingly.

   element has to coerce to an one element Unicode string. -1 is
   returned in case of an error. */

extern DL_IMPORT(int) PyUnicode_Contains(
    PyObject *container,	/* Container string */
    PyObject *element		/* Element string */
    );

/* Externally visible for str.strip(unicode) */
extern DL_IMPORT(PyObject *) _PyUnicode_XStrip(
    PyUnicodeObject *self,
    int striptype,
    PyObject *sepobj
    );

/* === Characters Type APIs =============================================== */

/* These should not be used directly. Use the Py_UNICODE_IS* and
   Py_UNICODE_TO* macros instead.

   These APIs are implemented in Objects/unicodectype.c.

*/

extern DL_IMPORT(int) _PyUnicode_IsLowercase(
    Py_UNICODE ch 	/* Unicode character */
    );

extern DL_IMPORT(int) _PyUnicode_IsUppercase(
    Py_UNICODE ch 	/* Unicode character */
    );

extern DL_IMPORT(int) _PyUnicode_IsTitlecase(
    Py_UNICODE ch 	/* Unicode character */
    );

extern DL_IMPORT(int) _PyUnicode_IsWhitespace(
    Py_UNICODE ch 	/* Unicode character */
    );

extern DL_IMPORT(int) _PyUnicode_IsLinebreak(
    Py_UNICODE ch 	/* Unicode character */
    );

extern DL_IMPORT(Py_UNICODE) _PyUnicode_ToLowercase(
    Py_UNICODE ch 	/* Unicode character */
    );

extern DL_IMPORT(Py_UNICODE) _PyUnicode_ToUppercase(
    Py_UNICODE ch 	/* Unicode character */
    );

extern DL_IMPORT(Py_UNICODE) _PyUnicode_ToTitlecase(
    Py_UNICODE ch 	/* Unicode character */
    );

extern DL_IMPORT(int) _PyUnicode_ToDecimalDigit(
    Py_UNICODE ch 	/* Unicode character */
    );

extern DL_IMPORT(int) _PyUnicode_ToDigit(
    Py_UNICODE ch 	/* Unicode character */
    );

extern DL_IMPORT(double) _PyUnicode_ToNumeric(
    Py_UNICODE ch 	/* Unicode character */
    );

extern DL_IMPORT(int) _PyUnicode_IsDecimalDigit(
    Py_UNICODE ch 	/* Unicode character */
    );

extern DL_IMPORT(int) _PyUnicode_IsDigit(
    Py_UNICODE ch 	/* Unicode character */
    );

extern DL_IMPORT(int) _PyUnicode_IsNumeric(
    Py_UNICODE ch 	/* Unicode character */
    );

extern DL_IMPORT(int) _PyUnicode_IsAlpha(
    Py_UNICODE ch 	/* Unicode character */
    );

#ifdef __cplusplus
}
#endif
#endif /* Py_USING_UNICODE */
#endif /* !Py_UNICODEOBJECT_H */

⌨️ 快捷键说明

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