File: example.rst

package info (click to toggle)
pygccxml 3.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 8,444 kB
  • sloc: xml: 29,841; python: 13,914; cpp: 2,671; makefile: 163; ansic: 59
file content (24 lines) | stat: -rw-r--r-- 905 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
==========================
Elaborated type specifiers
==========================

Elaborated type specifiers are one of these four possibilities: *class*, *struct*, *union* or *enum*.

In C++ they can often be skipped (but may be useful; see `this interesting topic`_ for example).
In C code they are mandatory.

Let's consider the following c++ file:

.. literalinclude:: example.hpp
   :language: c++
   :lines: 5-

The following code will show how the elaborated type specifiers are treated in pygccxml.
Please note that this feature is only available since recent versions of *CastXML* (Mar 1, 2017),
and a special flag needs to be passed to pygccxml to make this work (castxml_epic_version=1).

.. literalinclude:: example.py
   :language: python
   :lines: 6,7,8,17-27,29-

.. _`this interesting topic`: http://stackoverflow.com/questions/1675351/typedef-struct-vs-struct-definitions/1675446#1675446