javaextensions/satsa/framework/inc/satsajnitools.h
changeset 21 2a9601315dfc
equal deleted inserted replaced
18:e8e63152f320 21:2a9601315dfc
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 //  INCLUDE FILES
       
    21 #include <jutils.h>
       
    22 
       
    23 /*
       
    24  * The following macro makes it possible to transfer data from a descriptor
       
    25  * to a java byte array
       
    26  */
       
    27 #define JAVA_PTR(aPtr) reinterpret_cast< jbyte * >( const_cast< unsigned char * >( aPtr ) )
       
    28 
       
    29 
       
    30 /**
       
    31 * Sets an error code to the first element of given Java int array.
       
    32 *
       
    33 * @param aJniEnv Pointer to JNI environment.
       
    34 * @param aErrorTo Java int array, where to put the error code.
       
    35 * @param aErrorFrom Error code.
       
    36 *
       
    37 * @par Notes:
       
    38 * @li The function panics if the array does not have at least one element.
       
    39 */
       
    40 void STSSetJavaErrorCode(
       
    41     JNIEnv* aJniEnv,
       
    42     jintArray aErrorTo,
       
    43     const TInt& aErrorFrom);
       
    44 
       
    45 /**
       
    46  * Creates a java string array to a native string array.
       
    47  *
       
    48  * @param aJniEnv JNI environment.
       
    49  * @param aJavaArray Java string array.
       
    50  *
       
    51  * @return Native string array, elements converted from \a aJavaArray.
       
    52  *
       
    53  * @par Notes:
       
    54  * @li It is assumed that the object array contains only jstring objects.
       
    55  * Object type is \b not checked.
       
    56  *
       
    57  * @par Leaving:
       
    58  * @li Any - internal error (probably OOM).
       
    59  */
       
    60 CDesCArrayFlat* STSCreateNativeStringArrayL(
       
    61     JNIEnv* aJniEnv,
       
    62     jobjectArray aJavaArray);
       
    63 
       
    64 
       
    65 /**
       
    66  * Creates Java string array from native string array.
       
    67  *
       
    68  * @param aJniEnv JNI environment.
       
    69  * @param aNativeArray Native string array.
       
    70  * @param aConvertPIMNullArrayElements If ETrue, KPIMNullArrayElement
       
    71  *        elements are converted to NULL elements; otherwise they
       
    72  *        are not handled specially.
       
    73  *
       
    74  * @return Java string array, elements converted from \a aNativeArray
       
    75  *         or NULL on error (probably OOM).
       
    76  */
       
    77 jobjectArray CreateJavaStringArray(
       
    78     JNIEnv* aJniEnv,
       
    79     const CDesCArray& aNativeArray,
       
    80     TBool aConvertPIMNullArrayElements);
       
    81 
       
    82 // End of File
       
    83