Permalink
Browse files

Python GC.build() and GC.version()

.. simple examples, lots of generated code changes which is
   not very helpful.

.. but the only files that were edited by hand are goldencheetah.sip
   Bindings.h and Bindings.cpp
  • Loading branch information...
liversedge committed Dec 5, 2017
1 parent 655a7c4 commit 3a534e1ff4b4393646b15daf8e887875ed0a3501
@@ -2,6 +2,7 @@
#include "Context.h"
#include "Athlete.h"
#include "Bindings.h"
#include "GcUpgrade.h"
#undef slots
#include <Python.h>
@@ -23,3 +24,13 @@ QString Bindings::athlete() const
Context *context = python->contexts.value(threadid());
return context->athlete->cyclist;
}
long Bindings::build() const
{
return VERSION_LATEST;
}
QString Bindings::version() const
{
return VERSION_STRING;
}
@@ -5,4 +5,6 @@ class Bindings {
public:
long threadid() const;
QString athlete() const;
long build() const;
QString version() const;
};
@@ -9,6 +9,7 @@
%ConvertToTypeCode
//*sipCppPtr = new QString(qpycore_PyObject_AsQString(sipPy));
//return sipGetState(sipTransferObj);
return 0;
%End
%ConvertFromTypeCode
return PyUnicode_FromString(sipCpp->toLatin1().data());
@@ -24,5 +25,7 @@ class Bindings {
public:
long threadid() const;
QString athlete() const;
int build() const;
QString version() const;
};
@@ -19,10 +19,14 @@
#define sipName_threadid &sipStrings_goldencheetah[14]
#define sipNameNr_Bindings 23
#define sipName_Bindings &sipStrings_goldencheetah[23]
#define sipNameNr_athlete 32
#define sipName_athlete &sipStrings_goldencheetah[32]
#define sipNameNr_QString 40
#define sipName_QString &sipStrings_goldencheetah[40]
#define sipNameNr_version 32
#define sipName_version &sipStrings_goldencheetah[32]
#define sipNameNr_athlete 40
#define sipName_athlete &sipStrings_goldencheetah[40]
#define sipNameNr_QString 48
#define sipName_QString &sipStrings_goldencheetah[48]
#define sipNameNr_build 56
#define sipName_build &sipStrings_goldencheetah[56]
#define sipMalloc sipAPI_goldencheetah->api_malloc
#define sipFree sipAPI_goldencheetah->api_free
@@ -6,7 +6,7 @@
#include "sipAPIgoldencheetah.h"
#line 21 "goldencheetah.sip"
#line 22 "goldencheetah.sip"
#include "Bindings.h"
#line 12 "./sipgoldencheetahBindings.cpp"
@@ -65,6 +65,56 @@ static PyObject *meth_Bindings_athlete(PyObject *sipSelf, PyObject *sipArgs)
}
extern "C" {static PyObject *meth_Bindings_build(PyObject *, PyObject *);}
static PyObject *meth_Bindings_build(PyObject *sipSelf, PyObject *sipArgs)
{
PyObject *sipParseErr = NULL;
{
const ::Bindings *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_Bindings, &sipCpp))
{
int sipRes;
sipRes = sipCpp->build();
return SIPLong_FromLong(sipRes);
}
}
/* Raise an exception if the arguments couldn't be parsed. */
sipNoMethod(sipParseErr, sipName_Bindings, sipName_build, NULL);
return NULL;
}
extern "C" {static PyObject *meth_Bindings_version(PyObject *, PyObject *);}
static PyObject *meth_Bindings_version(PyObject *sipSelf, PyObject *sipArgs)
{
PyObject *sipParseErr = NULL;
{
const ::Bindings *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_Bindings, &sipCpp))
{
::QString*sipRes;
sipRes = new ::QString(sipCpp->version());
return sipConvertFromNewType(sipRes,sipType_QString,NULL);
}
}
/* Raise an exception if the arguments couldn't be parsed. */
sipNoMethod(sipParseErr, sipName_Bindings, sipName_version, NULL);
return NULL;
}
/* Call the instance's destructor. */
extern "C" {static void release_Bindings(void *, int);}
static void release_Bindings(void *sipCppV, int)
@@ -135,7 +185,9 @@ static void *init_type_Bindings(sipSimpleWrapper *, PyObject *sipArgs, PyObject
static PyMethodDef methods_Bindings[] = {
{SIP_MLNAME_CAST(sipName_athlete), meth_Bindings_athlete, METH_VARARGS, NULL},
{SIP_MLNAME_CAST(sipName_threadid), meth_Bindings_threadid, METH_VARARGS, NULL}
{SIP_MLNAME_CAST(sipName_build), meth_Bindings_build, METH_VARARGS, NULL},
{SIP_MLNAME_CAST(sipName_threadid), meth_Bindings_threadid, METH_VARARGS, NULL},
{SIP_MLNAME_CAST(sipName_version), meth_Bindings_version, METH_VARARGS, NULL}
};
@@ -152,7 +204,7 @@ sipClassTypeDef sipTypeDef_goldencheetah_Bindings = {
{
sipNameNr_Bindings,
{0, 0, 1},
2, methods_Bindings,
4, methods_Bindings,
0, 0,
0, 0,
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
@@ -50,7 +50,8 @@ static int convertTo_QString(PyObject *sipPy,void **sipCppPtrV,int *,PyObject *s
#line 10 "goldencheetah.sip"
//*sipCppPtr = new QString(qpycore_PyObject_AsQString(sipPy));
//return sipGetState(sipTransferObj);
#line 54 "./sipgoldencheetahQString.cpp"
return 0;
#line 55 "./sipgoldencheetahQString.cpp"
}
@@ -59,9 +60,9 @@ static PyObject *convertFrom_QString(void *sipCppV, PyObject *)
{
::QString *sipCpp = reinterpret_cast< ::QString *>(sipCppV);
#line 14 "goldencheetah.sip"
#line 15 "goldencheetah.sip"
return PyUnicode_FromString(sipCpp->toLatin1().data());
#line 65 "./sipgoldencheetahQString.cpp"
#line 66 "./sipgoldencheetahQString.cpp"
}
@@ -6,7 +6,7 @@
#include "sipAPIgoldencheetah.h"
#line 21 "goldencheetah.sip"
#line 22 "goldencheetah.sip"
#include "Bindings.h"
#line 12 "./sipgoldencheetahcmodule.cpp"
@@ -15,8 +15,10 @@ const char sipStrings_goldencheetah[] = {
'g', 'o', 'l', 'd', 'e', 'n', 'c', 'h', 'e', 'e', 't', 'a', 'h', 0,
't', 'h', 'r', 'e', 'a', 'd', 'i', 'd', 0,
'B', 'i', 'n', 'd', 'i', 'n', 'g', 's', 0,
'v', 'e', 'r', 's', 'i', 'o', 'n', 0,
'a', 't', 'h', 'l', 'e', 't', 'e', 0,
'Q', 'S', 't', 'r', 'i', 'n', 'g', 0,
'b', 'u', 'i', 'l', 'd', 0,
};

0 comments on commit 3a534e1

Please sign in to comment.