equal
deleted
inserted
replaced
|
1 /******************************************************************************* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. This program and the accompanying materials |
|
4 * are made available under the terms of the Eclipse Public License v1.0 |
|
5 * which accompanies this distribution, and is available at |
|
6 * http://www.eclipse.org/legal/epl-v10.html |
|
7 * |
|
8 * Contributors: |
|
9 * Nokia Corporation - initial implementation |
|
10 *******************************************************************************/ |
|
11 |
|
12 #ifndef NOKIAUIAUTORELEASE_H |
|
13 #define NOKIAUIAUTORELEASE_H |
|
14 |
|
15 /** |
|
16 * Helper class to automatically call ReleaseStringChars for a Java |
|
17 * string chars object obtained from a call to GetStringChars. |
|
18 */ |
|
19 class AutoReleaseStringChars |
|
20 { |
|
21 public: |
|
22 AutoReleaseStringChars( JNIEnv* aJniEnv, jstring aString, const jchar* aPointer ) |
|
23 : mJniEnv( aJniEnv ), mString( aString ), mPointer( aPointer ) |
|
24 {} |
|
25 virtual ~AutoReleaseStringChars() |
|
26 { |
|
27 mJniEnv->ReleaseStringChars( mString, mPointer ); |
|
28 } |
|
29 protected: |
|
30 JNIEnv* mJniEnv; |
|
31 jstring mString; |
|
32 const jchar* mPointer; |
|
33 }; |
|
34 |
|
35 #endif // NOKIAUIAUTORELEASE_H |
|
36 |