Line data Source code
1 : /* NOTE: this API is -ONLY- for use with single byte character strings. */
2 : /* Do not use it with Unicode. */
3 :
4 : #include "bytes_methods.h"
5 :
6 : static PyObject*
7 0 : stringlib_isspace(PyObject *self)
8 : {
9 0 : return _Py_bytes_isspace(STRINGLIB_STR(self), STRINGLIB_LEN(self));
10 : }
11 :
12 : static PyObject*
13 0 : stringlib_isalpha(PyObject *self)
14 : {
15 0 : return _Py_bytes_isalpha(STRINGLIB_STR(self), STRINGLIB_LEN(self));
16 : }
17 :
18 : static PyObject*
19 0 : stringlib_isalnum(PyObject *self)
20 : {
21 0 : return _Py_bytes_isalnum(STRINGLIB_STR(self), STRINGLIB_LEN(self));
22 : }
23 :
24 : static PyObject*
25 0 : stringlib_isdigit(PyObject *self)
26 : {
27 0 : return _Py_bytes_isdigit(STRINGLIB_STR(self), STRINGLIB_LEN(self));
28 : }
29 :
30 : static PyObject*
31 0 : stringlib_islower(PyObject *self)
32 : {
33 0 : return _Py_bytes_islower(STRINGLIB_STR(self), STRINGLIB_LEN(self));
34 : }
35 :
36 : static PyObject*
37 0 : stringlib_isupper(PyObject *self)
38 : {
39 0 : return _Py_bytes_isupper(STRINGLIB_STR(self), STRINGLIB_LEN(self));
40 : }
41 :
42 : static PyObject*
43 0 : stringlib_istitle(PyObject *self)
44 : {
45 0 : return _Py_bytes_istitle(STRINGLIB_STR(self), STRINGLIB_LEN(self));
46 : }
47 :
48 :
49 : /* functions that return a new object partially translated by ctype funcs: */
50 :
51 : static PyObject*
52 0 : stringlib_lower(PyObject *self)
53 : {
54 : PyObject* newobj;
55 0 : newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self));
56 0 : if (!newobj)
57 0 : return NULL;
58 0 : _Py_bytes_lower(STRINGLIB_STR(newobj), STRINGLIB_STR(self),
59 : STRINGLIB_LEN(self));
60 0 : return newobj;
61 : }
62 :
63 : static PyObject*
64 0 : stringlib_upper(PyObject *self)
65 : {
66 : PyObject* newobj;
67 0 : newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self));
68 0 : if (!newobj)
69 0 : return NULL;
70 0 : _Py_bytes_upper(STRINGLIB_STR(newobj), STRINGLIB_STR(self),
71 : STRINGLIB_LEN(self));
72 0 : return newobj;
73 : }
74 :
75 : static PyObject*
76 0 : stringlib_title(PyObject *self)
77 : {
78 : PyObject* newobj;
79 0 : newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self));
80 0 : if (!newobj)
81 0 : return NULL;
82 0 : _Py_bytes_title(STRINGLIB_STR(newobj), STRINGLIB_STR(self),
83 : STRINGLIB_LEN(self));
84 0 : return newobj;
85 : }
86 :
87 : static PyObject*
88 0 : stringlib_capitalize(PyObject *self)
89 : {
90 : PyObject* newobj;
91 0 : newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self));
92 0 : if (!newobj)
93 0 : return NULL;
94 0 : _Py_bytes_capitalize(STRINGLIB_STR(newobj), STRINGLIB_STR(self),
95 : STRINGLIB_LEN(self));
96 0 : return newobj;
97 : }
98 :
99 : static PyObject*
100 0 : stringlib_swapcase(PyObject *self)
101 : {
102 : PyObject* newobj;
103 0 : newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self));
104 0 : if (!newobj)
105 0 : return NULL;
106 0 : _Py_bytes_swapcase(STRINGLIB_STR(newobj), STRINGLIB_STR(self),
107 : STRINGLIB_LEN(self));
108 0 : return newobj;
109 : }
|