Split up in qt.gui & cleanup name prefix.
src/lib
Sun Jan 10 09:52:49 CET 2010 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Split up in qt.gui & cleanup name prefix.
diff -rN -u old-qt.gui/src/lib/CMakeLists.txt new-qt.gui/src/lib/CMakeLists.txt
--- old-qt.gui/src/lib/CMakeLists.txt 2014-10-30 07:41:44.000000000 +0100
+++ new-qt.gui/src/lib/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100
@@ -1,20 +0,0 @@
-find_package(Qt4)
-set(QT_DONT_USE_QTGUI true)
-include(${QT_USE_FILE})
-
-include(CheckCXXCompilerFlag)
-check_cxx_compiler_flag("-fvisibility=hidden" CXX_VISIBILITY)
-if(CXX_VISIBILITY)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
-endif(CXX_VISIBILITY)
-
-set(QT_SMOKE_SOURCES qt-smoke.cpp qstring.cpp qstringlist.cpp lisp-object.cpp qlist.cpp)
-add_library(qt-smoke-extra MODULE ${QT_SMOKE_SOURCES})
-target_link_libraries(qt-smoke-extra ${QT_LIBRARIES})
-set_target_properties(qt-smoke-extra
- PROPERTIES
- SOVERSION "0.0"
- VERSION "0.0.1")
-
-install(TARGETS qt-smoke-extra
- LIBRARY DESTINATION lib)
diff -rN -u old-qt.gui/src/lib/cl_smoke_qt.h new-qt.gui/src/lib/cl_smoke_qt.h
--- old-qt.gui/src/lib/cl_smoke_qt.h 2014-10-30 07:41:44.000000000 +0100
+++ new-qt.gui/src/lib/cl_smoke_qt.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,14 +0,0 @@
-#ifndef CL_SMOKE_QT_H
-#define CL_SMOKE_QT_H
-
-#if defined _WIN32 || defined __CYGWIN__
- #define CL_SMOKE_QT_EXPORT __declspec(dllexport)
-#else
- #if __GNUC__ >= 4
- #define CL_SMOKE_QT_EXPORT __attribute__((visibility("default")))
- #else
- #define CL_SMOKE_QT_EXPORT
- #endif
-#endif
-
-#endif // CL_SMOKE_QT_H
diff -rN -u old-qt.gui/src/lib/lisp-object.cpp new-qt.gui/src/lib/lisp-object.cpp
--- old-qt.gui/src/lib/lisp-object.cpp 2014-10-30 07:41:44.000000000 +0100
+++ new-qt.gui/src/lib/lisp-object.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,179 +0,0 @@
-#include "lisp-object.h"
-
-#include <QtGlobal>
-#include <QtDebug>
-
-namespace cl_smoke {
-namespace qt {
-
-/** @struct lisp_object::data
- * @internal
- * Holds a reference ID for a lisp object and calls
- * the destructor callback when it is deleted.
- */
-
-/** @typedef lisp_object::destructor
- * Destructor.
- * @param id The ID
- */
-
-lisp_object::destructor lisp_object::destruct = NULL;
-
-
-/** Constructor. */
-lisp_object::data::data()
-: id(id),
- is_set(false)
-{ }
-
-/** Constructor.
- * @param id The ID.
- */
-lisp_object::data::data(unsigned int id)
-: id(id),
- is_set(true)
-{ }
-
-/** Destructor. */
-lisp_object::data::~data()
-{
- Q_ASSERT_X(lisp_object::destruct, __func__,
- "call setup_lisp_object() first.");
-
- if (this->is_set)
- (*lisp_object::destruct)(this->id);
-}
-
-/** @class lisp_object
- * @brief Holds a reference ID to a lisp object.
- *
- * The registered destructor callback is called when
- * the last instance for a specific lisp object is deleted.
- *
- * Used for lisp objects in QVariants and signal/slots.
- */
-
-/** Constructor. */
-lisp_object::lisp_object()
- : d(new data())
-{ }
-
-/** Constructor.
- * @param id the ID
- */
-lisp_object::lisp_object(unsigned int id)
- : d(new data(id))
-{ }
-
-/** Constructor.
- * @param other the lisp_object to copy
- */
-lisp_object::lisp_object(const lisp_object& other)
- : d(other.d)
-{ }
-
-/** @fn lisp_object::id() const
- * Gets the ID.
- *
- * @return the ID
- */
-
-/** @fn lisp_object::set() const
- * Determines werter the ID is set.
- *
- * @return @c true when the id is set and @c false otherwise.
- */
-
-/** Sets a new ID.
- * @param id the ID
- */
-void
-lisp_object::set_id(unsigned int id)
-{
- Q_ASSERT(this->set() ? id != this->id() : true);
-
- d = new data(id);
-}
-
-} // namespace qt
-} // namespace cl_smoke
-
-using namespace cl_smoke::qt;
-
-/** Initialize the lisp_object.
- * @relates cl_smoke::qt::lisp_object
- * @param destruct destructor callback
- *
- * @return the QMetaType ID of lisp_object
- */
-int
-qt_smoke_setup_lisp_object(void* destruct)
-{
- Q_ASSERT(destruct != NULL);
- lisp_object::destruct = reinterpret_cast<lisp_object::destructor>(destruct);
-
- return qRegisterMetaType<lisp_object>();
-}
-
-/** Gets the ID of @a object.
- * @relates cl_smoke::qt::lisp_object
- * @param object the lisp_object.
- *
- * @return the ID
- */
-unsigned int
-qt_smoke_lisp_object_id(const void* object)
-{
- return static_cast<const lisp_object*>(object)->id();
-}
-
-
-/** Determines werter the ID of @a object is set.
- * @relates cl_smoke::qt::lisp_object
- * @param object the object
- *
- * @return @c true when the ID is set and @c false otherwise.
- */
-int
-qt_smoke_lisp_object_is_set(const void* object)
-{
- return static_cast<const lisp_object*>(object)->set();
-}
-
-/** Makes a new lisp_object.
- * @relates cl_smoke::qt::lisp_object
- * @param id the ID
- *
- * @return A new lisp_object instance.
- */
-void*
-qt_smoke_make_lisp_object(unsigned int id)
-{
- return new lisp_object(id);
-}
-
-/** Deletes a lisp_object.
- * @relates cl_smoke::qt::lisp_object
- * @param object the lisp_object
- */
-void*
-qt_smoke_free_lisp_object(void* object)
-{
- delete static_cast<lisp_object*>(object);
-}
-
-#include <QVariant>
-/** Gets the lisp_object of a QVariant.
- * @relates cl_smoke::qt::lisp_object
- * @param variant the QVariant
- *
- * @return a new lisp_object.
- */
-void*
-qt_smoke_lisp_object_value(const void* variant)
-{
- const QVariant* qvariant = static_cast<const QVariant*>(variant);
- Q_ASSERT(QVariant::UserType == qvariant->type());
-
- new lisp_object(qvariant->value<lisp_object>());
-}
diff -rN -u old-qt.gui/src/lib/lisp-object.h new-qt.gui/src/lib/lisp-object.h
--- old-qt.gui/src/lib/lisp-object.h 2014-10-30 07:41:44.000000000 +0100
+++ new-qt.gui/src/lib/lisp-object.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,83 +0,0 @@
-#ifndef LISP_OBJECT_H
-#define LISP_OBJECT_H
-
-#include <QMetaType>
-#include <QSharedData>
-#include <QExplicitlySharedDataPointer>
-#include <smoke.h>
-
-#include "cl_smoke_qt.h"
-
-extern "C"
-{
- CL_SMOKE_QT_EXPORT int
- qt_smoke_setup_lisp_object(void* destruct);
-
- CL_SMOKE_QT_EXPORT unsigned int
- qt_smoke_lisp_object_id(const void* object);
-
- CL_SMOKE_QT_EXPORT int
- qt_smoke_lisp_object_is_set(const void* object);
-
- CL_SMOKE_QT_EXPORT void*
- qt_smoke_make_lisp_object(unsigned int id);
-
- CL_SMOKE_QT_EXPORT void*
- qt_smoke_free_lisp_object(void* object);
-
- CL_SMOKE_QT_EXPORT void*
- qt_smoke_lisp_object_value(const void* variant);
-}
-
-namespace cl_smoke {
-namespace qt {
-
-class lisp_object
-{
- public:
- typedef void (*destructor)(unsigned int id);
-
- lisp_object();
-
- lisp_object(unsigned int id);
-
- lisp_object(const lisp_object& other);
-
- inline unsigned int
- id() const
- { Q_ASSERT(this->set()); return d->id; }
-
- void
- set_id(unsigned int id);
-
- inline bool
- set() const
- { return d->is_set; }
-
- friend int
- ::qt_smoke_setup_lisp_object(void* destruct);
-
- private:
- struct data : public QSharedData
- {
- data();
- data(unsigned int id);
- ~data();
- unsigned int id;
- bool is_set;
-
- private:
- Q_DISABLE_COPY(data)
- };
-
- QExplicitlySharedDataPointer<data> d;
-
- static destructor destruct;
-};
-
-} // namespace qt
-} // namespace cl_smoke
-
-Q_DECLARE_METATYPE(cl_smoke::qt::lisp_object);
-
-#endif // LISP_OBJECT_H
diff -rN -u old-qt.gui/src/lib/qlist.cpp new-qt.gui/src/lib/qlist.cpp
--- old-qt.gui/src/lib/qlist.cpp 2014-10-30 07:41:44.000000000 +0100
+++ new-qt.gui/src/lib/qlist.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,16 +0,0 @@
-#include "qlist.h"
-
-/** @file
- * @brief QList conversions. */
-
-#include <QVariant>
-#include <QByteArray>
-
-extern "C" {
-
-DEFINE_QLIST_WRAPPER(QVariant)
-DEFINE_QLIST_WRAPPER_PTR(void)
-DEFINE_QLIST_WRAPPER(QByteArray)
-
-
-} // extern "C"
diff -rN -u old-qt.gui/src/lib/qlist.h new-qt.gui/src/lib/qlist.h
--- old-qt.gui/src/lib/qlist.h 2014-10-30 07:41:44.000000000 +0100
+++ new-qt.gui/src/lib/qlist.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,89 +0,0 @@
-#ifndef CL_SMOKE_QT_QLIST_H
-#define CL_SMOKE_QT_QLIST_H
-
-#include <QList>
-#include "cl_smoke_qt.h"
-
-/** @file
- */
-
-/** Defines a C wrapper for the QList<@a TYPE>.
- * @param TYPE the type of the elements of the QList
- */
-#define DEFINE_QLIST_WRAPPER(TYPE) \
- DEFINE_QLIST_WRAPPER_3(TYPE, TYPE, VALUE)
-
-/** Defines a C wrapper for the QList<@a TYPE*>,
- * where @a TYPE is the of the pointer.
- *
- * @param NAME the name used for the wrapper functions.
- * @param TYPE the type of the elements
- */
-#define DEFINE_QLIST_WRAPPER_PTR(TYPE) \
- DEFINE_QLIST_WRAPPER_3(TYPE, TYPE*, PTR)
-
-/** @internal */
-#define DEFINE_QLIST_WRAPPER_3(NAME, TYPE, PTR_VALUE) \
- DEFINE_QLIST_WRAPPER_ALL_PART(NAME, TYPE) \
- DEFINE_QLIST_WRAPPER_ ## PTR_VALUE ## _PART(NAME, TYPE) \
-
-
-/** @internal
- * size, free and make_list. */
-#define DEFINE_QLIST_WRAPPER_ALL_PART(NAME, TYPE) \
-CL_SMOKE_QT_EXPORT int \
-qt_smoke_list_ ## NAME ## _size(const void* list) \
-{ \
- return static_cast<const QList< TYPE >*>(list)->size(); \
-} \
-\
-CL_SMOKE_QT_EXPORT void \
-qt_smoke_free_list_ ## NAME (void* list) \
-{ \
- delete static_cast<QList< TYPE >*>(list); \
-} \
- \
-CL_SMOKE_QT_EXPORT void* \
-qt_smoke_make_list_ ## NAME () \
-{ \
- return new QList< TYPE >(); \
-} \
- \
-
-/** @internal
- * At and append for pointer types
- */
-#define DEFINE_QLIST_WRAPPER_PTR_PART(NAME, TYPE) \
-CL_SMOKE_QT_EXPORT const void* \
-qt_smoke_list_ ## NAME ## _at(const void* list, int index) \
-{ \
- const QList< TYPE >* qlist = static_cast<const QList< TYPE > *>(list); \
- return qlist->at(index); \
-} \
-\
-CL_SMOKE_QT_EXPORT void \
-qt_smoke_list_ ## NAME ## _append(void* list, void* data) \
-{ \
- static_cast<QList< TYPE >*>(list) \
- ->append(static_cast<TYPE>(data)); \
-} \
-
-/** @internal
- * At and append for value types.
- */
-#define DEFINE_QLIST_WRAPPER_VALUE_PART(NAME, TYPE) \
-CL_SMOKE_QT_EXPORT const void* \
-qt_smoke_list_ ## NAME ## _at(const void* list, int index) \
-{ \
- const QList< TYPE >* qlist = static_cast<const QList< TYPE > *>(list); \
- return new TYPE(qlist->at(index)); \
-} \
-\
-CL_SMOKE_QT_EXPORT void \
-qt_smoke_list_ ## NAME ## _append(void* list, void* data) \
-{ \
- static_cast<QList< TYPE >*>(list) \
- ->append(*static_cast<TYPE*>(data)); \
-} \
-
-#endif // CL_SMOKE_QT_QLIST_H
diff -rN -u old-qt.gui/src/lib/qstring.cpp new-qt.gui/src/lib/qstring.cpp
--- old-qt.gui/src/lib/qstring.cpp 2014-10-30 07:41:44.000000000 +0100
+++ new-qt.gui/src/lib/qstring.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,46 +0,0 @@
-#include <QString>
-#include <QtDebug>
-
-#include "cl_smoke_qt.h"
-
-/** @file
- * @brief QString conversion. */
-
-extern "C" {
-
-/** Converts a QString to a QByteArray.
- * @param qstring Pointer to a QString
- *
- * @return a pointer to a newly allocated char array.
- */
-CL_SMOKE_QT_EXPORT void*
-qt_smoke_qstring_to_byte_array(const void* qstring)
-{
- Q_ASSERT(qstring);
- const QString* string = static_cast<const QString*>(qstring);
-
- return new QByteArray(string->toLocal8Bit());
-}
-
-/** Frees an QString.
- * @param qstring the QString to free
- */
-CL_SMOKE_QT_EXPORT void
-qt_smoke_free_qstring(void* qstring)
-{
- delete static_cast<QString*>(qstring);
-}
-
-/** Converts a string to a QString.
- * @param data a char array
- * @param length the length of @a data
- *
- * @return a newly allocated QString
- */
-CL_SMOKE_QT_EXPORT void*
-qt_smoke_string_to_qstring(const char* data, int length)
-{
- return new QString(QString::fromLocal8Bit(data, length));
-}
-
-} // extern "C"
diff -rN -u old-qt.gui/src/lib/qstringlist.cpp new-qt.gui/src/lib/qstringlist.cpp
--- old-qt.gui/src/lib/qstringlist.cpp 2014-10-30 07:41:44.000000000 +0100
+++ new-qt.gui/src/lib/qstringlist.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,71 +0,0 @@
-#include <QStringList>
-#include <QtDebug>
-#include <cstring>
-
-#include "cl_smoke_qt.h"
-
-/** @file
- * @brief QStringList conversion. */
-
-extern "C" {
-
-/** Returns the number of items of @a string_list.
- * @param string_list the QStringList
- *
- * @return the number of items
- */
-CL_SMOKE_QT_EXPORT int
-qt_smoke_string_list_size(const void* string_list)
-{
- Q_ASSERT(string_list);
- return static_cast<const QStringList*>(string_list)->size();
-}
-
-/** Returns the byte array of @a string_list at position @a index.
- * @param string_list the QStringList
- * @param index the index of the string
- *
- * @return a new allocated byte-array
- */
-CL_SMOKE_QT_EXPORT void*
-qt_smoke_string_list_at(const void* string_list, int index)
-{
- Q_ASSERT(string_list);
- const QStringList* list = static_cast<const QStringList*>(string_list);
-
- Q_ASSERT(0 <= index && index < list->size());
-
- return new QByteArray(list->at(index).toLocal8Bit());
-}
-
-/** Free a QStringList.
- * @param string_list the QStringList to free
- */
-CL_SMOKE_QT_EXPORT void
-qt_smoke_free_string_list(void* string_list)
-{
- delete static_cast<QStringList*>(string_list);
-}
-
-/** Allocates a new QStringList.
- *
- * @return a new QStringList
- */
-CL_SMOKE_QT_EXPORT void*
-qt_smoke_make_string_list()
-{
- return new QStringList();
-}
-
-/** Appends @a string to @a string_list
- * @param string_list the QStringList
- * @param data the string
- * @param length the length of @a data
- */
-CL_SMOKE_QT_EXPORT void
-qt_smoke_string_list_append(void* string_list, const char* data, int length)
-{
- static_cast<QStringList*>(string_list)->append(QString::fromLocal8Bit(data, length));
-}
-
-} // extern "C"
diff -rN -u old-qt.gui/src/lib/qt-smoke.cpp new-qt.gui/src/lib/qt-smoke.cpp
--- old-qt.gui/src/lib/qt-smoke.cpp 2014-10-30 07:41:44.000000000 +0100
+++ new-qt.gui/src/lib/qt-smoke.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,53 +0,0 @@
-#include <qnamespace.h>
-#include <QEvent>
-#include <QtDebug>
-
-#include "cl_smoke_qt.h"
-
-/** @file
- * @brief Qt support functions */
-
-#include <exception>
-
-static void
-terminate()
-{
- qFatal("caught an exception.");
-}
-
-extern "C" {
-
-/** Registers a callback to be invoked for every QEvent.
- * @see QCoreApplication::notifyInternal
- *
- * @param callback the callback
- *
- * @return @c true on success and @c false otherwise
- */
-CL_SMOKE_QT_EXPORT int
-qt_smoke_register_event_notify(void* callback)
-{
- Q_ASSERT(callback);
- std::set_terminate(terminate);
-
- return QInternal::registerCallback(QInternal::EventNotifyCallback,
- reinterpret_cast<qInternalCallback>(callback));
-}
-
-/** Returns the most specific QMetaObject of the QObject instance @a object.
- * Used to determine the actual class of an object. Smoke can not be used since it calls the
- * metaObject() of the class the method was called for.
- *
- * @param object A QObject
- *
- * @return QMetaObject
- */
-CL_SMOKE_QT_EXPORT void*
-qt_smoke_meta_object(void* object)
-{
- Q_ASSERT(object);
- static_cast<QObject*>(object)->metaObject();
-}
-
-
-} // extern "C"