summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorJuergen Ryannel <juergen.bocklage-ryannel@pelagicore.com>2016-12-02 17:18:04 +0100
committerJuergen Ryannel <juergen.bocklage-ryannel@pelagicore.com>2016-12-02 17:18:04 +0100
commite85817f45e649b94f745ddc26c18b584c59dc875 (patch)
tree6e9ef0b6097cf08960f80ae8750b9f7054c87b64 /README.md
parent03abac10c2e780aae54ef75b65d9e5b288a831ac (diff)
downloadqtivi-qface-e85817f45e649b94f745ddc26c18b584c59dc875.tar.gz
refactored the examples. WIP
Diffstat (limited to 'README.md')
-rw-r--r--README.md22
1 files changed, 19 insertions, 3 deletions
diff --git a/README.md b/README.md
index 247f5e9..f2524ba 100644
--- a/README.md
+++ b/README.md
@@ -41,8 +41,24 @@ struct Message {
};
```
-Now calling the generator to generate the C++ code.
-
- qface --generator qtcpp --input echo.qdl --output out
+Now you write a small script using qface to generate your code
+
+```python
+# mygenerator.py
+from qface.generator import FileSystem, Generator
+
+# load the interface files
+system = FileSystem.parse_document('echo.qdl')
+# prepare the generator
+generator = Generator(searchpath='.')
+
+# iterate over the domain model
+for module in system:
+ for interface in module:
+ # prepare a context object
+ ctx = { 'interface': interface }
+ # use header.h template with ctx to write to a file
+ generator.write('{{interface|lower}}.h', 'header.h', ctx)
+```
Depending on the used generator it reads the input file and runs it through the generator. The output files are written relative to the given output directory. The input can be either a file or a folder.