|
1 /* |
|
2 * Copyright (c) 2008-2009 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: formatternative |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <time.h> |
|
20 |
|
21 #include "com_nokia_mj_impl_utils_Formatter.h" |
|
22 #include "com_nokia_mj_impl_utils_ResourceLoader.h" |
|
23 #include "javacommonutils.h" |
|
24 #include "javajniutils.h" |
|
25 #include "logger.h" |
|
26 |
|
27 JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_utils_Formatter__1formatInteger |
|
28 (JNIEnv *aJni, jobject, jint aNumber) |
|
29 { |
|
30 // Stub implementation |
|
31 std::string intStr = java::util::JavaCommonUtils::intToString(aNumber); |
|
32 return aJni->NewStringUTF(intStr.c_str()); |
|
33 } |
|
34 |
|
35 JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_utils_Formatter__1formatDate |
|
36 (JNIEnv * aJni, jobject, jlong timeInMillis) |
|
37 { |
|
38 // Stub implementation. Missing localisation. |
|
39 time_t javaTime = timeInMillis/1000; |
|
40 char buffer[80]; |
|
41 struct tm* timeInfo; |
|
42 timeInfo = localtime(&javaTime); |
|
43 |
|
44 // European format as default. |
|
45 strftime(buffer, 80, "%d/%m/%Y", timeInfo); |
|
46 |
|
47 std::string dateStr(buffer); |
|
48 |
|
49 return aJni->NewStringUTF(dateStr.c_str()); |
|
50 } |
|
51 |
|
52 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_utils_ResourceLoader__1getLocaleId |
|
53 (JNIEnv *, jobject) |
|
54 |
|
55 { |
|
56 // Stub implementation. This triggers using default "sc" engineering |
|
57 // english at Java side. |
|
58 return (jint) -1; |
|
59 } |
|
60 |