File: example.rst

package info (click to toggle)
pygccxml 3.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 8,444 kB
  • sloc: xml: 29,841; python: 13,914; cpp: 2,671; makefile: 163; ansic: 59
file content (34 lines) | stat: -rw-r--r-- 872 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
25
26
27
28
29
30
31
32
33
34
=======
Caching
=======

This example shows how to use caching. This can be useful
for big projects where you don't want the c++ to be parsed
again and again.

Let's consider the following c++ file:

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

To enable caching, you can use the following code:

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

The first time you run this example, the c++ file will be read and a xml
file will be generated:

INFO Creating xml file "example.hpp.xml" from source file "example.hpp" ...
INFO Parsing xml file "example.hpp.xml" ...
My name is: ns

The second time you run the example the xml file will not be regenerated:

INFO Parsing xml file "example.hpp.xml" ...
My name is: ns

Of course the performance gain will be small for this example,
but can be intersting for bigger projects.