Browse Source

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

Hugh 10 years ago
parent
commit
3ccfca5bdd
2 changed files with 15 additions and 0 deletions
  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);
 	};