ObjQt  Check-in [6c336e34d7]

Overview
Comment:Handle NULL / nil in toOF() / toQt()
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6c336e34d7fe497b08441f08d84580243aaea999b70a048031a58c6c562b8891
User & Date: js on 2017-05-14 01:07:21
Other Links: manifest | tags
Context
2017-07-23
12:15
Adjust to ObjFW changes check-in: 142cffefb2 user: js tags: trunk
2017-05-14
01:07
Handle NULL / nil in toOF() / toQt() check-in: 6c336e34d7 user: js tags: trunk
00:57
Declare designated initializers check-in: 201f28b1d1 user: js tags: trunk
Changes

Modified src/QtCore/QtChildEvent.h from [32943bf9e4] to [cc67226409].

38
39
40
41
42
43
44



45
46
47
48
49
50
51
52
53
54
55
@end

namespace ObjQt {

static OF_INLINE QtChildEvent *
toOF(QChildEvent *qChildEvent)
{



	return [[[QtChildEvent alloc]
	    initWithQChildEvent: qChildEvent] autorelease];
}

static OF_INLINE QChildEvent *
toQt(QtChildEvent *childEvent)
{
	return [childEvent qChildEvent];
}

}







>
>
>











38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
@end

namespace ObjQt {

static OF_INLINE QtChildEvent *
toOF(QChildEvent *qChildEvent)
{
	if (qChildEvent == NULL)
		return nil;

	return [[[QtChildEvent alloc]
	    initWithQChildEvent: qChildEvent] autorelease];
}

static OF_INLINE QChildEvent *
toQt(QtChildEvent *childEvent)
{
	return [childEvent qChildEvent];
}

}

Modified src/QtCore/QtCoreApplication.h from [85b036ea11] to [f2a00d6135].

41
42
43
44
45
46
47



48
49
50
51
52
53
54
55
56
57
58
@end

namespace ObjQt {

static OF_INLINE QtCoreApplication *
toOF(QCoreApplication *qCoreApplication)
{



	return [[[QtCoreApplication alloc]
	    initWithQCoreApplication: qCoreApplication] autorelease];
}

static OF_INLINE QCoreApplication *
toQt(QtCoreApplication *coreApplication)
{
	return [coreApplication qCoreApplication];
}

}







>
>
>











41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
@end

namespace ObjQt {

static OF_INLINE QtCoreApplication *
toOF(QCoreApplication *qCoreApplication)
{
	if (qCoreApplication == NULL)
		return nil;

	return [[[QtCoreApplication alloc]
	    initWithQCoreApplication: qCoreApplication] autorelease];
}

static OF_INLINE QCoreApplication *
toQt(QtCoreApplication *coreApplication)
{
	return [coreApplication qCoreApplication];
}

}

Modified src/QtCore/QtEvent.h from [9eeffc99c5] to [24149a7d9b].

45
46
47
48
49
50
51



52
53
54
55
56
57
58
59
60
61
@end

namespace ObjQt {

static OF_INLINE QtEvent *
toOF(QEvent *qEvent)
{



	return [[[QtEvent alloc] initWithQEvent: qEvent] autorelease];
}

static OF_INLINE QEvent *
toQt(QtEvent *event)
{
	return [event qEvent];
}

}







>
>
>










45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
@end

namespace ObjQt {

static OF_INLINE QtEvent *
toOF(QEvent *qEvent)
{
	if (qEvent == NULL)
		return nil;

	return [[[QtEvent alloc] initWithQEvent: qEvent] autorelease];
}

static OF_INLINE QEvent *
toQt(QtEvent *event)
{
	return [event qEvent];
}

}

Modified src/QtCore/QtObject.h from [3fdad31715] to [76db7e3c84].

83
84
85
86
87
88
89



90
91
92
93
94
95
96
97
98
99
@end

namespace ObjQt {

static OF_INLINE QtObject *
toOF(QObject *qObject)
{



	return [[[QtObject alloc] initWithQObject: qObject] autorelease];
}

static OF_INLINE QObject *
toQt(QtObject *object)
{
	return [object qObject];
}

}







>
>
>










83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
@end

namespace ObjQt {

static OF_INLINE QtObject *
toOF(QObject *qObject)
{
	if (qObject == NULL)
		return nil;

	return [[[QtObject alloc] initWithQObject: qObject] autorelease];
}

static OF_INLINE QObject *
toQt(QtObject *object)
{
	return [object qObject];
}

}

Modified src/QtCore/QtThread.h from [43ef120cbc] to [e673e5e739].

46
47
48
49
50
51
52



53
54
55
56
57
58
59
60
61
62
@end

namespace ObjQt {

static OF_INLINE QtThread *
toOF(QThread *qThread)
{



	return [[[QtThread alloc] initWithQThread: qThread] autorelease];
}

static OF_INLINE QThread *
toQt(QtThread *thread)
{
	return [thread qThread];
}

}







>
>
>










46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
@end

namespace ObjQt {

static OF_INLINE QtThread *
toOF(QThread *qThread)
{
	if (qThread == NULL)
		return nil;

	return [[[QtThread alloc] initWithQThread: qThread] autorelease];
}

static OF_INLINE QThread *
toQt(QtThread *thread)
{
	return [thread qThread];
}

}

Modified src/QtGui/QtGUIApplication.h from [189b609e87] to [205e5d23cc].

47
48
49
50
51
52
53



54
55
56
57
58
59
60
61
62
63
64
@end

namespace ObjQt {

static OF_INLINE QtGUIApplication *
toOF(QGuiApplication *qGuiApplication)
{



	return [[[QtGUIApplication alloc]
	    initWithQGuiApplication: qGuiApplication] autorelease];
}

static OF_INLINE QGuiApplication *
toQt(QtGUIApplication *GUIApplication)
{
	return [GUIApplication qGuiApplication];
}

}







>
>
>











47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
@end

namespace ObjQt {

static OF_INLINE QtGUIApplication *
toOF(QGuiApplication *qGuiApplication)
{
	if (qGuiApplication == NULL)
		return nil;

	return [[[QtGUIApplication alloc]
	    initWithQGuiApplication: qGuiApplication] autorelease];
}

static OF_INLINE QGuiApplication *
toQt(QtGUIApplication *GUIApplication)
{
	return [GUIApplication qGuiApplication];
}

}

Modified src/QtWidgets/QtAbstractButton.h from [fb433a7608] to [4bfce82261].

45
46
47
48
49
50
51



52
53
54
55
56
57
58
59
60
61
62
@end

namespace ObjQt {

static OF_INLINE QtAbstractButton *
toOF(QAbstractButton *qAbstractButton)
{



	return [[[QtAbstractButton alloc]
	    initWithQAbstractButton: qAbstractButton] autorelease];
}

static OF_INLINE QAbstractButton *
toQt(QtAbstractButton *abstractButton)
{
	return [abstractButton qAbstractButton];
}

}







>
>
>











45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
@end

namespace ObjQt {

static OF_INLINE QtAbstractButton *
toOF(QAbstractButton *qAbstractButton)
{
	if (qAbstractButton == NULL)
		return nil;

	return [[[QtAbstractButton alloc]
	    initWithQAbstractButton: qAbstractButton] autorelease];
}

static OF_INLINE QAbstractButton *
toQt(QtAbstractButton *abstractButton)
{
	return [abstractButton qAbstractButton];
}

}

Modified src/QtWidgets/QtAction.h from [a42f7769d7] to [7e60480e14].

67
68
69
70
71
72
73



74
75
76
77
78
79
80
81
82
83
@end

namespace ObjQt {

static OF_INLINE QtAction *
toOF(QAction *qAction)
{



	return [[[QtAction alloc] initWithQAction: qAction] autorelease];
}

static OF_INLINE QAction *
toQt(QtAction *action)
{
	return [action qAction];
}

}







>
>
>










67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
@end

namespace ObjQt {

static OF_INLINE QtAction *
toOF(QAction *qAction)
{
	if (qAction == NULL)
		return nil;

	return [[[QtAction alloc] initWithQAction: qAction] autorelease];
}

static OF_INLINE QAction *
toQt(QtAction *action)
{
	return [action qAction];
}

}

Modified src/QtWidgets/QtApplication.h from [fa444a862d] to [37ef3d484f].

43
44
45
46
47
48
49



50
51
52
53
54
55
56
57
58
59
60
@end

namespace ObjQt {

static OF_INLINE QtApplication *
toOF(QApplication *qApplication)
{



	return [[[QtApplication alloc]
	    initWithQApplication: qApplication] autorelease];
}

static OF_INLINE QApplication *
toQt(QtApplication *application)
{
	return [application qApplication];
}

}







>
>
>











43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
@end

namespace ObjQt {

static OF_INLINE QtApplication *
toOF(QApplication *qApplication)
{
	if (qApplication == NULL)
		return nil;

	return [[[QtApplication alloc]
	    initWithQApplication: qApplication] autorelease];
}

static OF_INLINE QApplication *
toQt(QtApplication *application)
{
	return [application qApplication];
}

}

Modified src/QtWidgets/QtPushButton.h from [f5a84ec4a3] to [0c750e4bdb].

41
42
43
44
45
46
47



48
49
50
51
52
53
54
55
56
57
58
@end

namespace ObjQt {

static OF_INLINE QtPushButton *
toOF(QPushButton *qPushButton)
{



	return [[[QtPushButton alloc]
	    initWithQPushButton: qPushButton] autorelease];
}

static OF_INLINE QPushButton *
toQt(QtPushButton *pushButton)
{
	return [pushButton qPushButton];
}

}







>
>
>











41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
@end

namespace ObjQt {

static OF_INLINE QtPushButton *
toOF(QPushButton *qPushButton)
{
	if (qPushButton == NULL)
		return nil;

	return [[[QtPushButton alloc]
	    initWithQPushButton: qPushButton] autorelease];
}

static OF_INLINE QPushButton *
toQt(QtPushButton *pushButton)
{
	return [pushButton qPushButton];
}

}

Modified src/QtWidgets/QtWidget.h from [0274ca44b6] to [5d9835a3dd].

225
226
227
228
229
230
231



232
233
234
235
236
237
238
239
240
241
@end

namespace ObjQt {

static OF_INLINE QtWidget *
toOF(QWidget *qWidget)
{



	return [[[QtWidget alloc] initWithQWidget: qWidget] autorelease];
}

static OF_INLINE QWidget *
toQt(QtWidget *widget)
{
	return [widget qWidget];
}

}







>
>
>










225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
@end

namespace ObjQt {

static OF_INLINE QtWidget *
toOF(QWidget *qWidget)
{
	if (qWidget == NULL)
		return nil;

	return [[[QtWidget alloc] initWithQWidget: qWidget] autorelease];
}

static OF_INLINE QWidget *
toQt(QtWidget *widget)
{
	return [widget qWidget];
}

}

Modified src/common/OFDataArray+QByteArray.h from [f833005f89] to [0d699d1d90].

30
31
32
33
34
35
36



37
38
39
40
41
42



43
44
45
46
@end

namespace ObjQt {

static OF_INLINE OFDataArray *
toOF(const QByteArray &qByteArray)
{



	return [OFDataArray dataArrayWithQByteArray: qByteArray];
}

static OF_INLINE QByteArray
toQt(OFDataArray *dataArray)
{



	return [dataArray qByteArray];
}

}







>
>
>






>
>
>




30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
@end

namespace ObjQt {

static OF_INLINE OFDataArray *
toOF(const QByteArray &qByteArray)
{
	if (qByteArray.isNull())
		return nil;

	return [OFDataArray dataArrayWithQByteArray: qByteArray];
}

static OF_INLINE QByteArray
toQt(OFDataArray *dataArray)
{
	if (dataArray == nil)
		return QByteArray();

	return [dataArray qByteArray];
}

}

Modified src/common/OFString+QString.h from [fc2a76aadc] to [99046e4f05].

31
32
33
34
35
36
37



38
39
40
41
42
43



44
45
46
47
@end

namespace ObjQt {

static OF_INLINE OFString *
toOF(const QString &qString)
{



	return [OFString stringWithQString: qString];
}

static OF_INLINE QString
toQt(OFString *string)
{



	return [string qString];
}

}







>
>
>






>
>
>




31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
@end

namespace ObjQt {

static OF_INLINE OFString *
toOF(const QString &qString)
{
	if (qString.isNull())
		return nil;

	return [OFString stringWithQString: qString];
}

static OF_INLINE QString
toQt(OFString *string)
{
	if (string == nil)
		return QString();

	return [string qString];
}

}

Modified src/common/helpers.h from [07b560bcd3] to [a7449889b6].

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
static OF_INLINE of_point_t
toOF(const QPoint &qPoint)
{
	return of_point(qPoint.x(), qPoint.y());
}

static OF_INLINE QPoint
toQt(of_point_t point)
{
	return QPoint(point.x, point.y);
}

static OF_INLINE of_dimension_t
toOF(const QSize &qSize)
{
	return of_dimension(qSize.width(), qSize.height());
}

static OF_INLINE QSize
toQt(of_dimension_t dimension)
{
	return QSize(dimension.width, dimension.height);
}

static OF_INLINE of_rectangle_t
toOF(const QRect &qRect)
{
	return of_rectangle(qRect.x(), qRect.y(),
	    qRect.width(), qRect.height());
}

static OF_INLINE QRect
toQt(of_rectangle_t rectangle)
{
	return QRect(rectangle.origin.x, rectangle.origin.y,
	    rectangle.size.width, rectangle.size.height);
}

}







|











|












|






37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
static OF_INLINE of_point_t
toOF(const QPoint &qPoint)
{
	return of_point(qPoint.x(), qPoint.y());
}

static OF_INLINE QPoint
toQt(const of_point_t &point)
{
	return QPoint(point.x, point.y);
}

static OF_INLINE of_dimension_t
toOF(const QSize &qSize)
{
	return of_dimension(qSize.width(), qSize.height());
}

static OF_INLINE QSize
toQt(const of_dimension_t &dimension)
{
	return QSize(dimension.width, dimension.height);
}

static OF_INLINE of_rectangle_t
toOF(const QRect &qRect)
{
	return of_rectangle(qRect.x(), qRect.y(),
	    qRect.width(), qRect.height());
}

static OF_INLINE QRect
toQt(const of_rectangle_t &rectangle)
{
	return QRect(rectangle.origin.x, rectangle.origin.y,
	    rectangle.size.width, rectangle.size.height);
}

}