Boudewijn Rempt
|
Flag Name | Meaning |
---|---|
PARSE_OK | Parse is Ok so far |
PARSE_MANY | Too many arguments |
PARSE_FEW | Too few arguments |
PARSE_TYPE | Argument with a bad type |
PARSE_MASK | Mask covering the error flag bits |
sipArgs
A pointer to a tuple which supplies the arguments to be parsed.
fmt
Format string describing arguments. A leading '-' in the format string disposes of the arguments on a successful parse. A '|' in the format string signifies that the following arguments are optional. The following format specifiers are recognized:
Table C-2. Format specifiers for sipParseArgs()
fmt Operand type expected C argument(s) s String or None char ** S Slot name, return the name char ** G Signal name, return the name char ** I Class instance int (*convfunc)(PyObject *), PyObject ** O Python object of any type PyObject ** T Python object of given type PyTypeObject *, PyObject ** R Sub-class of QObject PyObject ** F Python callable object PyObject ** a Byte array or None char **, int * c Character char * i Integer int * h Short integer short * l Long integer long * f Float float * d Double float double * v Void pointer void **
...
A variable number of pointers to the arguments which will take the parsed values.
Examples
Example C-1. Interface for QRegExp::match
// Attempts to match in str, starting from position index. // Returns the position of the match, or -1 if there was no match. // if len is not a null pointer, the length of the match is stored in *len. int match(const char* str, int index=0, int*=0) const; %MemberCode // The Python interface returns the position and length as a tuple. const char *str; int index = 0; if (sipParseArgs(&sipArgsParsed, sipArgs, "s|i", &str, &index)) { int pos, len; QRegExp *ptr; if ((ptr = (QRegExp*) sipGetCppPtr(sipThis, sipClass_QRegExp)) == NULL) return NULL; pos = ptr -> QRegExp::match(str, index, &len); return Py_BuildValue("(ii)", pos, len); } %End