Explorar o código

[cpp] Expose some ArrayBase functions via the cpp.NativeArray and cpp.ArrayBase classes

Hugh %!s(int64=10) %!d(string=hai) anos
pai
achega
3ccfca5bdd
Modificáronse 2 ficheiros con 15 adicións e 0 borrados
  1. 11 0
      std/cpp/ArrayBase.hx
  2. 4 0
      std/cpp/NativeArray.hx

+ 11 - 0
std/cpp/ArrayBase.hx

@@ -0,0 +1,11 @@
+package cpp;
+
+extern class ArrayBase
+{
+   // Length is number of elements
+   public var length(default,null):Int;
+   public function getElementSize():Int;
+   public function getByteCount():Int;
+   public function getBase():RawPointer<Char>;
+}
+

+ 4 - 0
std/cpp/NativeArray.hx

@@ -8,6 +8,10 @@ extern class NativeArray {
 	untyped ioDestArray.blit(inDestElement, inSourceArray, inSourceElement, inElementCount);
 	};
 
+	public static inline function getBase( inArray:Array<Dynamic> ) : ArrayBase {
+      return untyped inArray;
+   }
+
 	public static inline function zero<T>( ioDestArray:Array<T>, ?inFirst:Int, ?inElements:Int ) : Void {
 		untyped ioDestArray.zero(inFirst, inElements);
 	};