File indexing completed on 2024-02-25 05:56:29

0001 /* generated by rust_qt_binding_generator */
0002 #include "test_object_rust.h"
0003 
0004 namespace {
0005 
0006     typedef void (*qstring_set)(QString* val, const char* utf8, int nbytes);
0007     void set_qstring(QString* val, const char* utf8, int nbytes) {
0008         *val = QString::fromUtf8(utf8, nbytes);
0009     }
0010     inline void personUserNameChanged(Person* o)
0011     {
0012         Q_EMIT o->userNameChanged();
0013     }
0014 }
0015 extern "C" {
0016     Person::Private* person_new(Person*, void (*)(Person*));
0017     void person_free(Person::Private*);
0018     void person_user_name_get(const Person::Private*, QString*, qstring_set);
0019     void person_user_name_set(Person::Private*, const ushort *str, int len);
0020 };
0021 
0022 Person::Person(bool /*owned*/, QObject *parent):
0023     QObject(parent),
0024     m_d(nullptr),
0025     m_ownsPrivate(false)
0026 {
0027 }
0028 
0029 Person::Person(QObject *parent):
0030     QObject(parent),
0031     m_d(person_new(this,
0032         personUserNameChanged)),
0033     m_ownsPrivate(true)
0034 {
0035 }
0036 
0037 Person::~Person() {
0038     if (m_ownsPrivate) {
0039         person_free(m_d);
0040     }
0041 }
0042 QString Person::userName() const
0043 {
0044     QString v;
0045     person_user_name_get(m_d, &v, set_qstring);
0046     return v;
0047 }
0048 void Person::setUserName(const QString& v) {
0049     person_user_name_set(m_d, reinterpret_cast<const ushort*>(v.data()), v.size());
0050 }