repos
/
qt.core
/ annotate_shade
summary
|
shortlog
|
log
|
tree
|
commit
|
commitdiff
|
headdiff
|
annotate
|
headblob
|
headfilediff
|
filehistory
normal
|
plain
|
shade
|
zebra
QVector<T> translation
Annotate for file /src/operator.lisp
2010-01-10 tobias
1
(in-package :cl-smoke.qt.core)
2009-04-12 tobias
2
19:56:34 '
3
(defun cxx:= (object &rest more-objects)
'
4
(if (null more-objects)
'
5
t
'
6
(every #'(lambda (o)
2009-05-27 tobias
7
;; Consider Class::operator== and operator==
17:18:41 '
8
;; FIXME integrate this in the overload resolution
2010-01-23 tobias
9
(if (typep object 'smoke-standard-object)
2009-08-27 tobias
10
(handler-case (qt:operator== object o)
2010-01-23 tobias
11
(no-applicable-cxx-method ()
2009-08-27 tobias
12
(cxx:operator== object o)))
08:37:36 '
13
(qt:operator== object o)))
2009-04-12 tobias
14
more-objects)))
19:56:34 '
15
'
16
(defun cxx:/= (object &rest more-objects)
'
17
(if (null more-objects)
'
18
t
'
19
(some #'(lambda (o)
'
20
(qt:operator!= object o))
'
21
more-objects)))
'
22
'
23
(defun ordered-p (relation list)
'
24
"Returns true when LIST is ordered according to RELATION."
'
25
(if (or (null list) (null (rest list)))
'
26
t
'
27
(and (funcall relation (first list)
'
28
(second list))
'
29
(ordered-p relation (rest list)))))
'
30
'
31
(defmacro define-cxx-relation (relation)
'
32
`(defun ,(intern (symbol-name relation) :cxx) (object &rest more-objects)
'
33
(ordered-p (symbol-function (quote ,(intern (format nil "OPERATOR~A"
'
34
relation)
'
35
:qt)))
'
36
(cons object more-objects))))
'
37
'
38
(defmacro define-cxx-relations (&rest relations)
'
39
`(progn
'
40
,@(mapcar #'(lambda (r) `(define-cxx-relation ,r)) relations)))
'
41
2009-04-15 tobias
42
(define-cxx-relations < <= >= >)
2009-04-12 tobias
43
19:56:34 '
44
'
45
(defun cxx:incf (object &optional (delta 1))
'
46
(cxx:operator+= object delta))
'
47
'
48
(defun cxx:decf (object &optional (delta 1))
'
49
(cxx:operator-= object delta))
'
50
'
51
(defun cxx:+ (&rest args)
'
52
(if (null args)
'
53
0
'
54
(reduce #'qt:operator+ args)))
'
55
'
56
(defun cxx:- (object &rest subtrahends)
'
57
(if (null subtrahends)
'
58
(cxx:operator- object)
'
59
(reduce #'qt:operator- (cons object subtrahends))))
'
60
'
61
(defun cxx:* (&rest args)
'
62
(if (null args)
'
63
1
'
64
(reduce #'qt:operator- args)))
'
65
'
66
(defun cxx:/ (object &rest denominators)
'
67
(if (null denominators)
'
68
(qt:operator/ 1 object)
'
69
(qt:operator/ object (apply #'cxx:+ denominators))))
'
70
'
71
(defun cxx:1+ (object)
'
72
(qt:operator+ object 1))
'
73
'
74
(defun cxx:1- (object)
'
75
(qt:operator- object 1))
'
76
'
77
(defun cxx:aref (object index)
'
78
"Returns the element of OBJECT at position INDEX."
'
79
(declare ((integer 0) index))
'
80
(assert (< index (cxx:size object))
'
81
(index)
'
82
"Index ~A for ~A requested, but the length is ~A"
'
83
index object (cxx:size object))
'
84
(cxx:at object index))
'
85
'
86
'
87
(defun (setf cxx:aref) (new-value object index)
'
88
(declare ((integer 0) index))
'
89
(assert (< index (cxx:size object))
'
90
(index)
'
91
"Index ~A for ~A requested, but the length is ~A"
'
92
index object (cxx:size object))
'
93
(cxx:operator= (cxx:operator[] object index)
'
94
new-value)
'
95
new-value)