summaryrefslogtreecommitdiffstats
path: root/doc/tutorial/libfoo.rst
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2009-08-17 19:31:37 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2009-08-17 19:31:37 -0300
commite0c29962e6f334452f0c9db2caaf6ed18065de85 (patch)
treecee27801c196fbcacf6130ad64216af133b555dd /doc/tutorial/libfoo.rst
downloadshiboken-e0c29962e6f334452f0c9db2caaf6ed18065de85.tar.gz
shiboken-e0c29962e6f334452f0c9db2caaf6ed18065de85.tar.xz
shiboken-e0c29962e6f334452f0c9db2caaf6ed18065de85.zip
The End Is the Beginning Is the End
Diffstat (limited to 'doc/tutorial/libfoo.rst')
-rw-r--r--doc/tutorial/libfoo.rst68
1 files changed, 68 insertions, 0 deletions
diff --git a/doc/tutorial/libfoo.rst b/doc/tutorial/libfoo.rst
new file mode 100644
index 00000000..217577a4
--- /dev/null
+++ b/doc/tutorial/libfoo.rst
@@ -0,0 +1,68 @@
+.. highlight:: cpp
+
+.. _gentut-libfoo:
+
+Creating the foo library
+=========================
+
+In this section is the code and build instructions for a very simple Qt4 based
+library which will serve as a subject for this tutorial.
+
+The Source Code
+---------------
+
+There is only one class on this foo library plus a ``.pro`` file which means
+that the build system used will be Trolltech's **qmake**.
+
+Put the files below in a directory called **libfoo**. Be aware that this
+directory will be refered by the binding Makefile presented in a next section
+of this tutorial. If you want to use other names or paths change the binding
+Makefile accordingly. Blind copy'n'paste shortens your life.
+
+**libfoo/foo.h**
+::
+
+ #ifndef FOO_H
+ #define FOO_H
+
+ #include <QtCore/QtCore>
+
+ class Math : public QObject
+ {
+ Q_OBJECT
+ public:
+ Math() {}
+ virtual ~Math() {}
+ int squared(int x);
+ };
+ #endif // FOO_H
+
+
+**libfoo/foo.cpp**
+::
+
+ #include "foo.h"
+
+ int Math::squared(int x)
+ {
+ return x * x;
+ }
+
+
+**libfoo/foo.pro**
+::
+
+ TEMPLATE = lib
+ TARGET = foo
+ DEPENDPATH += .
+ INCLUDEPATH += .
+ HEADERS += foo.h
+ SOURCES += foo.cpp
+
+To build the lib:
+
+::
+
+ $ cd libfoo
+ $ qmake
+ $ make