Opened 17 years ago
Last modified 13 months ago
#204 assigned defect
Sort out C# and Java bindings to avoid SWIGTYPE
Reported by: | Olly Betts | Owned by: | Olly Betts |
---|---|---|---|
Priority: | normal | Milestone: | 2.0.0 |
Component: | Xapian-bindings (C#) | Version: | git master |
Severity: | normal | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Operating System: | All |
Description (last modified by )
The SWIGTYPE_p_*.cs files are C# wrappers around raw C/C++ types, which can't be naturally used from C#. We should adjust the bindings to wrap these properly.
The same issue affects our Java bindings too.
Change History (9)
comment:1 by , 17 years ago
Operating System: | → All |
---|---|
Status: | new → assigned |
comment:3 by , 17 years ago
Description: | modified (diff) |
---|---|
Owner: | changed from | to
Status: | assigned → new |
comment:4 by , 15 years ago
Component: | Xapian-bindings → Xapian-bindings (C#) |
---|
comment:5 by , 13 years ago
comment:6 by , 4 years ago
Milestone: | → 1.5.0 |
---|---|
Version: | SVN trunk → git master |
In git master RangeProcessor
has replaced ValueRangeProcessor
and returns a Query
object, so that one is gone now.
$ rgrep SWIGTYPE generated-csharp/*.cs generated-csharp/Compactor.cs: public virtual string ResolveDuplicateMetadata(string key, uint num_tags, SWIGTYPE_p_std__string tags) { generated-csharp/Compactor.cs: string ret = (SwigDerivedClassHasMethod("ResolveDuplicateMetadata", swigMethodTypes1) ? XapianPINVOKE.Compactor_ResolveDuplicateMetadataSwigExplicitCompactor(swigCPtr, key, num_tags, SWIGTYPE_p_std__string.getCPtr(tags)) : XapianPINVOKE.Compactor_ResolveDuplicateMetadata(swigCPtr, key, num_tags, SWIGTYPE_p_std__string.getCPtr(tags))); generated-csharp/Compactor.cs: return ResolveDuplicateMetadata(key, num_tags, (tags == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_std__string(tags, false)); generated-csharp/Compactor.cs: private static global::System.Type[] swigMethodTypes1 = new global::System.Type[] { typeof(string), typeof(uint), typeof(SWIGTYPE_p_std__string) }; generated-csharp/QueryParser.cs: public void AddBooleanPrefix(string field, string prefix, SWIGTYPE_p_std__string grouping) { generated-csharp/QueryParser.cs: XapianPINVOKE.QueryParser_AddBooleanPrefix__SWIG_0(swigCPtr, field, prefix, SWIGTYPE_p_std__string.getCPtr(grouping)); generated-csharp/QueryParser.cs: public void AddBooleanPrefix(string field, FieldProcessor proc, SWIGTYPE_p_std__string grouping) { generated-csharp/QueryParser.cs: XapianPINVOKE.QueryParser_AddBooleanPrefix__SWIG_3(swigCPtr, field, FieldProcessor.getCPtr(proc), SWIGTYPE_p_std__string.getCPtr(grouping)); generated-csharp/QueryParser.cs: public void AddRangeprocessor(RangeProcessor range_proc, SWIGTYPE_p_std__string grouping) { generated-csharp/QueryParser.cs: XapianPINVOKE.QueryParser_AddRangeprocessor__SWIG_0(swigCPtr, RangeProcessor.getCPtr(range_proc), SWIGTYPE_p_std__string.getCPtr(grouping)); generated-csharp/SWIGTYPE_p_std__string.cs:public class SWIGTYPE_p_std__string { generated-csharp/SWIGTYPE_p_std__string.cs: internal SWIGTYPE_p_std__string(global::System.IntPtr cPtr, bool futureUse) { generated-csharp/SWIGTYPE_p_std__string.cs: protected SWIGTYPE_p_std__string() { generated-csharp/SWIGTYPE_p_std__string.cs: internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_std__string obj) {
So the current uses are:
Compactor::resolve_duplicate_metadata()
'stags
parameter - this is a fairly obscure feature, but ideallynum_tags
andtags
should map to some sort of ordered container of strings in the bindings.- The
grouping
parameter toQueryParser::add_boolean_prefix()
andQueryParser::add_rangeprocessor()
- this is essentially a nullable string parameter, so that's how it should be wrapped for the bindings.
comment:7 by , 4 years ago
Status: | new → assigned |
---|
15c8ee918667d3af965ebcf55cc585d6aeffcdc1 wraps the const std::string*
parameters to accept a C# string
or null
- that just leaves Compactor::resolve_duplicate_metadata()
to deal with.
comment:8 by , 4 years ago
Description: | modified (diff) |
---|---|
Summary: | Sort out C# bindings to avoid SWIGTYPE_p_*.cs → Sort out C# and Java bindings to avoid SWIGTYPE |
Java has the same issues, and I've addressed const std::string*
wrapping there in the same way as for C++ in c77630eee1da068c7a6a2009011b7d10e2b8a999.
comment:9 by , 4 years ago
I've backported the C# and Java const std::string*
parameter handling improvements ready for 1.4.18 in 5fb3813fa9d7cc30a0ada78bef17d9d032f2aceb and c5e3a43220a551813beb61ad2601e364802f5663.
In git master, only the Compactor::resolve_duplicate_metadata()
use is still to deal with (for both C# and Java).
In 1.4 there's also ValueRangeProcessor
and subclasses, but those are deprecated in 1.4 and gone in git master so I don't think it's worthwhile changing them now.
comment:10 by , 13 months ago
Milestone: | 1.5.0 → 2.0.0 |
---|
It would be good to resolve this, but it's only one obscure method which is affected so postponing for now.
r16251 removes two of these (for trunk) - so currently we only have
SWIGTYPE_p_std__string.cs
, which is presumably fromValueRangeProcessor::operator()
which takes twostd::string &
arguments.