1 // array.h - Header file for CNI arrays. -*- c++ -*-
3 /* Copyright (C) 1998, 1999 Cygnus Solutions
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
11 #ifndef __GCJ_ARRAY_H__
12 #define __GCJ_ARRAY_H__
14 #include <java/lang/Object.h>
18 class __JArray
: public java::lang::Object
22 friend jsize
JvGetArrayLength (__JArray
*);
26 class JArray
: public __JArray
30 friend T
* elements
<>(JArray
<T
>& x
);
31 friend T
* elements
<>(JArray
<T
>* x
);
32 // T* getData() { return data; }
33 // T& operator[](jint i) { return data[i]; }
37 T
* elements(JArray
<T
>& x
) { return x
.data
; }
39 T
* elements(JArray
<T
>* x
) { return x
->data
; }
41 }; // end extern "Java"
43 /* These typesdefs match those in JNI. */
44 typedef __JArray
*jarray
;
45 typedef JArray
<jobject
> *jobjectArray
;
46 typedef JArray
<jboolean
> *jbooleanArray
;
47 typedef JArray
<jbyte
> *jbyteArray
;
48 typedef JArray
<jchar
> *jcharArray
;
49 typedef JArray
<jshort
> *jshortArray
;
50 typedef JArray
<jint
> *jintArray
;
51 typedef JArray
<jlong
> *jlongArray
;
52 typedef JArray
<jfloat
> *jfloatArray
;
53 typedef JArray
<jdouble
> *jdoubleArray
;
54 typedef JArray
<jstring
> *jstringArray
;
56 extern "C" jbooleanArray
JvNewBooleanArray (jint length
);
57 extern "C" jbyteArray
JvNewByteArray (jint length
);
58 extern "C" jcharArray
JvNewCharArray (jint length
);
59 extern "C" jshortArray
JvNewShortArray (jint length
);
60 extern "C" jintArray
JvNewIntArray (jint length
);
61 extern "C" jlongArray
JvNewLongArray (jint length
);
62 extern "C" jfloatArray
JvNewFloatArray (jint length
);
63 extern "C" jdoubleArray
JvNewDoubleArray (jint length
);
64 extern "C" jobjectArray
_Jv_NewObjectArray(jsize length
, jclass
, jobject init
);
66 inline jobjectArray
JvNewObjectArray (jsize length
, jclass cls
, jobject init
)
67 { return _Jv_NewObjectArray (length
, cls
, init
); }
69 extern "C" jstringArray
JvConvertArgv(int argc
, const char **argv
);
71 inline jsize
JvGetArrayLength (jarray array
) { return array
->length
; }
73 #endif /* __GCJ_ARRAY_H__ */