Barry Scott wrote:
> At 16-10-2003 23:29, Russell Yanofsky wrote:
>> The swig wrapper looks straighforward, although it's not clear why
>> you need so many helper functions. Couldn't a user write
>>
>> all_dirents.size()
>>
>> instead of:
>>
>> svncpp.lenDirentList( all_dirents )
>>
>> - Russ
>
> SWIG does not generate code at all for the methods on the templates.
It will if you explicitly instatiate the templates. There's an example of
this at http://www.swig.org/tutorial.html in the "Surely there's more to
it..." section. There's also more in-depth documentation on doing this at
http://www.swig.org/Doc1.3/SWIGPlus.html#n28.
> You get this:
>
> Traceback (most recent call last):
> File "test_ls.py", line 29, in ?
> main( sys.argv )
> File "test_ls.py", line 17, in main
> print all_dirents.size()
> AttributeError: 'str' object has no attribute 'size'
>
> I solved that with all the little functions. Not sure why its seen as
> a string.
Swig represents opaque pointers as strings containing address and type
information.
> I'm going to try using my PyCXX lib to remove the need for the small
> functions and allow iterators to work. PyCXX is on
> http://sourceforge.net/projects/cxx/ and will allow a pythonic API to
> be created.
PyCXX instead of SWIG? I don't see any advantages to doing that. The main
advantage that Boost::Python and (presumably) PyCXX have over SWIG is that
they let you easily access Python features from C++, so you can build cool
hybrid C++/Python apps. But in this case, you're not implementing parts of
the library in python, just exposing it all to python. Beyond that, using
PyCXX would give you two potential disadvantages:
1) The SvnCpp bindings wouldn't be able to interoperate with the Subversion
C bindings.
2) The SvnCpp bindings wouldn't be available to Perl, Java, Ruby, PHP, etc,
etc users.
- Russ
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 18 23:46:14 2003