configlib/dbmsjdbc/src/native/Utils.h
changeset 1 b538b70cbe51
equal deleted inserted replaced
0:2e8eeb919028 1:b538b70cbe51
       
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <e32std.h>
       
    17 #include <e32des8.h>
       
    18 #include <jni.h>
       
    19 
       
    20 //----------------------------------------------------------------------------
       
    21 // RJString takes a Java JNI string and converts it to an
       
    22 // Epoc string. It retains the JNI environment and the string
       
    23 // in order to release the string resources during destruction
       
    24 class RJString : public TPtrC16
       
    25 	{
       
    26 public:
       
    27 	RJString( JNIEnv& aJni, jstring aString );
       
    28 	~RJString();
       
    29 
       
    30 private:
       
    31 	// Prevent accidental copying because of the shared underlying Java
       
    32 	// string
       
    33 	RJString( const RJString& );
       
    34 	RJString& operator=( const RJString& );
       
    35 
       
    36 private:
       
    37 	JNIEnv& iJni;
       
    38 	jstring iString;
       
    39 	};
       
    40 
       
    41 //----------------------------------------------------------------------------
       
    42 jstring CreateJavaString( JNIEnv* aJni, const TDesC16& aString );
       
    43 
       
    44 void SosPanicHandler(const TDesC& aCat, TInt aReason);
       
    45 
       
    46 void ThrowRtExc(JNIEnv* aJni, const TDesC8& aMessage );
       
    47 
       
    48 void ThrowExc(JNIEnv* aJni, const TDesC8& aException, const TDesC8& aMessage );
       
    49 
       
    50 void ThrowExc(JNIEnv* aJni, const TInt aErrorCode );
       
    51 
       
    52 void GetException(TInt aErrorCode, TDes8& aBuf, TDes8& aMessage);