This file is indexed.

/usr/include/qtruby/marshall_primitives.h is in libqtruby4shared-dev 4:4.8.2-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 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
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Lesser General Public License as        *
 *   published by the Free Software Foundation; either version 2 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 ***************************************************************************/

#ifndef MARSHALL_PRIMITIVES_H
#define MARSHALL_PRIMITIVES_H

template <>
bool ruby_to_primitive<bool>(VALUE v)
{
	if (TYPE(v) == T_OBJECT) {
		// A Qt::Boolean has been passed as a value
		VALUE temp = rb_funcall(qt_internal_module, rb_intern("get_qboolean"), 1, v);
		return (temp == Qtrue ? true : false);
	} else {
		return (v == Qtrue ? true : false);
	}
}

template <>
VALUE primitive_to_ruby<bool>(bool sv)
{
	return sv ? Qtrue : Qfalse;
}

template <>
signed char ruby_to_primitive<signed char>(VALUE v)
{
	return NUM2CHR(v);
}

template <>
VALUE primitive_to_ruby<signed char>(signed char sv)
{
	return CHR2FIX(sv);
}

template <>
unsigned char ruby_to_primitive<unsigned char>(VALUE v)
{
	if (v == Qnil) {
		return 0;
	} else {
		return NUM2CHR(v);
	}
}

template <>
VALUE primitive_to_ruby<unsigned char>(unsigned char sv)
{
	return CHR2FIX(sv);
}

template <>
short ruby_to_primitive<short>(VALUE v)
{
	if (v == Qnil) {
		return 0;
	} else {
		return (short)NUM2INT(v);
	}
}

template <>
VALUE primitive_to_ruby<short>(short sv)
{
	return INT2NUM(sv);
}

template <>
unsigned short ruby_to_primitive<unsigned short>(VALUE v)
{
	if (v == Qnil) {
		return 0;
	} else {
		return (unsigned short)NUM2UINT(v);
	}
}

template <>
VALUE primitive_to_ruby<unsigned short>(unsigned short sv)
{
	return UINT2NUM((unsigned int) sv);
}

template <>
int ruby_to_primitive<int>(VALUE v)
{
	if (v == Qnil) {
		return 0;
	} else if (TYPE(v) == T_OBJECT) {
		return (int)NUM2INT(rb_funcall(qt_internal_module, rb_intern("get_qinteger"), 1, v));
	} else {
		return (int)NUM2INT(v);
	}
}

template <>
VALUE primitive_to_ruby<int>(int sv)
{
	return INT2NUM(sv);
}

template <>
unsigned int ruby_to_primitive<unsigned int>(VALUE v)
{
	if (v == Qnil) {
		return 0;
	} else if (TYPE(v) == T_OBJECT) {
		return (unsigned int) NUM2UINT(rb_funcall(qt_internal_module, rb_intern("get_qinteger"), 1, v));
	} else {
		return (unsigned int) NUM2UINT(v);
	}
}

template <>
VALUE primitive_to_ruby<unsigned int>(unsigned int sv)
{
	return UINT2NUM(sv);
}

template <>
long ruby_to_primitive<long>(VALUE v)
{
	if (v == Qnil) {
		return 0;
	} else if (TYPE(v) == T_OBJECT) {
		return (long) NUM2LONG(rb_funcall(qt_internal_module, rb_intern("get_qinteger"), 1, v));
	} else {
		return (long) NUM2LONG(v);
	}
}

template <>
VALUE primitive_to_ruby<long>(long sv)
{
	return INT2NUM(sv);
}

template <>
unsigned long ruby_to_primitive<unsigned long>(VALUE v)
{
	if (v == Qnil) {
		return 0;
	} else if (TYPE(v) == T_OBJECT) {
		return (unsigned long) NUM2ULONG(rb_funcall(qt_internal_module, rb_intern("get_qinteger"), 1, v));
	} else {
		return (unsigned long) NUM2ULONG(v);
	}
}

template <>
VALUE primitive_to_ruby<unsigned long>(unsigned long sv)
{
	return INT2NUM(sv);
}

template <>
long long ruby_to_primitive<long long>(VALUE v)
{
	if (v == Qnil) {
		return 0;
	} else {
		return NUM2LL(v);
	}
}

template <>
VALUE primitive_to_ruby<long long>(long long sv)
{
	return LL2NUM(sv);
}

template <>
unsigned long long ruby_to_primitive<unsigned long long>(VALUE v)
{
	return rb_num2ull(v);
}

template <>
VALUE primitive_to_ruby<unsigned long long>(unsigned long long sv)
{
	return rb_ull2inum(sv);
}

template <>
float ruby_to_primitive<float>(VALUE v)
{
	if (v == Qnil) {
		return 0.0;
	} else {
		return (float) NUM2DBL(v);
	}
}

template <>
VALUE primitive_to_ruby<float>(float sv)
{
	return rb_float_new((double) sv);
}

template <>
double ruby_to_primitive<double>(VALUE v)
{
	if (v == Qnil) {
		return 0.0;
	} else {
		return (double) NUM2DBL(v);
	}
}

template <>
VALUE primitive_to_ruby<double>(double sv)
{
	return rb_float_new((double) sv);
}

template <>
char* ruby_to_primitive<char *>(VALUE rv)
{
	if(rv == Qnil)
		return 0;

	return StringValuePtr(rv);
}

template <>
unsigned char* ruby_to_primitive<unsigned char *>(VALUE rv)
{
	if(rv == Qnil)
		return 0;
	
	return (unsigned char*)StringValuePtr(rv);
}

template <>
VALUE primitive_to_ruby<int*>(int* sv)
{
	if(!sv) {
		return Qnil;
	}
	
	return primitive_to_ruby<int>(*sv);
}

#if defined(Q_OS_WIN32)
template <>
static WId ruby_to_primitive<WId>(VALUE v)
{
	if(v == Qnil)
		return 0;
#ifdef Q_WS_MAC32
	return (WId) NUM2INT(v);
#else
	return (WId) NUM2LONG(v);
#endif
}

template <>
static VALUE primitive_to_ruby<WId>(WId sv)
{
#ifdef Q_WS_MAC32
	return INT2NUM((unsigned long) sv);
#else
	return LONG2NUM((unsigned long) sv);
#endif
}

template <>
static Q_PID ruby_to_primitive<Q_PID>(VALUE v)
{
	if(v == Qnil)
		return 0;
	
	return (Q_PID) NUM2ULONG(v);
}

template <>
static VALUE primitive_to_ruby<Q_PID>(Q_PID sv)
{
	return ULONG2NUM((unsigned long) sv);
}
#endif

#endif