Modify permissions for files in Things Manager
[platform/upstream/iotivity.git] / service / easy-setup / sdk / mediator / android / jni / jniutil / inc / jni_object.h
1 /******************************************************************
2  *
3  * Copyright 2015 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ******************************************************************/
20
21 /**
22  * @file   jni_object.h
23  *
24  * @brief  This file contains the JObject class  declarations and its functions required
25  *            for getting and setting basic data types in C++ and Java
26  */
27
28 #ifndef __JNI_OBJECT_H_
29 #define __JNI_OBJECT_H_
30
31 #include <jni.h>
32 #include "JniOcResource.h"
33
34 /**
35  * @class   JObject
36  * @brief   This class provides a set of functions for JNI object.
37  *
38  */
39 class JObject {
40 public:
41         /**
42          * @brief constructor
43          */
44         JObject(JNIEnv *env);
45
46         /**
47          * @brief constructor
48          */
49         JObject(JNIEnv *env, jobject obj);
50
51         /**
52          * @brief constructor
53          */
54         JObject(JNIEnv *env, const char *classPath);
55
56         /**
57          * @brief destructor
58          *
59          */
60         virtual ~JObject();
61
62         /**
63          * Function to get the jobject.
64          *
65          * @return jobject, returns a new JNI object or NULL otherwise.
66          *
67          */
68         virtual jobject getObject() const;
69
70         /**
71          * Function to detach the jobject.
72          *
73          * @return void
74          *
75          */
76         void detachObject();
77
78 protected:
79         /**
80          *  JNI Environment Pointer
81          */
82         JNIEnv *m_pEnv;
83         /**
84          *  Java Object
85          */
86         jobject m_pObject;
87         /**
88          *  Java Class
89          */
90         jclass m_pClazz;
91         /**
92          *  Boolean variable to check if an object is new
93          */
94         bool m_fIsNewObject;
95 };
96 #endif //__JNI_OBJECT_H_