bytes_methods.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef Py_LIMITED_API
  2. #ifndef Py_BYTES_CTYPE_H
  3. #define Py_BYTES_CTYPE_H
  4. /*
  5. * The internal implementation behind PyBytes (bytes) and PyByteArray (bytearray)
  6. * methods of the given names, they operate on ASCII byte strings.
  7. */
  8. extern PyObject* _Py_bytes_isspace(const char *cptr, Py_ssize_t len);
  9. extern PyObject* _Py_bytes_isalpha(const char *cptr, Py_ssize_t len);
  10. extern PyObject* _Py_bytes_isalnum(const char *cptr, Py_ssize_t len);
  11. extern PyObject* _Py_bytes_isascii(const char *cptr, Py_ssize_t len);
  12. extern PyObject* _Py_bytes_isdigit(const char *cptr, Py_ssize_t len);
  13. extern PyObject* _Py_bytes_islower(const char *cptr, Py_ssize_t len);
  14. extern PyObject* _Py_bytes_isupper(const char *cptr, Py_ssize_t len);
  15. extern PyObject* _Py_bytes_istitle(const char *cptr, Py_ssize_t len);
  16. /* These store their len sized answer in the given preallocated *result arg. */
  17. extern void _Py_bytes_lower(char *result, const char *cptr, Py_ssize_t len);
  18. extern void _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len);
  19. extern void _Py_bytes_title(char *result, const char *s, Py_ssize_t len);
  20. extern void _Py_bytes_capitalize(char *result, const char *s, Py_ssize_t len);
  21. extern void _Py_bytes_swapcase(char *result, const char *s, Py_ssize_t len);
  22. extern PyObject *_Py_bytes_find(const char *str, Py_ssize_t len, PyObject *args);
  23. extern PyObject *_Py_bytes_index(const char *str, Py_ssize_t len, PyObject *args);
  24. extern PyObject *_Py_bytes_rfind(const char *str, Py_ssize_t len, PyObject *args);
  25. extern PyObject *_Py_bytes_rindex(const char *str, Py_ssize_t len, PyObject *args);
  26. extern PyObject *_Py_bytes_count(const char *str, Py_ssize_t len, PyObject *args);
  27. extern int _Py_bytes_contains(const char *str, Py_ssize_t len, PyObject *arg);
  28. extern PyObject *_Py_bytes_startswith(const char *str, Py_ssize_t len, PyObject *args);
  29. extern PyObject *_Py_bytes_endswith(const char *str, Py_ssize_t len, PyObject *args);
  30. /* The maketrans() static method. */
  31. extern PyObject* _Py_bytes_maketrans(Py_buffer *frm, Py_buffer *to);
  32. /* Shared __doc__ strings. */
  33. extern const char _Py_isspace__doc__[];
  34. extern const char _Py_isalpha__doc__[];
  35. extern const char _Py_isalnum__doc__[];
  36. extern const char _Py_isascii__doc__[];
  37. extern const char _Py_isdigit__doc__[];
  38. extern const char _Py_islower__doc__[];
  39. extern const char _Py_isupper__doc__[];
  40. extern const char _Py_istitle__doc__[];
  41. extern const char _Py_lower__doc__[];
  42. extern const char _Py_upper__doc__[];
  43. extern const char _Py_title__doc__[];
  44. extern const char _Py_capitalize__doc__[];
  45. extern const char _Py_swapcase__doc__[];
  46. extern const char _Py_count__doc__[];
  47. extern const char _Py_find__doc__[];
  48. extern const char _Py_index__doc__[];
  49. extern const char _Py_rfind__doc__[];
  50. extern const char _Py_rindex__doc__[];
  51. extern const char _Py_startswith__doc__[];
  52. extern const char _Py_endswith__doc__[];
  53. extern const char _Py_maketrans__doc__[];
  54. extern const char _Py_expandtabs__doc__[];
  55. extern const char _Py_ljust__doc__[];
  56. extern const char _Py_rjust__doc__[];
  57. extern const char _Py_center__doc__[];
  58. extern const char _Py_zfill__doc__[];
  59. /* this is needed because some docs are shared from the .o, not static */
  60. #define PyDoc_STRVAR_shared(name,str) const char name[] = PyDoc_STR(str)
  61. #endif /* !Py_BYTES_CTYPE_H */
  62. #endif /* !Py_LIMITED_API */