Commit 508fe04
committed
Add Python-specific SWIG wrapper with vector template instantiations
The upstream libcdoc.i only defines %template(LockVector) for
std::vector<libcdoc::Lock>. The ByteVector, ByteVectorVector, and
StringVector types used by pycdoc's __init__.py have no corresponding
%template directives — the upstream handles these via Java-specific
typemaps (#ifdef SWIGJAVA) which don't apply to Python.
This creates swig/pycdoc.i, a thin wrapper that:
- Includes the upstream libcdoc.i
- Adds %template(ByteVector) for std::vector<uint8_t>
- Adds %template(ByteVectorVector) for std::vector<std::vector<uint8_t>>
- Adds %template(StringVector) for std::vector<std::string>
- Enables %feature("director") for Python subclassing of C++ classes
CMakeLists.txt is updated to use our wrapper as the SWIG source, with
include paths pointing to both libcdoc/ (for libcdoc.i) and
libcdoc/cdoc/ (for the C++ headers).
https://claude.ai/code/session_01KccqZFv6MqP2JVWabYn3mb1 parent 81171b4 commit 508fe04
2 files changed
Lines changed: 34 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
51 | 53 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
57 | 61 | | |
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
61 | 65 | | |
62 | 66 | | |
63 | | - | |
| 67 | + | |
64 | 68 | | |
65 | 69 | | |
66 | 70 | | |
| |||
74 | 78 | | |
75 | 79 | | |
76 | 80 | | |
77 | | - | |
| 81 | + | |
78 | 82 | | |
79 | 83 | | |
80 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
0 commit comments