-
Hi Is there a way to overrite a type generated in the Java method? For example: .put(new Info("Test<MyType>").base("Pointer").pointerTypes("MyType").define()) and when I get the Java defintion: @Name("Test<MyType>") public static class MyType extends Pointer {
static { Loader.load(); }
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
public MyType(Pointer p) { super(p); }
/** Native array allocator. Access with {@link Pointer#position(long)}. */
public MyType(long size) { super((Pointer)null); allocateArray(size); }
private native void allocateArray(long size);
@Override public MyType position(long position) {
return (MyType)super.position(position);
}
@Override public MyType getPointer(long i) {
return new MyType((Pointer)this).offsetAddress(i);
}
public static native @ByVal @Cast("Test<MyType>::self_type*") @NoException(true) MyType min();
public static native @ByVal @Cast("Test<MyType>::self_type*") @NoException(true) MyType max();
public MyType() { super((Pointer)null); allocate(); }
@NoException(true) private native void allocate();
public MyType(@Const @ByRef MyType c) { super((Pointer)null); allocate(c); }
@NoException(true) private native void allocate(@Const @ByRef MyType c);
public native @ByRef @Name("operator =") @NoException(true) MyType put(@Const @ByRef MyType c);
public MyType(@ByVal @Cast("Test<MyType>::duration_rep_type*") Impl::int_type d) { super((Pointer)null); allocate(d); }
@NoException(true) private native void allocate(@ByVal @Cast("Test<MyType>::duration_rep_type*") Impl::int_type d);
} I know the type for "Impl::int_type " but the parser can't get it. Can I inject something or overwrite it directly to set it as "int"? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
Sure, something like this should work: infoMap.put(new Info("Impl::int_type", "Test<MyType>::duration_rep_type").cast().valueTypes("int").pointerTypes("IntPointer"))); |
Beta Was this translation helpful? Give feedback.
-
Additional questionm, is there a way to ignore one specific method from a class? |
Beta Was this translation helpful? Give feedback.
-
Even if I add that skip it doesn't work. The issue is that as I use .base("Pointer") the casting to base is forced here. |
Beta Was this translation helpful? Give feedback.
-
It took me a while to recreate it. template<class T>
class Z{
public:
T z;
Z(T _z) : z(_z) { }
};
template<class T>
class Y{
public:
T y;
Y(T _y) : y(_y) { }
};
template<class T, class K>
class XB : public Y<T>, public Z<K>{
public:
XB(T _y, K _k)
{
this->y=_y;
this->z=_k;
}
void foo() {
int i = 0;
}
}; and when using: .put(new Info("XB<int,int>").base("Pointer").pointerTypes("XB").define())
.put(new Info("Z<K>").skip()) the result is: @Name("XB<int,int>") public static class XB extends Pointer {
static { Loader.load(); }
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
public XB(Pointer p) { super(p); }
**public Z<K> asZ<K>() { return asZ<K>(this); }**
**@Namespace public static native @Name("static_cast<Z<K>*>") Z<K> asZ<K>(XB pointer);**
public XB(int _y, int _k) { super((Pointer)null); allocate(_y, _k); }
private native void allocate(int _y, int _k);
public native void foo();
} Basically one of the base classes is always added to the cast list. Thanks |
Beta Was this translation helpful? Give feedback.
Sure, something like this should work: