javacommons/utils/src/utilsnative.cpp
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2007 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 #include "logger.h"
       
    20 #include "javacommonutils.h"
       
    21 #include "com_nokia_mj_impl_properties_common_Locale.h"
       
    22 #include "com_nokia_mj_impl_properties_common_Platform.h"
       
    23 #include "com_nokia_mj_impl_properties_common_FreeMemory.h"
       
    24 #include "commonproperties.h"
       
    25 #include "exceptionbase.h"
       
    26 
       
    27 using namespace java::util;
       
    28 
       
    29 JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_properties_common_Locale__1getLocale
       
    30 (JNIEnv* env, jobject /*peer*/)
       
    31 {
       
    32     JELOG2(EUtils);
       
    33     jstring result = 0;
       
    34     try
       
    35     {
       
    36         result = getLocaleImpl(env);
       
    37     }
       
    38     catch (ExceptionBase& ex)
       
    39     {
       
    40         ELOG1(EUtils,"%s",ex.toString().c_str());
       
    41     }
       
    42     catch (...)
       
    43     {
       
    44         ELOG(EUtils,"ERROR!!! MidpRuntime.getLocale(): Unexpected exception was caught");
       
    45     }
       
    46     return result;
       
    47 }
       
    48 
       
    49 JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_properties_common_Platform__1getPlatform
       
    50 (JNIEnv* env, jobject /*peer*/)
       
    51 {
       
    52     JELOG2(EUtils);
       
    53     jstring result = 0;
       
    54     try
       
    55     {
       
    56         result = getPlatformImpl(env);
       
    57     }
       
    58     catch (ExceptionBase& ex)
       
    59     {
       
    60         ELOG1(EUtils,"%s",ex.toString().c_str());
       
    61     }
       
    62     catch (...)
       
    63     {
       
    64         ELOG(EUtils,"ERROR!!! MidpRuntime.getPlatform(): Unexpected exception was caught");
       
    65     }
       
    66     return result;
       
    67 }
       
    68 
       
    69 
       
    70 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_properties_common_FreeMemory__1getFreeMemory
       
    71 (JNIEnv* env, jobject /*peer*/)
       
    72 {
       
    73     JELOG2(EUtils);
       
    74     jint freeMemory = -1;
       
    75     try
       
    76     {
       
    77         freeMemory = getFreeMemoryImpl(env);
       
    78     }
       
    79     catch (ExceptionBase& ex)
       
    80     {
       
    81         ELOG1(EUtils,"%s",ex.toString().c_str());
       
    82     }
       
    83     catch (...)
       
    84     {
       
    85         ELOG(EUtils,"ERROR!!! getFreeMemoryImpl(): Unexpected exception was caught");
       
    86     }
       
    87     return freeMemory;
       
    88 }