Fix potential lisp-object ID generation overflow for excessive lisp-object creation.
Annotate for file src/lib/lisp-object.h
2010-01-10 tobias 1 #ifndef LISP_OBJECT_H
08:52:49 ' 2 #define LISP_OBJECT_H
' 3
' 4 #include <QMetaType>
' 5 #include <QSharedData>
' 6 #include <QExplicitlySharedDataPointer>
' 7 #include <smoke.h>
' 8
' 9 #include "cl_smoke_qt.h"
' 10
' 11 extern "C"
' 12 {
' 13 CL_SMOKE_QT_EXPORT int
' 14 qt_smoke_setup_lisp_object(void* destruct);
' 15
2009-07-02 tobias 16 CL_SMOKE_QT_EXPORT unsigned int
2010-01-10 tobias 17 qt_smoke_lisp_object_id(const void* object);
08:52:49 ' 18
' 19 CL_SMOKE_QT_EXPORT int
2009-07-02 tobias 20 qt_smoke_lisp_object_is_set(const void* object);
2010-01-10 tobias 21
08:52:49 ' 22 CL_SMOKE_QT_EXPORT void*
2009-07-02 tobias 23 qt_smoke_make_lisp_object(unsigned int id);
2010-01-10 tobias 24
08:52:49 ' 25 CL_SMOKE_QT_EXPORT void*
' 26 qt_smoke_free_lisp_object(void* object);
' 27
' 28 CL_SMOKE_QT_EXPORT void*
' 29 qt_smoke_lisp_object_value(const void* variant);
' 30 }
' 31
' 32 namespace cl_smoke {
' 33 namespace qt {
' 34
' 35 class lisp_object
' 36 {
' 37 public:
2009-07-02 tobias 38 typedef void (*destructor)(unsigned int id);
2010-01-10 tobias 39
08:52:49 ' 40 lisp_object();
' 41
2009-07-02 tobias 42 lisp_object(unsigned int id);
2010-01-10 tobias 43
08:52:49 ' 44 lisp_object(const lisp_object& other);
' 45
2009-07-02 tobias 46 inline unsigned int
2010-01-10 tobias 47 id() const
08:52:49 ' 48 { Q_ASSERT(this->set()); return d->id; }
' 49
' 50 void
2009-07-02 tobias 51 set_id(unsigned int id);
2010-01-10 tobias 52
08:52:49 ' 53 inline bool
' 54 set() const
' 55 { return d->is_set; }
' 56
' 57 friend int
' 58 ::qt_smoke_setup_lisp_object(void* destruct);
' 59
' 60 private:
' 61 struct data : public QSharedData
' 62 {
' 63 data();
2009-07-02 tobias 64 data(unsigned int id);
2010-01-10 tobias 65 ~data();
2009-07-02 tobias 66 unsigned int id;
2010-01-10 tobias 67 bool is_set;
08:52:49 ' 68
' 69 private:
' 70 Q_DISABLE_COPY(data)
' 71 };
' 72
' 73 QExplicitlySharedDataPointer<data> d;
' 74
' 75 static destructor destruct;
' 76 };
' 77
' 78 } // namespace qt
' 79 } // namespace cl_smoke
' 80
' 81 Q_DECLARE_METATYPE(cl_smoke::qt::lisp_object);
' 82
' 83 #endif // LISP_OBJECT_H