diff options
| author | Julian Andres Klode <jak@debian.org> | 2010-01-20 16:46:03 +0100 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2010-01-20 16:46:03 +0100 |
| commit | 074ecc0a9157027d7dbeff4fe70f0668eb5b93cb (patch) | |
| tree | 1d2d66b721ca594f9c06d15ec2d0ac825466bdc6 /doc/source/c++/embedding.rst | |
| parent | 0d3c3d391bdff23e78d693d10d43e0cc24ce16fc (diff) | |
| download | python-apt-074ecc0a9157027d7dbeff4fe70f0668eb5b93cb.tar.gz | |
doc/source/c++/api.rst: Document the C++ bindings.
Diffstat (limited to 'doc/source/c++/embedding.rst')
| -rw-r--r-- | doc/source/c++/embedding.rst | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/doc/source/c++/embedding.rst b/doc/source/c++/embedding.rst index e5816eb7..b04e0d78 100644 --- a/doc/source/c++/embedding.rst +++ b/doc/source/c++/embedding.rst @@ -1,5 +1,27 @@ +.. highlightlang:: c++ + Embedding Python APT ==================== -.. note:: +This is a very basic tutorial for working with the C++ bindings. + +Basics +------- +To use the python-apt C++ bindings, first include the +``python-apt/python-apt.h`` header:: + + #include <python-apt/python-apt.h> + +Now, the module needs to be initialized. This is done by calling the function +:cfunc:`import_apt_pkg`. This function returns 0 on success and a negative +value in case of failure:: + + if (import_apt_pkg() < 0) + return; + +Longer example +-------------- +The following code will create a standalone application which provides a +module ``client`` with the attribute ``hash`` which stores an object of the +type :class:`apt_pkg.HashString`: - The C++ API is experimental and not really documented yet. +.. literalinclude:: ../../client-example.cc |
